2014-05-26 19:06:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
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
|
|
|
|
|
2015-07-05 23:39:35 +02:00
|
|
|
cachedir=.cache
|
|
|
|
mkdir -p $cachedir
|
|
|
|
|
2015-09-27 10:43:52 +02:00
|
|
|
# Sets default target to "linux", if none specified
|
|
|
|
TARGET=${TARGET-linux}
|
2016-01-09 20:39:13 +01:00
|
|
|
SYSTEM=$(uname -s)
|
2015-09-27 10:43:52 +02:00
|
|
|
|
2014-05-26 19:06:57 +02:00
|
|
|
if [[ ! -d build ]]; then
|
|
|
|
mkdir -p build
|
|
|
|
fi
|
|
|
|
|
2016-01-09 20:39:13 +01:00
|
|
|
if [[ $TARGET != "linux" && $TARGET != "docker32" && $SYSTEM != "Darwin" ]]; then
|
2016-06-13 15:26:59 +02:00
|
|
|
sha256sum=f124c954bbd0b58c93e5fba46902806bd3637d3a1c5fb8e4b67441052f182df2
|
2016-01-09 20:39:13 +01:00
|
|
|
libVFile="./libversion"
|
|
|
|
libdir="./lib"
|
|
|
|
currentversion=0
|
|
|
|
needsdownload="true"
|
2015-07-05 23:39:35 +02:00
|
|
|
|
2016-01-09 20:39:13 +01:00
|
|
|
if [ -f $libVFile ]; then
|
|
|
|
while read line; do
|
|
|
|
currentversion=$line
|
|
|
|
continue
|
|
|
|
done < $libVFile
|
|
|
|
fi
|
2015-09-27 10:43:52 +02:00
|
|
|
|
2016-01-09 20:39:13 +01:00
|
|
|
if [ "z$currentversion" == "z$sha256sum" ]; then
|
|
|
|
needsdownload="false"
|
2015-09-27 10:43:52 +02:00
|
|
|
fi
|
2016-01-09 20:39:13 +01:00
|
|
|
|
|
|
|
if [ ! -d $libdir ]; then
|
|
|
|
needsdownload="true"
|
2015-09-27 10:43:52 +02:00
|
|
|
fi
|
2016-01-09 20:39:13 +01:00
|
|
|
|
|
|
|
if [[ "$needsdownload" = "true" ]]; then
|
|
|
|
echo "Found library had sha256sum $currentversion, expected $sha256sum"
|
|
|
|
echo "New libraries need to be downloaded. Clearing cache and calling ./install.sh"
|
|
|
|
rm -rf ./lib
|
|
|
|
if [[ -f $cachedir/orctlibs.zip ]]; then
|
|
|
|
rm -rf $cachedir/orctlibs.zip
|
|
|
|
fi
|
|
|
|
if [[ -d /usr/local/cross-tools/orctlibs ]]; then
|
|
|
|
sudo rm -rf /usr/local/cross-tools/orctlibs
|
|
|
|
fi
|
|
|
|
if [[ -d $cachedir/orctlibs ]]; then
|
|
|
|
rm -rf $cachedir/orctlibs
|
|
|
|
fi
|
|
|
|
scripts/linux/install.sh
|
2015-09-27 10:43:52 +02:00
|
|
|
fi
|
2016-01-09 20:39:13 +01:00
|
|
|
# if [[ $TARGET != "linux" && $TARGET != "docker32" && $SYSTEM != "Darwin" ]]; then
|
2015-07-05 23:39:35 +02:00
|
|
|
fi
|
|
|
|
|
2014-05-26 19:06:57 +02:00
|
|
|
pushd build
|
2015-09-24 22:47:14 +02:00
|
|
|
echo OPENRCT2_CMAKE_OPTS = $OPENRCT2_CMAKE_OPTS
|
2015-09-27 10:43:52 +02:00
|
|
|
if [[ $TARGET == "docker32" ]]
|
|
|
|
then
|
2015-11-04 10:55:59 +01:00
|
|
|
PARENT=$(readlink -f ../)
|
|
|
|
chmod a+rwx $(pwd)
|
|
|
|
chmod g+s $(pwd)
|
2015-12-30 01:11:25 +01:00
|
|
|
# CMAKE and MAKE opts from environment
|
2016-10-15 22:24:24 +02:00
|
|
|
docker run -u travis -v $PARENT:/work/openrct2 -w /work/openrct2/build -i -t openrct2/openrct2:32bit-only bash -c "cmake ../ -DFORCE32=on $OPENRCT2_CMAKE_OPTS && make $OPENRCT_MAKE_OPTS"
|
|
|
|
elif [[ $TARGET == "docker64" ]]
|
|
|
|
then
|
|
|
|
PARENT=$(readlink -f ../)
|
|
|
|
chmod a+rwx $(pwd)
|
|
|
|
chmod g+s $(pwd)
|
|
|
|
# CMAKE and MAKE opts from environment
|
|
|
|
docker run -v $PARENT:/work/openrct2 -w /work/openrct2/build -i -t openrct2/openrct2:64bit-only bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && make $OPENRCT_MAKE_OPTS"
|
2016-10-15 23:45:11 +02:00
|
|
|
elif [[ $TARGET == "linux" ]]
|
|
|
|
then
|
2016-10-17 21:30:01 +02:00
|
|
|
cmake $OPENRCT2_CMAKE_OPTS .. -DCMAKE_BUILD_TYPE=debug
|
2016-10-15 23:45:11 +02:00
|
|
|
# NOT the same variable as above
|
|
|
|
# this target also includes building & running of testpaint
|
|
|
|
make $OPENRCT2_MAKE_OPTS testpaint
|
2016-10-19 01:55:18 +02:00
|
|
|
./testpaint --quiet || if [[ $? -eq 1 ]] ; then echo Allowing failed tests to pass ; else false; fi
|
2015-09-27 10:43:52 +02:00
|
|
|
else
|
2016-01-17 16:51:28 +01:00
|
|
|
cmake $OPENRCT2_CMAKE_OPTS ..
|
2015-12-30 01:11:25 +01:00
|
|
|
# NOT the same variable as above
|
|
|
|
make $OPENRCT2_MAKE_OPTS
|
2015-09-27 10:43:52 +02:00
|
|
|
fi
|
2014-05-26 19:06:57 +02:00
|
|
|
popd
|
|
|
|
|
2015-10-02 17:44:18 +02:00
|
|
|
if [[ $TARGET == "windows" ]]; then
|
|
|
|
if [[ ! -h openrct2.dll ]]; then
|
|
|
|
ln -s build/openrct2.dll openrct2.dll
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -h build/data ]]; then
|
|
|
|
ln -s ../data build/data
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $TARGET == "linux" ]] || [[ $TARGET == "docker32" ]]; then
|
|
|
|
if [[ ! -h openrct2 ]]; then
|
|
|
|
ln -s build/openrct2 openrct2
|
|
|
|
fi
|
2015-07-03 09:54:35 +02:00
|
|
|
fi
|
|
|
|
|
2015-06-04 23:02:38 +02:00
|
|
|
if [[ -z "$DISABLE_G2_BUILD" ]]; then
|
2015-12-22 22:27:09 +01:00
|
|
|
echo Building: g2.dat
|
|
|
|
pushd build
|
|
|
|
make g2
|
|
|
|
popd
|
2015-06-04 23:02:38 +02:00
|
|
|
fi
|
2015-06-03 04:13:35 +02:00
|
|
|
|
2015-10-02 17:44:18 +02:00
|
|
|
if [[ $TARGET == "windows" ]]; then
|
|
|
|
if [[ -t 1 ]]; then
|
|
|
|
echo -e "\nDone! Run OpenRCT2 by typing:\n\n\033[95mwine openrct2.exe\n\033[0m"
|
|
|
|
else
|
|
|
|
echo -e "\nDone! Run OpenRCT2 by typing:\n\nwine openrct2.exe\n"
|
|
|
|
fi
|
2014-05-26 19:06:57 +02:00
|
|
|
else
|
2015-10-02 17:44:18 +02:00
|
|
|
if [[ -t 1 ]]; then
|
|
|
|
echo -e "\nDone! Run OpenRCT2 by typing:\n\n\033[95m./openrct2\n\033[0m"
|
|
|
|
else
|
|
|
|
echo -e "\nDone! Run OpenRCT2 by typing:\n\n./openrct2\n"
|
|
|
|
fi
|
2014-05-26 19:06:57 +02:00
|
|
|
fi
|