2019-12-17 08:03:41 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
|
|
|
|
if [ -z "${PLATFORM_SHORT-}" ]; then
|
2021-03-12 14:02:02 -06:00
|
|
|
>&2 echo "PLATFORM_SHORT not set (lin, mac, win)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "${MACHINE_SHORT-}" ]; then
|
|
|
|
>&2 echo "MACHINE_SHORT not set (x86_64, i686)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "${TOOLSET_SHORT-}" ]; then
|
|
|
|
>&2 echo "TOOLSET_SHORT not set (gcc, clang, mingw)"
|
2019-12-17 08:03:41 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "${STATIC_DYNAMIC-}" ]; then
|
2021-03-12 14:02:02 -06:00
|
|
|
>&2 echo "STATIC_DYNAMIC not set (static, dynamic)"
|
2019-12-17 08:03:41 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "${RELTYPECFG-}" ]; then
|
|
|
|
>&2 echo "RELTYPECFG not set"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-04-04 15:09:16 -05:00
|
|
|
if [ -z "${RELNAME-}" ]; then
|
|
|
|
>&2 echo "RELNAME not set"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "${MOD_ID-}" ]; then
|
|
|
|
>&2 echo "MOD_ID not set"
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-12-17 08:03:41 -06:00
|
|
|
|
|
|
|
if [ -z "${build_sh_init-}" ]; then
|
|
|
|
if [ $PLATFORM_SHORT == "win" ]; then
|
|
|
|
for i in C:/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/**/**/VC/Auxiliary/Build/vcvarsall.bat; do
|
|
|
|
vcvarsall_path=$i
|
|
|
|
done
|
2021-03-12 14:02:02 -06:00
|
|
|
if [ $MACHINE_SHORT == "x86_64" ]; then
|
|
|
|
x64_x86=x64
|
|
|
|
else
|
|
|
|
x64_x86=x86
|
|
|
|
fi
|
2019-12-17 08:03:41 -06:00
|
|
|
cat << BUILD_INIT_BAT > .github/build_init.bat
|
|
|
|
@echo off
|
2021-03-12 14:02:02 -06:00
|
|
|
call "${vcvarsall_path}" ${x64_x86}
|
2019-12-17 08:03:41 -06:00
|
|
|
bash -c 'build_sh_init=1 ./.github/build.sh'
|
|
|
|
BUILD_INIT_BAT
|
|
|
|
./.github/build_init.bat
|
|
|
|
else
|
|
|
|
build_sh_init=1 ./.github/build.sh
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2021-04-04 15:09:16 -05:00
|
|
|
other_flags=$'\t-Dmod_id='
|
|
|
|
other_flags+=$MOD_ID
|
2021-01-21 12:08:27 -06:00
|
|
|
bin_suffix=
|
2019-12-17 08:03:41 -06:00
|
|
|
static_flag=
|
|
|
|
if [ $STATIC_DYNAMIC == "static" ]; then
|
|
|
|
static_flag=-Dstatic=prebuilt
|
|
|
|
if [ $PLATFORM_SHORT == "win" ]; then
|
2021-01-03 03:13:55 -06:00
|
|
|
other_flags+=$'\t-Db_vscrt=static_from_buildtype'
|
2019-12-17 08:03:41 -06:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ $PLATFORM_SHORT == "lin" ]; then
|
|
|
|
# We use gcc on lin; sadly, gcc + lto + libstdc++ + pthread = undefined reference to
|
|
|
|
# pthread_create, thanks to weak symbols in libstdc++.so (or something). See
|
|
|
|
# https://gcc.gnu.org/legacy-ml/gcc-help/2017-03/msg00081.html
|
|
|
|
other_flags+=$'\t-Db_asneeded=false\t-Dcpp_link_args=-Wl,--no-as-needed'
|
2021-01-21 12:08:27 -06:00
|
|
|
if [ $STATIC_DYNAMIC == "static" ]; then
|
|
|
|
other_flags+=$'\t-Dbuild_render=true\t-Dbuild_font=true'
|
|
|
|
fi
|
2019-12-17 08:03:41 -06:00
|
|
|
fi
|
|
|
|
if [ $PLATFORM_SHORT == "win" ]; then
|
2021-01-21 12:08:27 -06:00
|
|
|
bin_suffix=$bin_suffix.exe
|
2019-12-17 08:03:41 -06:00
|
|
|
fi
|
2020-12-15 15:02:56 -06:00
|
|
|
if echo $RELTYPECFG | base64 -d | grep snapshot; then
|
2021-04-04 15:09:16 -05:00
|
|
|
other_flags+=$'\t-Dsnapshot=true\t-Dsnapshot_id='
|
|
|
|
other_flags+=`echo $RELNAME | cut -d '-' -f 2`
|
|
|
|
fi
|
|
|
|
if echo $RELTYPECFG | base64 -d | grep snapshot || [ "$MOD_ID" != "0" ]; then
|
2020-12-15 15:02:56 -06:00
|
|
|
other_flags+=$'\t-Dupdate_server=starcatcher.us/TPT'
|
|
|
|
fi
|
2021-01-21 12:08:27 -06:00
|
|
|
meson -Dbuildtype=release -Db_pie=false -Db_staticpic=false -Db_lto=true $static_flag -Dinstall_check=true $other_flags `echo $RELTYPECFG | base64 -d` build
|
2019-12-17 08:03:41 -06:00
|
|
|
cd build
|
|
|
|
ninja
|
2020-12-15 15:02:56 -06:00
|
|
|
if [ $PLATFORM_SHORT == "lin" ] || [ $PLATFORM_SHORT == "mac" ]; then
|
2021-01-21 12:08:27 -06:00
|
|
|
strip powder$bin_suffix
|
2020-12-15 15:02:56 -06:00
|
|
|
fi
|
2021-01-21 12:08:27 -06:00
|
|
|
cp powder$bin_suffix ..
|