Improve reporting of build environment for premake

Various environment variables may have an impact on what premake will
do, properly report them in the output and consolidate others.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2025-06-28 13:08:18 +02:00
parent 3a38fcb17c
commit d8af7b9416
2 changed files with 35 additions and 6 deletions
+35 -3
View File
@@ -1,12 +1,44 @@
local semver = require("semver")
if (semver("5.0.0-beta5") <= semver(_PREMAKE_VERSION)) then
print("Using premake " .. _PREMAKE_VERSION .. "...")
else
print("Premake version: " .. _PREMAKE_VERSION)
if (semver(_PREMAKE_VERSION) < semver("5.0.0-beta5")) then
print("Requires Premake 5.0.0-beta5 or later")
print("Aborting")
os.exit(1)
end
local function print_options()
local options = ""
local tkeys = {}
for key,_ in pairs(_OPTIONS) do table.insert(tkeys, key) end
table.sort(tkeys)
for _,key in pairs(tkeys) do
local value = _OPTIONS[key]
options = options .. " --" .. key
if (value and value ~= "") then
options = options .. "=" .. value
end
end
print("Premake options:" .. options)
end
print_options()
print("")
print("--------------------------------------------------------------------------------")
print("Environment")
print("")
print("AR : " .. (os.getenv("AR") or "unset"))
print("CC : " .. (os.getenv("CC") or "unset"))
print("CXX : " .. (os.getenv("CXX") or "unset"))
print("HOSTTYPE : " .. (os.getenv("HOSTTYPE") or "unset"))
print("PKG_CONFIG : " .. (os.getenv("PKG_CONFIG") or "unset"))
print("")
print("CFLAGS : " .. (os.getenv("CFLAGS") or "unset"))
print("CXXFLAGS : " .. (os.getenv("CXXFLAGS") or "unset"))
print("LDFLAGS : " .. (os.getenv("LDFLAGS") or "unset"))
print("--------------------------------------------------------------------------------")
print("")
newoption { category = "Pyrogenesis", trigger = "android", description = "Use non-working Android cross-compiling mode" }
newoption { category = "Pyrogenesis", trigger = "coverage", description = "Enable code coverage data collection (GCC only)" }
newoption { category = "Pyrogenesis", trigger = "gles", description = "Use non-working OpenGL ES 2.0 mode" }
-3
View File
@@ -40,12 +40,9 @@ if [ "$with_system_premake5" = "false" ]; then
premake_command="../../libraries/source/premake-core/bin/premake5"
fi
echo
# If we're in bash then make HOSTTYPE available to Premake, for primitive arch-detection
export HOSTTYPE="$HOSTTYPE"
# Now run Premake to create the makefiles
echo "Premake args: ${premake_args}"
if [ "$OS" != "Darwin" ]; then
# shellcheck disable=SC2086
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"