2024-10-19 01:37:16 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
: "${OS:=$(uname -s || true)}"
|
|
|
|
|
: "${MAKE:=make}"
|
|
|
|
|
: "${JOBS:=-j1}"
|
2025-02-07 08:10:37 -08:00
|
|
|
: "${TAR:=tar}"
|
2024-10-19 01:37:16 -07:00
|
|
|
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
2025-09-18 01:28:08 -07:00
|
|
|
PV=5.0.0-beta7
|
|
|
|
|
LIB_VERSION=${PV}+wfg0
|
2024-10-19 01:37:16 -07:00
|
|
|
|
2025-01-17 09:27:30 -08:00
|
|
|
fetch()
|
|
|
|
|
{
|
|
|
|
|
curl -fLo "premake-core-${PV}.tar.gz" \
|
|
|
|
|
"https://github.com/premake/premake-core/archive/refs/tags/v${PV}.tar.gz"
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-15 01:23:23 -08:00
|
|
|
echo "Building Premake..."
|
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
|
|
|
case "$1" in
|
2025-01-17 09:27:30 -08:00
|
|
|
--fetch-only)
|
|
|
|
|
fetch
|
|
|
|
|
exit
|
|
|
|
|
;;
|
2024-12-15 01:23:23 -08:00
|
|
|
--force-rebuild) rm -f .already-built ;;
|
|
|
|
|
*)
|
|
|
|
|
echo "Unknown option: $1"
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
shift
|
|
|
|
|
done
|
|
|
|
|
|
2024-10-19 01:37:16 -07:00
|
|
|
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
|
2024-12-15 01:23:23 -08:00
|
|
|
echo "Skipping - already built (use --force-rebuild to override)"
|
2024-10-19 01:37:16 -07:00
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# fetch
|
|
|
|
|
if [ ! -e "premake-core-${PV}.tar.gz" ]; then
|
2025-01-17 09:27:30 -08:00
|
|
|
fetch
|
2024-10-19 01:37:16 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# unpack
|
|
|
|
|
rm -Rf "premake-core-${PV}"
|
2025-02-07 08:10:37 -08:00
|
|
|
"${TAR}" -xf "premake-core-${PV}.tar.gz"
|
2024-10-19 01:37:16 -07:00
|
|
|
|
2024-12-20 22:27:44 -08:00
|
|
|
# patch
|
|
|
|
|
# https://github.com/premake/premake-core/issues/2338
|
2025-01-06 12:18:33 -08:00
|
|
|
patch -d "premake-core-${PV}" -p1 <patches/0001-Make-clang-default-toolset-for-BSD.patch
|
2024-10-19 01:37:16 -07:00
|
|
|
|
|
|
|
|
#build
|
|
|
|
|
(
|
|
|
|
|
cd "premake-core-${PV}"
|
|
|
|
|
case "${OS}" in
|
|
|
|
|
Windows)
|
|
|
|
|
${MAKE} "${JOBS}" -f Bootstrap.mak windows
|
|
|
|
|
;;
|
|
|
|
|
Darwin)
|
2025-04-27 01:48:39 -07:00
|
|
|
${MAKE} "${JOBS}" -f Bootstrap.mak PREMAKE_OPTS="--zlib-src=none --curl-src=none" osx
|
2024-10-19 01:37:16 -07:00
|
|
|
;;
|
|
|
|
|
*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
|