travis: initial support

This commit is contained in:
Alibek Omarov 2018-11-18 18:33:32 +03:00
parent d74743ac1d
commit f0297fc448
7 changed files with 138 additions and 0 deletions

42
.travis.yml Normal file
View File

@ -0,0 +1,42 @@
language: c
cache: ccache
compiler: gcc
sudo: false
addons:
apt:
packages:
- mingw-w64-i686-dev
- binutils-mingw-w64-i686
- gcc-mingw-w64-i686
- g++-mingw-w64-i686
- p7zip-full
- gcc-multilib
- g++-multilib
- libx11-dev:i386
- libxext-dev:i386
- x11-utils
- libgl1-mesa-dev
- libasound-dev
- zlib1g:i386
- libstdc++6:i386
env:
global:
- SDL_VERSION=2.0.8
git:
depth: 50
submodules: true
jdk:
- oraclejdk8
os:
- linux
- osx
# - windows
before_script:
- sh scripts/travis_common_deps.sh
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export ANDROID_HOME=$PWD/android-sdk-linux; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:$PWD/android-ndk; fi
script:
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
# - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh scripts/build_android_engine.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh scripts/build_mingw_engine.sh; fi

35
scripts/build_linux_engine.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# Build custom SDL2
cd $TRAVIS_BUILD_DIR/SDL2-2.0.7
export CC="ccache gcc -msse2 -march=i686 -m32 -ggdb -O2"
./configure \
--disable-dependency-tracking \
--disable-render \
--disable-haptic \
--disable-power \
--disable-filesystem \
--disable-file \
--enable-alsa-shared \
--enable-pulseaudio-shared \
--enable-wayland-shared \
--enable-x11-shared \
--disable-libudev \
--disable-dbus \
--disable-ibus \
--disable-ime \
--disable-fcitx
make -j2
mkdir -p $TRAVIS_BUILD_DIR/SDL2_linux
make install DESTDIR=$TRAVIS_BUILD_DIR/SDL2_linux
# Build engine
cd $TRAVIS_BUILD_DIR
export CC="ccache gcc"
export CXX="ccache g++"
./waf configure --sdl2=$TRAVIS_BUILD_DIR/SDL2_linux --vgui=$TRAVIS_BUILD_DIR/vgui-dev --build-type=debug
./waf build -j2
# cp engine/xash3d mainui/libxashmenu.so vgui_support/libvgui_support.so vgui_support/vgui.so ../scripts/xash3d.sh .
# cp $TRAVIS_BUILD_DIR/sdl2-linux/usr/local/lib/$(readlink $TRAVIS_BUILD_DIR/sdl2-linux/usr/local/lib/libSDL2-2.0.so.0) libSDL2-2.0.so.0
# 7z a -t7z $TRAVIS_BUILD_DIR/xash3d-linux.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on xash3d libSDL2-2.0.so.0 libvgui_support.so vgui.so libxashmenu.so xash3d.sh

15
scripts/build_mingw_engine.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Build engine
cd $TRAVIS_BUILD_DIR
mkdir -p mingw-build && cd mingw-build
export CC="ccache i686-w64-mingw32-gcc"
export CXX="ccache i686-w64-mingw32-g++"
export CFLAGS="-static-libgcc -no-pthread"
export CXXFLAGS="-static-libgcc -static-libstdc++"
./waf configure --sdl2=$TRAVIS_BUILD_DIR/SDL2_mingw --no-vgui --build-type=debug # can't use VGUI on MinGW
./waf build -j2
# cp SDL2/SDL2-2.0.7/i686-w64-mingw32/bin/SDL2.dll . # Install SDL2
# cp /usr/i686-w64-mingw32/lib/libwinpthread-1.dll . # a1ba: remove when travis will be updated to xenial
# 7z a -t7z $TRAVIS_BUILD_DIR/xash3d-mingw.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on xash_sdl.exe menu.dll SDL2.dll vgui_support.dll libwinpthread-1.dll

14
scripts/build_osx_engine.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Build engine
cd $TRAVIS_BUILD_DIR
mkdir -p osx-build && cd osx-build
export CFLAGS="-m32"
export CXXFLAGS="-m32"
./waf configure --sdl2=~/Library/Frameworks/SDL2.framework/ --vgui=$TRAVIS_BUILD_DIR/vgui-dev --build-type=debug
./waf build -j2
# mkdir -p pkg/
# cp engine/libxash.dylib game_launch/xash3d mainui/libxashmenu.dylib vgui_support/libvgui_support.dylib VGUI/vgui-dev-master/lib/vgui.dylib ../scripts/xash3d.sh # pkg/
# cp ~/Library/Frameworks/SDL2.framework/SDL2 pkg/libSDL2.dylib
# tar -cjf $TRAVIS_BUILD_DIR/xash3d-osx.tar.bz2 pkg/*

2
scripts/travis_common_deps.sh Executable file
View File

@ -0,0 +1,2 @@
git clone --depth 1 https://github.com/FWGS/vgui-dev
git clone --depth 1 https://github.com/FWGS/vgui_support_bin

25
scripts/travis_linux_deps.sh Executable file
View File

@ -0,0 +1,25 @@
# SDL2 sources. We will build our own version
curl -s http://libsdl.org/release/SDL2-$SDL_VERSION.tar.gz | tar xzf -
mv SDL2-$SDL_VERSION SDL2_src
# SDL2 for MinGW prebuilt
curl -s http://libsdl.org/release/SDL2-devel-$SDL_VERSION-mingw.tar.gz | tar xzf -
mv SDL2-$SDL_VERSION SDL2_mingw
# Android build deps
# curl -s http://dl.google.com/android/android-sdk_r22.0.4-linux.tgz | tar xzf -
# export ANDROID_HOME=$PWD/android-sdk-linux
# export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:$PWD/android-ndk
# sleep 3s; echo y | android update sdk -u --filter platform-tools,build-tools-19.0.0,android-19 --force --all > /dev/null
# wget http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin >/dev/null 2>/dev/null
# 7z x ./android-ndk-r10e-linux-x86_64.bin > /dev/null
# mv android-ndk-r10e android-ndk
# git clone --depth 1 https://github.com/FWGS/xash3d-android-project
# cd $TRAVIS_BUILD_DIR/xash3d-android-project
# cp debug.keystore ~/.android/debug.keystore
# git submodule update --init jni/src/NanoGL/nanogl xash-extras
# git clone --depth 1 https://github.com/FWGS/hlsdk-xash3d jni/src/hlsdk-xash3d
# rm -r jni/src/Xash3D/xash3d
# ln -s $TRAVIS_BUILD_DIR jni/src/Xash3D/xash3d
cd $TRAVIS_BUILD_DIR

5
scripts/travis_osx_deps.sh Executable file
View File

@ -0,0 +1,5 @@
curl -s https://www.libsdl.org/release/SDL2-$SDL_VERSION.dmg > SDL2.dmg
hdiutil attach SDL2.dmg
cd /Volumes/SDL2
mkdir -p ~/Library/Frameworks
cp -r SDL2.framework ~/Library/Frameworks/