OpenRCT2/scripts/build
Margen67 3188865313
Script improvements (#14452)
shebang:
 Move parameters from set.
 Add newline after for consistency.
curl:
 Add -f;
  Prevents output on error.
 Use -O where applicable;
  -o with the same filename as the URL is pointless.
 Add -S after -s:
  Makes curl still error despite being silent.
build-symbols:
 Add zip fallback.
get-discord-rpc:
 Move git clone parameters before repository for readability.
 Use --depth 1 to speed up cloning.
install-nsis:
 Use ProgramData environment variable.
build-appimage-docker.sh:
 Add -e to docker run.
 Run script directly.
build-appimage.sh:
 Make if more consistent.
Remove unused Travis scripts.
setenv:
 unset instead of blanking variables.
vstool.cmd:
 Use ProgramFiles(x86) environment variable.
2021-04-12 19:01:15 -03:00

42 lines
1.4 KiB
Bash
Executable file

#!/bin/bash -e
# Ensure we are in root directory
if [[ $(uname) == "Darwin" ]]; then
basedir="$(perl -MCwd=abs_path -le 'print abs_path readlink(shift);' `dirname $0`/..)"
else
basedir="$(readlink -f `dirname $0`/..)"
fi
cd $basedir
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
# Patch version.h
if [[ "$OPENRCT2_BUILD" != "" ]]; then
echo -e "\033[0;36mPatching version.h...\033[0m"
fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD
productversion="$fileversion-${OPENRCT2_SHA1_SHORT}"
fileversion=${fileversion//./,}
echo "#define OPENRCT2_FILE_VERSION $fileversion" > "resources/version.h"
echo "#define OPENRCT2_PRODUCT_VERSION \"$productversion\"" >> "resources/version.h"
cat "resources/version.h"
fi
# Build everything
echo -e "\033[0;36mBuilding OpenRCT2 for Windows $CONFIGURATION|$PLATFORM...\033[0m"
vstool msbuild openrct2.proj //t:build
# Create openrct2.exe and openrct2.com with correct subsystem
cp bin/openrct2.exe bin/openrct2.com
vstool editbin //subsystem:console bin/openrct2.com
vstool editbin //subsystem:windows bin/openrct2.exe
else
echo -e "\033[0;36mBuilding OpenRCT2...\033[0m"
mkdir -p bin && cd bin
export DESTDIR=install
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/usr "$@"
if [[ "$TESTPAINT" == "true" ]]; then
testpaint_target=testpaint
fi
ninja -k0 $testpaint_target all install
fi