Travis changes for Xonotic:
[xonotic/darkplaces.git] / .travis-script-xonotic.sh
1 #!/bin/sh
2
3 set -e
4
5 openssl aes-256-cbc -K $encrypted_eeb6f7a14a8e_key -iv $encrypted_eeb6f7a14a8e_iv -in .travis-id_rsa-xonotic -out id_rsa-xonotic -d
6
7 set -x
8
9 chmod 0600 id_rsa-xonotic
10 # ssh-keygen -y -f id_rsa-xonotic
11
12 export USRLOCAL="$PWD"/usrlocal
13
14 rev=`git rev-parse HEAD`
15
16 sftp -oStrictHostKeyChecking=no -i id_rsa-xonotic -P 2222 -b - autobuild-bin-uploader@beta.xonotic.org <<EOF || true
17 mkdir ${rev}
18 EOF
19
20 for os in "$@"; do
21
22   deps=".deps/${os}"
23   case "${os}" in
24     linux32)
25       chroot=
26       makeflags='STRIP=:
27         CC="${CC} -m32 -march=i686 -g1 -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6"
28         SDL_CONFIG=$USRLOCAL/bin/sdl2-config
29         DP_LINK_CRYPTO=shared
30           LIB_CRYPTO="../../../${deps}/lib/libd0_blind_id.a ../../../${deps}/lib/libgmp.a"
31         DP_LINK_CRYPTO_RIJNDAEL=dlopen
32         DP_LINK_JPEG=shared
33           LIB_JPEG=../../../${deps}/lib/libjpeg.a
34         DP_LINK_ODE=shared
35           CFLAGS_ODE="-DUSEODE -DLINK_TO_LIBODE -DdDOUBLE"
36           LIB_ODE="../../../${deps}/lib/libode.a -lstdc++"
37         DP_LINK_ZLIB=shared'
38       maketargets='release'
39       outputs='darkplaces-glx:darkplaces-linux32-glx darkplaces-sdl:darkplaces-linux32-sdl darkplaces-dedicated:darkplaces-linux32-dedicated'
40       ;;
41     linux64)
42       chroot=
43       makeflags='STRIP=:
44         CC="${CC} -m64 -g1 -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6"
45         SDL_CONFIG=$USRLOCAL/bin/sdl2-config
46         DP_LINK_CRYPTO=shared
47           LIB_CRYPTO="../../../${deps}/lib/libd0_blind_id.a ../../../${deps}/lib/libgmp.a"
48         DP_LINK_CRYPTO_RIJNDAEL=dlopen
49         DP_LINK_JPEG=shared
50           LIB_JPEG="../../../${deps}/lib/libjpeg.a"
51         DP_LINK_ODE=shared
52           CFLAGS_ODE="-DUSEODE -DLINK_TO_LIBODE -DdDOUBLE"
53           LIB_ODE="../../../${deps}/lib/libode.a -lstdc++"
54         DP_LINK_ZLIB=shared'
55       maketargets='release'
56       outputs='darkplaces-glx:darkplaces-linux64-glx darkplaces-sdl:darkplaces-linux64-sdl darkplaces-dedicated:darkplaces-linux64-dedicated'
57       ;;
58     win32)
59       # other Win32 DLLs - including SDL2 - retain 16 bytes alignment.
60       export LD_LIBRARY_PATH="$USRLOCAL/opt/cross_toolchain_32/x86_64-slackware-linux/i686-w64-mingw32/lib:$USRLOCAL/opt/cross_toolchain_32/libexec/gcc/i686-w64-mingw32/4.8.3"
61       chroot=
62       # Need to use -mstackrealign as nothing guarantees that callbacks from
63       makeflags='STRIP=:
64         D3D=1
65         DP_MAKE_TARGET=mingw
66         UNAME=MINGW32
67         WIN32RELEASE=1
68         CC="$USRLOCAL/opt/cross_toolchain_32/bin/i686-w64-mingw32-gcc -static -g1 -mstackrealign -Wl,--dynamicbase -Wl,--nxcompat -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6"
69         WINDRES="$USRLOCAL/opt/cross_toolchain_32/bin/i686-w64-mingw32-windres"
70         SDL_CONFIG="../../../${deps}/bin/sdl2-config"
71         DP_LINK_CRYPTO=dlopen
72         DP_LINK_CRYPTO_RIJNDAEL=dlopen
73         DP_LINK_JPEG=dlopen
74         DP_LINK_ODE=dlopen
75         DP_LINK_ZLIB=dlopen'
76       maketargets='release'
77       outputs='darkplaces.exe:darkplaces-x86-wgl.exe darkplaces-sdl.exe:darkplaces-x86.exe darkplaces-dedicated.exe:darkplaces-x86-dedicated.exe'
78       ;;
79     win64)
80       export LD_LIBRARY_PATH="$USRLOCAL/opt/cross_toolchain_64/x86_64-slackware-linux/x86_64-w64-mingw32/lib:$USRLOCAL/opt/cross_toolchain_64/libexec/gcc/x86_64-w64-mingw32/4.8.3"
81       chroot=
82       makeflags='STRIP=:
83         D3D=1
84         DP_MAKE_TARGET=mingw
85         UNAME=MINGW32
86         WIN64RELEASE=1
87         CC="$USRLOCAL/opt/cross_toolchain_64/bin/x86_64-w64-mingw32-gcc -static -g1 -Wl,--dynamicbase -Wl,--nxcompat -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6"
88         WINDRES="$USRLOCAL/opt/cross_toolchain_64/bin/x86_64-w64-mingw32-windres"
89         SDL_CONFIG="../../../${deps}/bin/sdl2-config"
90         DP_LINK_CRYPTO=dlopen
91         DP_LINK_CRYPTO_RIJNDAEL=dlopen
92         DP_LINK_JPEG=dlopen
93         DP_LINK_ODE=dlopen
94         DP_LINK_ZLIB=dlopen'
95       maketargets='release'
96       outputs='darkplaces.exe:darkplaces-wgl.exe darkplaces-sdl.exe:darkplaces.exe darkplaces-dedicated.exe:darkplaces-dedicated.exe'
97       ;;
98     osx)
99       chroot=
100       makeflags='STRIP=:
101         CC="gcc -g1 -arch x86_64 -mmacosx-version-min=10.5 -Wl,-rpath -Wl,@loader_path/../Frameworks -Wl,-rpath -Wl,@loader_path -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6"
102         SDLCONFIG_MACOSXCFLAGS="-I${PWD}/SDL2.framework/Headers"
103         SDLCONFIG_MACOSXLIBS="-F${PWD} -framework SDL2 -framework Cocoa -I${PWD}/SDL2.framework/Headers"
104         SDLCONFIG_MACOSXSTATICLIBS="-F${PWD} -framework SDL2 -framework Cocoa -I${PWD}/SDL2.framework/Headers"
105         DP_LINK_CRYPTO=dlopen
106         DP_LINK_CRYPTO_RIJNDAEL=dlopen
107         DP_LINK_JPEG=dlopen
108         DP_LINK_ODE=dlopen
109         DP_LINK_ZLIB=shared'
110       maketargets='sv-release sdl-release'
111       outputs='darkplaces-sdl:darkplaces-osx-sdl-bin darkplaces-dedicated:darkplaces-osx-dedicated'
112       ;;
113   esac
114
115   # Condense whitespace in makeflags.
116   makeflags=$(
117     printf "%s\n" "$makeflags" | tr '\n' ' '
118   )
119
120   (
121     trap "${chroot} make -C ${PWD} ${makeflags} clean" EXIT
122     eval "${chroot} make -C ${PWD} ${makeflags} ${maketargets}"
123     for o in $outputs; do
124       src=${o%%:*}
125       dst=${o#*:}
126       sftp -oStrictHostKeyChecking=no -i id_rsa-xonotic -P 2222 -b - autobuild-bin-uploader@beta.xonotic.org <<EOF
127 put ${src} ${rev}/${dst}
128 EOF
129     done
130   )
131
132 done