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