use docker for 32bit build

This commit is contained in:
Michał Janiszewski 2015-09-27 10:43:52 +02:00
parent a16de307d7
commit ec1366dd29
6 changed files with 161 additions and 106 deletions

View File

@ -23,6 +23,8 @@ env:
- OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
- OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
- OPENRCT2_CMAKE_OPTS="-DDISABLE_HTTP_TWITCH=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
- TARGET=docker32
- OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON" TARGET=docker32
sudo: required

View File

@ -5,20 +5,24 @@ set -e
cachedir=.cache
mkdir -p $cachedir
# Sets default target to "linux", if none specified
TARGET=${TARGET-linux}
if [[ ! -d build ]]; then
mkdir -p build
fi
libversion=2
# keep in sync with version in install.sh
libversion=3
libVFile="./libversion"
libdir="./lib"
currentversion=0
needsdownload="true"
if [ -f $libVFile ]; then
while read line; do
currentversion=$line
continue
if [ -f $libVFile ]; then
while read line; do
currentversion=$line
continue
done < $libVFile
fi
@ -27,40 +31,40 @@ if [ $currentversion -ge $libversion ]; then
fi
if [ ! -d $libdir ]; then
needsdownload="true"
needsdownload="true"
fi
if [[ "$needsdownload" = "true" ]]; then
echo "New libraries need to be downloaded, the script might ask you for sudo access password"
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
curl https://dl.dropboxusercontent.com/u/1323345/orctlibs.zip -o $cachedir/orctlibs.zip
mkdir -p $cachedir/orctlibs
pushd $cachedir/orctlibs
unzip -uaq ../orctlibs.zip
popd
sudo mkdir -p /usr/local/cross-tools/orctlibs
mkdir -p lib
sudo cp -rf $cachedir/orctlibs/glob/* /usr/local/cross-tools/orctlibs/.
cp -rf $cachedir/orctlibs/local/* ./lib/.
echo $libversion > $libVFile
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
echo $libversion > $libVFile
fi
pushd build
echo OPENRCT2_CMAKE_OPTS = $OPENRCT2_CMAKE_OPTS
cmake -DCMAKE_BUILD_TYPE=Debug $OPENRCT2_CMAKE_OPTS ..
make
if [[ $TARGET == "docker32" ]]
then
PARENT=`readlink -f ../`
chmod a+rwx `pwd`
chmod g+s `pwd`
docker run -u travis -v $PARENT:/work/openrct2 -w /work/openrct2/build -i -t janisozaur/openrct2:32bit-only bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && make"
else
cmake -DCMAKE_BUILD_TYPE=Debug $OPENRCT2_CMAKE_OPTS ..
make
fi
popd
if [[ ! -h openrct2.dll ]]; then
if [[ ! -h openrct2.dll ]]; then
ln -s build/openrct2.dll openrct2.dll
fi
@ -74,4 +78,3 @@ if [[ -t 1 ]]; then
else
echo -e "\nDone! Run OpenRCT2 by typing:\n\nwine openrct2.exe\n"
fi

View File

@ -0,0 +1,29 @@
FROM nfnty/arch-mini
RUN pacman -Syyu --noconfirm
RUN pacman -S --noconfirm git curl jshon expac yajl wget unzip cmake
RUN pacman -S --noconfirm --needed base-devel
RUN useradd -mg root travis
RUN usermod -aG wheel travis
RUN sed -i 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers
WORKDIR /tmp
USER travis
RUN curl -sLO https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=package-query
RUN mv PKGBUILD?h=package-query PKGBUILD
RUN makepkg
USER root
RUN pacman --noconfirm -U *.pkg.tar.xz
USER travis
RUN curl -sLO https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yaourt
RUN mv PKGBUILD?h=yaourt PKGBUILD
RUN makepkg
USER root
RUN pacman --noconfirm -U *.pkg.tar.xz
RUN pacman -R --noconfirm gcc
RUN yes | pacman -S gcc-libs-multilib
RUN pacman -S --noconfirm gcc-multilib
USER travis
RUN yaourt -S --noconfirm lib32-jansson lib32-curl lib32-sdl2 lib32-sdl2_ttf lib32-speex

View File

@ -10,6 +10,85 @@ echo `uname`
# Sets default target to "linux", if none specified
TARGET=${TARGET-linux}
# keep in sync with version in build.sh
libversion=3
libVFile="./libversion"
function download_sdl {
if [[ ! -f $cachedir/SDL2-devel-${SDL2_PV}-mingw.tar.gz ]]; then
wget http://libsdl.org/release/SDL2-devel-${SDL2_PV}-mingw.tar.gz --output-document $cachedir/SDL2-devel-${SDL2_PV}-mingw.tar.gz;
fi
if [[ ! -f $cachedir/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz ]]; then
wget https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz --output-document $cachedir/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz;
fi
if [[ ! -d $cachedir/SDL2-${SDL2_PV} ]]; then
pushd $cachedir
tar -xzf SDL2-devel-${SDL2_PV}-mingw.tar.gz
popd
fi
if [[ ! -d $cachedir/SDL2_ttf-${SDL2_TTF_PV} ]]; then
pushd $cachedir
tar -xzf SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz
popd
fi
# Apply platform patch
mingw_patch=libsdl2-mingw-2.0.3-fix-platform-detection-for-mingw.patch
if [[ ! -f $cachedir/$mingw_patch ]]; then
wget "https://github.com/anyc/anyc-overlay/raw/master/media-libs/libsdl2-mingw/files/$mingw_patch" --output-document $cachedir/$mingw_patch;
# XXX not sure how to make this idempotent.
pushd $cachedir/SDL2-${SDL2_PV}/i686-w64-mingw32/include/SDL2/
echo "Applying patch."
patch -p2 < ../../../../$mingw_patch
popd
fi
}
function download_libs {
if [[ ! -f $cachedir/orctlibs.zip ]]; then
curl https://dl.dropboxusercontent.com/u/1323345/orctlibs.zip -o $cachedir/orctlibs.zip;
fi
if [[ ! -d $cachedir/orctlibs ]]; then
mkdir -p $cachedir/orctlibs
pushd $cachedir/orctlibs
unzip -uaq ../orctlibs.zip
popd
fi
}
function install_cross_tools {
if [[ ! -d /usr/local/cross-tools ]]; then
sudo mkdir -p /usr/local/cross-tools
fi
if [[ ! -d /usr/local/cross-tools/i686-w64-mingw32 ]]; then
sudo cp -r $cachedir/SDL2-${SDL2_PV}/i686-w64-mingw32 /usr/local/cross-tools/
sudo cp -r $cachedir/SDL2_ttf-${SDL2_TTF_PV}/i686-w64-mingw32 /usr/local/cross-tools/
fi
if [[ ! -d /usr/local/cross-tools/orctlibs ]]; then
sudo mkdir -p /usr/local/cross-tools/orctlibs
sudo cp -rf $cachedir/orctlibs/glob/* /usr/local/cross-tools/orctlibs/.
fi
}
function install_pkg_config {
if [[ ! -f $cachedir/i686-w64-mingw32-pkg-config ]]; then
# If this fails to work because of newlines, be sure you are running this
# script with Bash, and not sh. We should really move this to a separate
# file.
echo -e "#!/bin/sh\nexport PKG_CONFIG_PATH=/usr/local/cross-tools/i686-w64-mingw32/lib/pkgconfig:/usr/local/cross-tools/orctlibs/lib/pkgconfig\npkg-config \$@" > $cachedir/i686-w64-mingw32-pkg-config;
fi
chmod +x $cachedir/i686-w64-mingw32-pkg-config
sudo cp $cachedir/i686-w64-mingw32-pkg-config /usr/local/bin/
ls -al /usr/local/bin | grep pkg-config
cat /usr/local/bin/i686-w64-mingw32-pkg-config
}
function install_local_libs {
mkdir -p lib
cp -rf $cachedir/orctlibs/local/* ./lib/.
}
echo TARGET = $TARGET
@ -79,18 +158,18 @@ if [[ `uname` == "Darwin" ]]; then
popd
fi
elif [[ `uname` == "Linux" ]]; then
if [[ ! -z "$TRAVIS" ]]; then
sudo dpkg --add-architecture i386
fi
sudo apt-get update
if [[ -z "$TRAVIS" ]]; then
sudo apt-get install -y binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 cmake
if [[ -z "$DISABLE_G2_BUILD" ]]; then
sudo apt-get install -y wine
fi
else
# prevent build.sh from re-doing all the steps again
echo $libversion > $libVFile
case "$TARGET" in
"linux")
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --force-yes cmake libsdl2-dev:i386 libsdl2-ttf-dev:i386 gcc-4.8 pkg-config:i386 g++-4.8-multilib gcc-4.8-multilib libjansson-dev:i386 libspeex-dev:i386 libspeexdsp-dev:i386 libcurl4-openssl-dev:i386 libcrypto++-dev:i386
wget https://launchpad.net/ubuntu/+archive/primary/+files/libjansson4_2.7-1ubuntu1_i386.deb
wget https://launchpad.net/ubuntu/+archive/primary/+files/libjansson-dev_2.7-1ubuntu1_i386.deb
@ -101,8 +180,12 @@ elif [[ `uname` == "Linux" ]]; then
export CXX=g++-4.8
;;
"windows")
sudo apt-get update
sudo apt-get install -y --force-yes binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 cmake
;;
"docker32")
docker pull janisozaur/openrct2:32bit-only
;;
*)
echo "unkown target $TARGET"
exit 1
@ -110,75 +193,13 @@ elif [[ `uname` == "Linux" ]]; then
fi
fi
download_libs
# Local libs are required for all targets
install_local_libs
if [[ $TARGET == "windows" ]]; then
if [[ ! -f $cachedir/SDL2-devel-${SDL2_PV}-mingw.tar.gz ]]; then
wget http://libsdl.org/release/SDL2-devel-${SDL2_PV}-mingw.tar.gz --output-document $cachedir/SDL2-devel-${SDL2_PV}-mingw.tar.gz;
fi
if [[ ! -f $cachedir/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz ]]; then
wget https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz --output-document $cachedir/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz;
fi
if [[ ! -d $cachedir/SDL2-${SDL2_PV} ]]; then
pushd $cachedir
tar -xzf SDL2-devel-${SDL2_PV}-mingw.tar.gz
popd
fi
if [[ ! -d $cachedir/SDL2_ttf-${SDL2_TTF_PV} ]]; then
pushd $cachedir
tar -xzf SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz
popd
fi
if [[ ! -f $cachedir/orctlibs.zip ]]; then
curl https://dl.dropboxusercontent.com/u/1323345/orctlibs.zip -o $cachedir/orctlibs.zip;
fi
if [[ ! -d $cachedir/orctlibs ]]; then
mkdir -p $cachedir/orctlibs
pushd $cachedir/orctlibs
unzip -uaq ../orctlibs.zip
ls -lR .
popd
fi
# Apply platform patch
mingw_patch=libsdl2-mingw-2.0.3-fix-platform-detection-for-mingw.patch
if [[ ! -f $cachedir/$mingw_patch ]]; then
wget "https://github.com/anyc/anyc-overlay/raw/master/media-libs/libsdl2-mingw/files/$mingw_patch" --output-document $cachedir/$mingw_patch;
# XXX not sure how to make this idempotent.
pushd $cachedir/SDL2-${SDL2_PV}/i686-w64-mingw32/include/SDL2/
echo "Applying patch."
patch -p2 < ../../../../$mingw_patch
popd
fi
if [[ ! -d /usr/local/cross-tools ]]; then
sudo mkdir -p /usr/local/cross-tools
fi
if [[ ! -d /usr/local/cross-tools/i686-w64-mingw32 ]]; then
sudo cp -r $cachedir/SDL2-${SDL2_PV}/i686-w64-mingw32 /usr/local/cross-tools/
sudo cp -r $cachedir/SDL2_ttf-${SDL2_TTF_PV}/i686-w64-mingw32 /usr/local/cross-tools/
fi
if [[ ! -d /usr/local/cross-tools/orctlibs ]]; then
sudo mkdir -p /usr/local/cross-tools/orctlibs
mkdir -p lib
sudo cp -rf $cachedir/orctlibs/glob/* /usr/local/cross-tools/orctlibs/.
cp -rf $cachedir/orctlibs/local/* ./lib/.
fi
if [[ ! -f $cachedir/i686-w64-mingw32-pkg-config ]]; then
# If this fails to work because of newlines, be sure you are running this
# script with Bash, and not sh. We should really move this to a separate
# file.
echo -e "#!/bin/sh\nexport PKG_CONFIG_PATH=/usr/local/cross-tools/i686-w64-mingw32/lib/pkgconfig:/usr/local/cross-tools/orctlibs/lib/pkgconfig\npkg-config \$@" > $cachedir/i686-w64-mingw32-pkg-config;
for i in /usr/local/cross-tools/orctlibs/lib/pkgconfig/*.pc
do
cat $i
done
fi
chmod +x $cachedir/i686-w64-mingw32-pkg-config
sudo cp $cachedir/i686-w64-mingw32-pkg-config /usr/local/bin/
ls -al /usr/local/bin | grep pkg-config
cat /usr/local/bin/i686-w64-mingw32-pkg-config
download_sdl
install_cross_tools
install_pkg_config
# $TARGET == "windows"
fi

View File

@ -1,5 +1,5 @@
#init
$libversion = 2
$libversion = 3
$path = Split-Path $Script:MyInvocation.MyCommand.Path
$zip = $path+'\orctlibs.zip'
$libs = $path+'\lib'