OpenRCT2/build.sh

101 lines
2.3 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
set -e
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}
if [[ ! -d build ]]; then
mkdir -p build
fi
2015-09-27 10:43:52 +02:00
# keep in sync with version in install.sh
sha256sum=69ff98c9544838fb16384bc78af9dc1c452b9d01d919e43f5fec686d02c9bdd8
2015-07-05 23:39:35 +02:00
libVFile="./libversion"
libdir="./lib"
currentversion=0
needsdownload="true"
2015-09-27 10:43:52 +02:00
if [ -f $libVFile ]; then
while read line; do
currentversion=$line
continue
2015-07-05 23:39:35 +02:00
done < $libVFile
fi
2015-09-28 23:15:10 +02:00
if [ "z$currentversion" == "z$sha256sum" ]; then
2015-07-05 23:39:35 +02:00
needsdownload="false"
fi
if [ ! -d $libdir ]; then
2015-09-27 10:43:52 +02:00
needsdownload="true"
2015-07-05 23:39:35 +02:00
fi
2015-09-27 10:43:52 +02:00
2015-07-05 23:39:35 +02:00
if [[ "$needsdownload" = "true" ]]; then
2015-09-28 23:15:10 +02:00
echo "Found library had sha256sum $currentversion, expected $sha256sum"
2015-09-27 10:43:52 +02:00
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
./install.sh
2015-07-05 23:39:35 +02:00
fi
pushd build
echo OPENRCT2_CMAKE_OPTS = $OPENRCT2_CMAKE_OPTS
2015-09-27 10:43:52 +02:00
if [[ $TARGET == "docker32" ]]
then
PARENT=$(readlink -f ../)
chmod a+rwx $(pwd)
chmod g+s $(pwd)
2015-10-03 22:50:50 +02:00
docker run -u travis -v $PARENT:/work/openrct2 -w /work/openrct2/build -i -t openrct2/openrct2:32bit-only bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && make"
2015-09-27 10:43:52 +02:00
else
cmake -DCMAKE_BUILD_TYPE=Debug $OPENRCT2_CMAKE_OPTS ..
make
fi
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
fi
2015-06-04 23:02:38 +02:00
if [[ -z "$DISABLE_G2_BUILD" ]]; then
echo Building: data/g2.dat
./build_g2.sh > /dev/null 2>&1
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
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
fi