Fix engine not starting on Windows if linked against SDL > 2.0.5
[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-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-sdl:darkplaces-linux64-sdl darkplaces-dedicated:darkplaces-linux64-dedicated'
57       ;;
58     win32)
59       chroot=
60       # Need to use -mstackrealign as nothing guarantees that callbacks from
61       # other Win32 DLLs - including SDL2 - retain 16 bytes alignment.
62       makeflags='STRIP=:
63         D3D=1
64         DP_MAKE_TARGET=mingw
65         UNAME=MINGW32
66         WIN32RELEASE=1
67         CC="i686-w64-mingw32-gcc -static -g1 -mstackrealign -Wl,--dynamicbase -Wl,--nxcompat -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6"
68         WINDRES="i686-w64-mingw32-windres"
69         SDL_CONFIG="../../../${deps}/bin/sdl2-config"
70         DP_LINK_CRYPTO=dlopen
71         DP_LINK_CRYPTO_RIJNDAEL=dlopen
72         DP_LINK_JPEG=dlopen
73         DP_LINK_ODE=dlopen
74         DP_LINK_ZLIB=dlopen'
75       maketargets='release'
76       outputs='darkplaces-sdl.exe:darkplaces-x86.exe darkplaces-dedicated.exe:darkplaces-x86-dedicated.exe'
77       ;;
78     win64)
79       chroot=
80       makeflags='STRIP=:
81         D3D=1
82         DP_MAKE_TARGET=mingw
83         UNAME=MINGW32
84         WIN64RELEASE=1
85         CC="x86_64-w64-mingw32-gcc -static -g1 -Wl,--dynamicbase -Wl,--nxcompat -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6"
86         WINDRES="x86_64-w64-mingw32-windres"
87         SDL_CONFIG="../../../${deps}/bin/sdl2-config"
88         DP_LINK_CRYPTO=dlopen
89         DP_LINK_CRYPTO_RIJNDAEL=dlopen
90         DP_LINK_JPEG=dlopen
91         DP_LINK_ODE=dlopen
92         DP_LINK_ZLIB=dlopen'
93       maketargets='release'
94       outputs='darkplaces-sdl.exe:darkplaces.exe darkplaces-dedicated.exe:darkplaces-dedicated.exe'
95       ;;
96     osx)
97       chroot=
98       makeflags='STRIP=:
99         CC="gcc -g1 -arch x86_64 -mmacosx-version-min=10.6 -Wl,-rpath -Wl,@loader_path/../Frameworks -Wl,-rpath -Wl,@loader_path -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6"
100         SDLCONFIG_MACOSXCFLAGS="-I${PWD}/SDL2.framework/Headers"
101         SDLCONFIG_MACOSXLIBS="-F${PWD} -framework SDL2 -framework Cocoa -I${PWD}/SDL2.framework/Headers"
102         SDLCONFIG_MACOSXSTATICLIBS="-F${PWD} -framework SDL2 -framework Cocoa -I${PWD}/SDL2.framework/Headers"
103         DP_LINK_CRYPTO=dlopen
104         DP_LINK_CRYPTO_RIJNDAEL=dlopen
105         DP_LINK_JPEG=dlopen
106         DP_LINK_ODE=dlopen
107         DP_LINK_ZLIB=shared'
108       maketargets='sv-release sdl-release'
109       outputs='darkplaces-sdl:darkplaces-osx-sdl-bin darkplaces-dedicated:darkplaces-osx-dedicated'
110       ;;
111   esac
112
113   # Condense whitespace in makeflags.
114   makeflags=$(
115     printf "%s\n" "$makeflags" | tr '\n' ' '
116   )
117
118   (
119     trap "${chroot} make -C ${PWD} ${makeflags} clean" EXIT
120     eval "${chroot} make -C ${PWD} ${makeflags} ${maketargets}"
121     for o in $outputs; do
122       src=${o%%:*}
123       dst=${o#*:}
124       sftp -oStrictHostKeyChecking=no -i id_rsa-xonotic -P 2222 -b - autobuild-bin-uploader@beta.xonotic.org <<EOF
125 put ${src} ${rev}/${dst}
126 EOF
127     done
128   )
129
130 done