Package and bump premake-core

Treat premake like any other dependency and package it separately, this
makes it much easier to bump it in future by making it easier to track
modifications if any.

Moving it to libraries as it is handled the same as other packages. An
argument could be made to have it in build due to it's special nature.
The issue with that approach would be how to handle clean-workspace.sh.
If we split it out we would need a separate clean-premake.sh script and
if we have it cleaned by clean-workspace we through away the download
and already built binary.

Also bump version to 5.0.0-beta2 and backport patch for macOS fix
instead of the Makefile changes. The same fix is needed for gcc-14
(reported upstream), so add a patch injecting unistd.h for Unixes.

Fixes: #6816
Fixes: #6632
Refs: #6847
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2024-10-19 10:37:16 +02:00
parent 19aca9fe74
commit 486509d5b9
No known key found for this signature in database
7 changed files with 115 additions and 4 deletions

1
.gitignore vendored
View file

@ -19,6 +19,7 @@ libraries/win32
libraries/source/cxxtest-4.4/*
libraries/source/fcollada/*
libraries/source/nvtt/*
libraries/source/premake-core/*
libraries/source/spidermonkey/*
libraries/source/spirv-reflect/*
!libraries/source/**/build.sh

View file

@ -72,10 +72,7 @@ cd ../premake || die
premake_command="premake5"
if [ "$with_system_premake5" = "false" ]; then
# Build bundled premake
MAKE=${MAKE} JOBS=${JOBS} ./build.sh || die "Premake 5 build failed"
premake_command="premake5/bin/release/premake5"
premake_command="../../libraries/source/premake-core/bin/premake5"
fi
echo

View file

@ -1142,6 +1142,11 @@ echo "Building nvtt..."
./../source/nvtt/build.sh || die "NVTT build failed"
# --------------------------------------------------------------
echo "Building Premake..."
./../source/premake-core/build.sh || die "Premake build failed"
# --------------------------------------------------------------
echo "Building Spidermonkey..."

View file

@ -25,6 +25,7 @@ without_nvtt=false
with_system_cxxtest=false
with_system_nvtt=false
with_system_mozjs=false
with_system_premake=false
with_spirv_reflect=false
JOBS=${JOBS:="-j2"}
@ -35,6 +36,7 @@ for i in "$@"; do
--with-system-cxxtest) with_system_cxxtest=true ;;
--with-system-nvtt) with_system_nvtt=true ;;
--with-system-mozjs) with_system_mozjs=true ;;
--with-system-premake) with_system_mozjs=true ;;
--with-spirv-reflect) with_spirv_reflect=true ;;
-j*) JOBS=$i ;;
esac
@ -68,6 +70,10 @@ if [ "$with_system_nvtt" = "false" ] && [ "$without_nvtt" = "false" ]; then
cp source/nvtt/bin/* ../binaries/system/
fi
echo
if [ "$with_system_premake" = "false" ]; then
./source/premake-core/build.sh || die "Premake build failed"
fi
echo
if [ "$with_system_mozjs" = "false" ]; then
./source/spidermonkey/build.sh || die "SpiderMonkey build failed"
cp source/spidermonkey/bin/* ../binaries/system/

View file

@ -0,0 +1,56 @@
#!/bin/sh
set -e
: "${OS:=$(uname -s || true)}"
: "${MAKE:=make}"
: "${JOBS:=-j1}"
cd "$(dirname "$0")"
PV=5.0.0-beta2
LIB_VERSION=${PV}+wfg1
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "premake is already up to date."
exit
fi
# fetch
if [ ! -e "premake-core-${PV}.tar.gz" ]; then
curl -fLo "premake-core-${PV}.tar.gz" \
"https://github.com/premake/premake-core/archive/refs/tags/v${PV}.tar.gz"
fi
# unpack
rm -Rf "premake-core-${PV}"
tar -xf "premake-core-${PV}.tar.gz"
#patch
patch -d "premake-core-${PV}" -p1 <patches/0001-Require-unistd.h-for-macosx-in-libzip.patch
patch -d "premake-core-${PV}" -p1 <patches/0002-Forceinclude-unistd.h-on-all-Unixes.patch
#build
(
cd "premake-core-${PV}"
case "${OS}" in
Windows)
${MAKE} "${JOBS}" -f Bootstrap.mak windows
;;
Darwin)
${MAKE} "${JOBS}" -f Bootstrap.mak osx
;;
*BSD)
${MAKE} "${JOBS}" -f Bootstrap.mak bsd
;;
*)
${MAKE} "${JOBS}" -f Bootstrap.mak linux
;;
esac
)
# install
rm -Rf bin
mkdir -p bin
cp "premake-core-${PV}/bin/release/premake5" bin/
echo "${LIB_VERSION}" >.already-built

View file

@ -0,0 +1,21 @@
From 8eb0523a91a94c5c49a9ab7e0c9dac53e3a192ef Mon Sep 17 00:00:00 2001
From: Nicholaus Clark <nicholaus.clark115@gmail.com>
Date: Wed, 9 Aug 2023 10:32:45 -0400
Subject: [PATCH 1/1] Require unistd.h for macosx in libzip
---
contrib/libzip/premake5.lua | 1 +
1 file changed, 1 insertion(+)
diff --git a/contrib/libzip/premake5.lua b/contrib/libzip/premake5.lua
index 1532d518..c35592a5 100644
--- a/contrib/libzip/premake5.lua
+++ b/contrib/libzip/premake5.lua
@@ -21,3 +21,4 @@ project "zip-lib"
filter "system:macosx"
defines { "HAVE_SSIZE_T_LIBZIP" }
+ forceincludes { "unistd.h" }
--
2.44.2

View file

@ -0,0 +1,25 @@
From dca8ff71fc9ec29761d98ec0cdb5bd352ec8d295 Mon Sep 17 00:00:00 2001
From: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Date: Mon, 30 Sep 2024 22:08:13 +0200
Subject: [PATCH] Forceinclude unistd.h on all Unixes
https://github.com/premake/premake-core/issues/2276
---
contrib/libzip/premake5.lua | 1 +
1 file changed, 1 insertion(+)
diff --git a/contrib/libzip/premake5.lua b/contrib/libzip/premake5.lua
index c35592a5..f0b91b56 100644
--- a/contrib/libzip/premake5.lua
+++ b/contrib/libzip/premake5.lua
@@ -13,6 +13,7 @@ project "zip-lib"
filter "system:linux or bsd or solaris or haiku"
defines { "HAVE_SSIZE_T_LIBZIP", "HAVE_CONFIG_H" }
+ forceincludes { "unistd.h" }
filter "system:windows"
defines { "_WINDOWS" }
--
2.45.2