updated build script, security fix in OS X build (new libpng)
[divverent/nexuiz.git] / misc / makebuild.sh
1 #!/bin/sh
2 set -ex
3
4 base=`pwd`
5
6 basepk3=$base/data20060614.pk3
7 nexdir=$base/nexuiz
8 dpdir=$base/darkplaces
9 tmpdir=/tmp/NEX
10 zipdir=/home/polzer/UT/distfiles/nex/
11 mingwdlls=$base/buildfiles/w32
12 osxapps=$base/buildfiles/osx
13 fteqcc="fteqcc.bin -O2"
14 mingw=/home/polzer/mingw32
15 ia32=/chroot/fc4-i386
16 osxhost=macmini_osx
17 osxtemp=/Users/rpolzer/Darkplaces.build
18
19 if [ -n "$1" ]; then
20         osxhost=macmini
21 fi
22
23 : ${date:=`date +%Y%m%d`}
24 echo "date stamp: $date"
25
26 buildosx()
27 {
28         rsync --exclude "*.o" --exclude "*.d" --exclude "nexuiz-*" --delete-excluded --delete -zvaSHP . "$osxhost:$osxtemp"
29         ssh "$osxhost" ". ~/.profile && cd $osxtemp && make CC=\"gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk\" clean $*"
30         rsync --exclude "*.o" --exclude "*.d" --delete-excluded --delete -zvaSHP "$osxhost:$osxtemp/." .
31 }
32
33 build64()
34 {
35         make "$@"
36 }
37
38 build32()
39 {
40         make CC="gcc -I$ia32/usr/include -I$ia32/usr/X11R6/include -L$ia32/usr/lib -L$ia32/usr/X11R6/lib -m32" DP_MACHINE=i686 "$@"
41 }
42
43 buildwin()
44 {
45         PATH=$mingw/bin:$PATH make DP_MAKE_TARGET=mingw "$@"
46 }
47
48 rm -rf "$tmpdir"
49 mkdir -p "$tmpdir"
50 cd "$dpdir"
51
52 cp -r "$osxapps"/*.app "$tmpdir"
53 rm -f *.exe nexuiz-*
54
55 make clean
56 buildosx sdl-nexuiz cl-nexuiz sv-nexuiz
57 cp nexuiz-agl "$tmpdir/Nexuiz.app/Contents/MacOS/nexuiz-osx-ppc-agl-bin"
58 cp nexuiz-dedicated "$tmpdir/nexuiz-osx-ppc-dedicated"
59 cp nexuiz-sdl "$tmpdir/Nexuiz-SDL.app/Contents/MacOS/nexuiz-osx-ppc-sdl-bin"
60
61 make clean
62 buildwin nexuiz
63 for x in -dedicated -sdl ''; do
64         cp nexuiz$x.exe "$tmpdir/nexuiz$x.exe"
65 done
66
67 make clean
68 build32 nexuiz
69 for x in dedicated sdl glx; do
70         cp nexuiz-$x "$tmpdir/nexuiz-linux-686-$x"
71 done
72
73 make clean
74 build64 nexuiz
75 for x in dedicated sdl glx; do
76         cp nexuiz-$x "$tmpdir/nexuiz-linux-x86_64-$x"
77 done
78
79 cp "$nexdir/nexuiz-linux-sdl.sh" "$tmpdir/"
80 cp "$nexdir/nexuiz-linux-glx.sh" "$tmpdir/"
81 cp "$nexdir/gpl.txt" "$tmpdir/"
82
83 make clean
84 rm -f *.exe nexuiz-*
85
86 cd "$nexdir/data"
87 svn export . "$tmpdir/data"
88
89 cd "$nexdir/Docs"
90 svn export . "$tmpdir/Docs"
91
92 cd "$tmpdir/data"
93 mkdir -p "$tmpdir/sources"
94 #zip -9r ../sources/gamesource$date.zip qcsrc
95 7za a -mx=9 -tzip ../sources/gamesource$date.zip qcsrc
96
97 cd "$dpdir/.."
98 #zip -9r "$tmpdir/sources/enginesource$date.zip" "${dpdir##*/}"
99 7za a -mx=9 -tzip "$tmpdir/sources/enginesource$date.zip" "${dpdir##*/}"
100
101 cd "$tmpdir/data/qcsrc/menu"
102 $fteqcc
103
104 cd "$tmpdir/data/qcsrc/server"
105 $fteqcc
106
107 rm -rf "$tmpdir/data/qcsrc"
108
109 cd "$tmpdir/data"
110 mv common-spog.pk3 ..
111 #zip -9r ../data.pk3 .
112 7za a -mx=7 -tzip ../data.pk3 .
113
114 cd "$tmpdir"
115 rm -rf data
116 mkdir data
117 mv data.pk3 data/data$date.pk3
118 mv common-spog.pk3 data/
119
120 cp -r "$mingwdlls"/* .
121 # fix up permissions
122 chmod 644 *.dll *.exe
123
124 mkdir Nexuiz
125 mv * Nexuiz/ || true
126
127 find . -name .svn -exec rm -rf {} \; -prune
128
129 rm -f "$zipdir/nexuiz$date$ext.zip"
130 zip -9yr "$zipdir/nexuiz$date$ext.zip"           Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/data/data$date.pk3 Nexuiz/data/common-spog.pk3
131 rm -f "$zipdir/nexuizengineonly$date$ext.zip"
132 zip -9yr "$zipdir/nexuizengineonly$date$ext.zip" Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll
133 rm -f "$zipdir/nexuizsource$date$ext.zip"
134 zip -9yr "$zipdir/nexuizsource$date$ext.zip"     Nexuiz/gpl.txt                                            Nexuiz/sources
135
136 zipdiff -o Nexuiz/data/datapatch$date.pk3 -f "$basepk3" -t Nexuiz/data/data$date.pk3
137 rm -f "$zipdir/nexuizpatch$date$ext.zip"
138 zip -9yr "$zipdir/nexuizpatch$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/data/datapatch$date.pk3