2014-05-27 02:06:57 +09:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-10-21 17:08:16 +02:00
|
|
|
if [[ $TRAVIS != "true" ]]
|
|
|
|
then
|
|
|
|
echo This script is only meant to be run on Travis-CI.
|
|
|
|
echo Please use CMake to build the project.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-05-27 02:06:57 +09:00
|
|
|
cachedir=.cache
|
2015-12-19 22:46:52 -06:00
|
|
|
if [[ $(uname -s) == "Darwin" ]]; then
|
2018-02-05 00:19:22 +00:00
|
|
|
liburl=https://openrct2.io/files/orctlibs-osx.zip
|
2015-12-19 22:46:52 -06:00
|
|
|
else
|
2018-02-05 00:19:22 +00:00
|
|
|
liburl=https://openrct2.io/files/orctlibs.zip
|
2015-12-19 22:46:52 -06:00
|
|
|
fi
|
2015-11-30 08:31:31 +01:00
|
|
|
mkdir -p "$cachedir"
|
2014-05-27 02:06:57 +09:00
|
|
|
|
2016-12-15 17:55:17 +01:00
|
|
|
# Sets default target to "ubuntu_amd64", if none specified
|
|
|
|
TARGET=${TARGET-ubuntu_amd64}
|
2015-09-27 10:43:52 +02:00
|
|
|
|
2015-11-30 08:31:31 +01:00
|
|
|
function has_cmd {
|
|
|
|
command -v "$1" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
function calculate_sha256 {
|
|
|
|
if has_cmd "shasum"; then
|
|
|
|
command shasum -a 256 "$1" | cut -f1 -d" "
|
|
|
|
elif has_cmd "sha256sum"; then
|
|
|
|
command sha256sum "$1" | cut -f1 -d" "
|
|
|
|
else
|
|
|
|
echo "Please install either sha256sum or shasum to continue"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-10-07 17:23:03 -04:00
|
|
|
function download {
|
2015-11-30 08:31:31 +01:00
|
|
|
if has_cmd "curl"; then
|
2015-10-16 23:45:40 -04:00
|
|
|
curl -L -o "$2" "$1"
|
2015-11-30 08:31:31 +01:00
|
|
|
elif has_cmd "wget"; then
|
2015-10-16 23:45:40 -04:00
|
|
|
wget -O "$2" "$1"
|
2015-10-07 17:23:03 -04:00
|
|
|
else
|
|
|
|
echo "Please install either wget or curl to continue"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-09-27 10:43:52 +02:00
|
|
|
function download_libs {
|
|
|
|
if [[ ! -f $cachedir/orctlibs.zip ]]; then
|
2015-10-07 17:23:03 -04:00
|
|
|
download $liburl $cachedir/orctlibs.zip;
|
2015-09-27 10:43:52 +02:00
|
|
|
fi
|
|
|
|
if [[ ! -d $cachedir/orctlibs ]]; then
|
|
|
|
mkdir -p $cachedir/orctlibs
|
|
|
|
pushd $cachedir/orctlibs
|
|
|
|
unzip -uaq ../orctlibs.zip
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-06-13 19:49:06 +02:00
|
|
|
function mac_os_install_mingw_32 {
|
2015-11-30 08:31:31 +01:00
|
|
|
local mingw_name="mingw-w32-bin_i686-darwin"
|
|
|
|
local mingw_tar="${mingw_name}_20130531.tar.bz2"
|
|
|
|
local mingw_path="/usr/local/$mingw_name"
|
|
|
|
|
|
|
|
if [[ ! -f "$cachedir/$mingw_tar" ]]; then
|
|
|
|
download "https://downloads.sourceforge.net/project/mingw-w64/Toolchains targetting Win32/Automated Builds/$mingw_tar" "$cachedir/$mingw_tar"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -d "$mingw_path" ]]; then
|
|
|
|
echo "Extracting contents of $mingw_tar to $mingw_path"
|
|
|
|
echo "Don't forget to add $mingw_path/bin to your PATH variable!"
|
|
|
|
|
|
|
|
mkdir "$mingw_path"
|
|
|
|
tar -xyf "$cachedir/$mingw_tar" -C "$mingw_path"
|
|
|
|
|
|
|
|
pushd "$mingw_path"
|
|
|
|
find . -type d -exec chmod 755 {} \;
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "HOST = $(uname)"
|
|
|
|
echo "TARGET = $TARGET"
|
|
|
|
|
|
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
|
|
if ! has_cmd "brew"; then
|
|
|
|
echo "Homebrew is not installed, or brew is not in your \$PATH"
|
|
|
|
echo "install instructions: http://brew.sh/"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
brew install cmake
|
|
|
|
|
|
|
|
if [[ $TARGET == "windows" ]]; then
|
|
|
|
brew install wine
|
2016-06-13 19:49:06 +02:00
|
|
|
mac_os_install_mingw_32
|
2015-11-30 08:31:31 +01:00
|
|
|
else
|
2019-12-02 01:41:18 -05:00
|
|
|
brew install jansson sdl2 speex --universal
|
2015-11-30 08:31:31 +01:00
|
|
|
fi
|
2015-11-04 18:55:59 +09:00
|
|
|
elif [[ $(uname) == "Linux" ]]; then
|
2017-11-12 22:11:39 +01:00
|
|
|
# Clone discord-rpc for Discord's Rich Presence support
|
2018-04-17 20:35:36 +02:00
|
|
|
# Use tagged release to prevent upstream changes from breaking our code
|
2018-05-12 19:41:56 +02:00
|
|
|
git clone https://github.com/IntelOrca/discord-rpc -b fix/134-iothreadholder
|
2018-05-11 16:15:36 +02:00
|
|
|
# Use rapidjson with a hack for GCC 8, while awaiting a fix upstream:
|
|
|
|
# https://github.com/Tencent/rapidjson/issues/1205
|
|
|
|
git clone https://github.com/janisozaur/rapidjson discord-rpc/thirdparty/rapidjson -b patch-1
|
2017-04-16 08:50:44 +02:00
|
|
|
# prevent build.sh from re-doing all the steps again
|
|
|
|
case "$TARGET" in
|
|
|
|
"ubuntu_i686")
|
|
|
|
docker pull openrct2/openrct2:ubuntu_i686
|
|
|
|
;;
|
|
|
|
"ubuntu_amd64")
|
|
|
|
docker pull openrct2/openrct2:ubuntu_amd64
|
|
|
|
;;
|
|
|
|
"windows")
|
|
|
|
docker pull openrct2/openrct2:mingw-arch
|
|
|
|
;;
|
|
|
|
"docker64")
|
|
|
|
docker pull openrct2/openrct2:64bit-only
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unkown target $TARGET"
|
|
|
|
exit 1
|
|
|
|
esac
|
2014-05-27 02:06:57 +09:00
|
|
|
fi
|
|
|
|
|
2017-04-16 08:50:44 +02:00
|
|
|
if [[ $(uname -s) == "Darwin" ]]; then
|
2016-01-09 20:39:13 +01:00
|
|
|
download_libs
|
|
|
|
calculate_sha256 "$cachedir/orctlibs.zip" > "$libVFile"
|
|
|
|
echo "Downloaded library with sha256sum: $(cat "$libVFile")"
|
|
|
|
# Local libs are required for all targets
|
2017-04-16 08:50:44 +02:00
|
|
|
# $(uname -s) == "Darwin"
|
2015-09-24 22:47:14 +02:00
|
|
|
fi
|