Files
0ad/libraries/source/premake-core/build.sh
T
Ralph Sennhauser accecc5894 Bump premake-core to 5.0.0-beta3
This is the version used for Windows already and contains the fix for
building against spidermonkey on all Linux distributions.

Backport patch to fix running on *BSD. Also make clang default on *BSD
as a toolset will always added to generated makefiles in beta3, so it
won't magically do what we expect when not adding --cc explicitly.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2024-12-15 18:34:27 +01:00

69 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
set -e
: "${OS:=$(uname -s || true)}"
: "${MAKE:=make}"
: "${JOBS:=-j1}"
cd "$(dirname "$0")"
PV=5.0.0-beta3
LIB_VERSION=${PV}+wfg0
echo "Building Premake..."
while [ "$#" -gt 0 ]; do
case "$1" in
--force-rebuild) rm -f .already-built ;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
shift
done
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "Skipping - already built (use --force-rebuild to override)"
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-Use-_SC_NPROCESSORS_ONLN-for-CPU-detection-in-BSDs.-.patch
patch -d "premake-core-${PV}" -p1 <patches/0002-Make-clang-default-toolset-for-BSD.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