]> icculus.org git repositories - divverent/nexuiz.git/blob - misc/makebuild.sh
changed configs using r_hdr to use r_bloom instead for performance
[divverent/nexuiz.git] / misc / makebuild.sh
1 #!/bin/bash
2
3 set -e
4
5 base=`pwd`
6
7
8 case "$pw" in
9         '')
10                 zipflags=
11                 ;;
12         *)
13                 zipflags="-P $pw"
14                 ;;
15 esac
16
17 : ${date:=`date +%Y%m%d`}
18 : ${versiontag:=}
19 echo "date stamp: $date"
20
21 case "$version" in
22         '')
23                 version=2-svntest-$date
24                 versiontag=test
25                 defaultcfg=
26                 ext=
27                 ;;
28         *)
29                 version=$version
30                 versiontag=$versiontag
31                 defaultcfg=
32                 ext=_$version
33                 ;;
34 esac
35
36 basepk3=$base/data20070531.pk3
37 nexdir=$base/nexuiz-2.0
38 nexprodir=$base/nexuiz-current/pro
39 dpdir=$base/darkplaces
40 tmpdir=/tmp/NEX
41 zipdir=/home/polzer/public_html/nexuiz/builds
42 buildfiles=$base/nexuiz-current/misc/buildfiles
43 mingwdlls=$buildfiles/w32
44 osxapps=$buildfiles/osx
45 copystrip=$buildfiles/copystrip
46 zipdiff=$base/nexuiz-current/misc/zipdiff
47 fteqccdir="$base/fteqcc"
48 fteqccflags=""
49 mingw=/home/polzer/mingw32
50 menuqc=menu
51 newest=NEWEST
52 tag=
53
54 if [ -n "$EXPERIMENTAL" ]; then
55         basepk3=$base/data20071231.pk3 # newer build to make smaller patches
56         nexdir=$base/nexuiz-current
57         fteqccflags="$fteqccflags -DMAPINFO"
58         ext="${ext}_svntrunk"
59         menuqc="menu"
60         newest=NEWEST-svntrunk
61         tag=trunk
62 fi
63
64 # TODO normalize the builds
65 platforms='x86 amd64 osx'
66 buildon()
67 {
68         host=$1
69         prefix=$2
70         fteqccname=$3
71         path=$4
72         makeflags=$5
73         strip=$6
74
75         fteqcc_cflags=
76         case "$fteqccname" in
77                 *.exe)
78                         fteqcc_cflags=win
79                         ;;
80         esac
81
82         rm -f "$fteqccdir"/*.o
83         rm -f "$fteqccdir"/*.bin
84         rsync --exclude "*.o" --exclude "*.d" --exclude "nexuiz-*" --delete-excluded --delete -zvaSHP . "$copystrip" "$fteqccdir" "$host:$path"
85         ssh "$host" ". ~/.profile && cd $path && COPYSTRIP_STRIP=$strip PATH=$path/copystrip:\$PATH make $makeflags clean nexuiz && cd ${fteqccdir##*/} && make $makeflags $fteqcc_cflags"
86         rsync --exclude "*.o" --exclude "*.d" --delete-excluded --delete -zvaSHP "$host:$path/." .
87         for P in -dedicated -sdl -glx -wgl -agl -dedicated.exe -sdl.exe .exe; do
88                 [ -f nexuiz$P ] && mv nexuiz$P "$tmpdir/$prefix$P"
89                 [ -f nexuiz$P-withdebug ] && mv nexuiz$P-withdebug "$tmpdir/debuginfo/$prefix$P"
90         done
91         case "$fteqccname" in
92                 *.exe)
93                         mv "${fteqccdir##*/}"/fteqcc.exe "$tmpdir/fteqcc/$fteqccname"
94                         ;;
95                 *)
96                         mv "${fteqccdir##*/}"/fteqcc.bin "$tmpdir/fteqcc/$fteqccname"
97                         ;;
98         esac
99         make clean
100 }
101
102 build()
103 {
104         buildon macmini nexuiz-osx          fteqcc-osx          /tmp/Darkplaces.build 'CC="gcc -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -I/Library/Frameworks/SDL.framework/Headers"' strip
105                 mv "$tmpdir/nexuiz-osx-agl"     "$tmpdir/Nexuiz.app/Contents/MacOS/nexuiz-osx-agl-bin"
106                 mv "$tmpdir/nexuiz-osx-sdl"     "$tmpdir/Nexuiz-SDL.app/Contents/MacOS/nexuiz-osx-sdl-bin"
107         buildon hagger  nexuiz-linux-686    fteqcc-linux-686    /tmp/Darkplaces.build 'CC="gcc -g" DP_MODPLUG_STATIC_LIBDIR=/usr/local/lib'
108         buildon hector  nexuiz-linux-x86_64 fteqcc-linux-x86_64 /tmp/Darkplaces.build 'CC="gcc -g" DP_MODPLUG_STATIC_LIBDIR=/home/users4/ommz/polzer/libmodplug-static/lib64'
109         buildon hagger  nexuiz              fteqcc.exe          /tmp/Darkplaces.build 'DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -I/home/polzer/mingw32.include" WINDRES=i586-mingw32msvc-windres SDL_CONFIG=/home/polzer/mingw32.SDL/bin/sdl-config' i586-mingw32msvc-strip
110 }
111
112 i=
113 while [ -f "$zipdir/nexuiz$date$i$ext.zip" ]; do
114         if [ -z "$i" ]; then
115                 i=a
116         else
117                 i=`echo "$i" | tr a-y b-z`
118         fi
119 done
120 ext=$i$ext
121
122 echo "Using build name nexuiz$date$ext"
123 sleep 3
124
125 if [ -n "$1" ]; then
126         osxhost="$1"
127 fi
128
129 conflicts=`find "$dpdir" "$nexdir" -name '*.orig' -o -name '*.rej' -o -name '*.mine' -o -name '.#*' -o -name '.*~'`
130 if [ -n "$conflicts" ]; then
131         echo "CONFLICTS OR UNNEEDED FILES HAVE BEEN FOUND!"
132         echo "NOT PROCEEDING"
133         echo
134         echo "$conflicts"
135         exit 1
136 fi
137
138 set -x
139
140 rm -rf "$tmpdir"
141 mkdir -p "$tmpdir"
142
143 cd "$dpdir"
144 quilt pop -a || true
145 svn revert -R .
146 quilt push -a # apply all patches
147
148 cp -r "$osxapps"/*.app "$tmpdir"
149 mkdir "$tmpdir/debuginfo"
150 mkdir "$tmpdir/fteqcc"
151
152 svn export "$fteqccdir" "$tmpdir/fteqcc/source"
153 svn info "$fteqccdir" > "$tmpdir/fteqcc/source/fteqcc-base-revision.txt"
154 fteqccrev=$((`grep "Last Changed Rev:" "$tmpdir/fteqcc/source/fteqcc-base-revision.txt" | cut -d : -f 2`))
155 echo "fteqcc rev $fteqccrev"
156
157 rm -f *.exe nexuiz-* *-withdebug* *.o
158 make clean
159 build
160 rm -f *.exe nexuiz-* *-withdebug '.#'* *.o
161 rm -rf fteqcc copystrip
162 make clean
163
164 cd "$tmpdir"
165 cp "$nexdir/"nexuiz-*.sh "$tmpdir/"
166 cp "$nexdir/"nexuiz-*.bat "$tmpdir/"
167 cp "$nexdir/gpl.txt" "$tmpdir/"
168
169 cd "$nexdir/data"
170 svn export . "$tmpdir/data"
171
172 cd "$nexprodir"
173 svn export . "$tmpdir/pro"
174
175 cd "$nexdir/Docs"
176 svn export . "$tmpdir/Docs"
177
178 cd "$tmpdir/data"
179 mkdir -p "$tmpdir/sources"
180 #zip -9r ../sources/gamesource$date.zip qcsrc
181 7za a -mx=9 -tzip ../sources/gamesource$date.zip qcsrc
182
183 cd "$dpdir"
184 svn export . "$tmpdir/darkplaces"
185 svn info > "$tmpdir/darkplaces/nexuiz-base-revision.txt"
186 svn diff > "$tmpdir/darkplaces/nexuiz-engine-changes.diff"
187 svn log > "$tmpdir/darkplaces/ChangeLog"
188
189 cd "$tmpdir"
190 7za a -mx=9 -tzip "$tmpdir/sources/enginesource$date.zip" "darkplaces"
191 rm -rf darkplaces
192
193 cd "$tmpdir"
194 zip -9r "$tmpdir/sources/fteqcc-binaries-and-source-rev$fteqccrev.zip" "fteqcc"
195 rm -rf fteqcc
196
197 cd "$fteqccdir"
198 rm -f *.o *.bin
199 make
200
201 cd "$tmpdir/data/qcsrc/$menuqc"
202 "$fteqccdir/fteqcc.bin" $fteqccflags
203
204 cd "$tmpdir/data/qcsrc/server"
205 "$fteqccdir/fteqcc.bin" $fteqccflags
206
207 rm -rf "$tmpdir/data/qcsrc"
208
209 cd "$tmpdir/Docs"
210 perl -pi -e '/^#---SET nexversion=([0-9.]*)$/ and $_ = "#---SET nexversion='$version'\n"' FAQ.aft
211 perl -pi -e '/^\s*Version ([0-9.]*)<\/div>$/ and $_ = "Version '$version'</div>\n"' Readme.htm
212 cp "$dpdir/darkplaces.txt" .
213 aft FAQ.aft
214 aft FAQ.aft
215 rm FAQ.aft-TOC
216
217 cd "$tmpdir/data"
218 mv common-spog.pk3 ..
219 perl -pi -e '/^set g_nexuizversion "?([0-9.]*)[^"]*"?/ and $_ = "set g_nexuizversion '$version'\n"' default.cfg
220 if [ -n "$versiontag" ]; then
221         perl -pi -e '/^set g_nexuizversion/ and $_ = "showbrand 3\n$_"' default.cfg
222         cp "$buildfiles/brand/$versiontag.tga" gfx/brand.tga
223 fi
224 echo >> default.cfg
225 echo "$defaultcfg" >> default.cfg
226 7za a -mx=7 -tzip ../data.pk3 .
227
228 cd "$tmpdir/pro"
229 perl -pi -e '/^set g_nexuizversion "?([0-9.]*)[^"]*"?/ and $_ = "set g_nexuizversion '$version-pro'\n"' default.cfg
230 if [ -n "$versiontag" ]; then
231         perl -pi -e '/^set g_nexuizversion/ and $_ = "showbrand 3\n$_"' default.cfg
232 fi
233 echo >> default.cfg
234 echo "$defaultcfg" >> default.cfg
235 7za a -mx=7 -tzip ../pro.pk3 .
236
237 cd "$tmpdir"
238 rm -rf data
239 mkdir data
240 mv data.pk3 data/data$tag$date.pk3
241 mv common-spog.pk3 data/
242 rm -rf pro
243 mkdir pro
244 mv pro.pk3 pro/data$tag${date}pro.pk3
245
246 cp -r "$mingwdlls"/* .
247 # fix up permissions
248 chmod 644 *.dll *.exe
249
250 mkdir Nexuiz
251 mv * Nexuiz/ || true
252
253 find . -name .svn -exec rm -rf {} \; -prune
254
255 rm -f "$zipdir/nexuiz$date$ext.zip"
256 zip $zipflags -9yr "$zipdir/nexuiz$date$ext.zip"           Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/data/data$tag$date.pk3 Nexuiz/data/common-spog.pk3 Nexuiz/pro/*
257 ln -snf nexuiz$date$ext.zip "$zipdir/nexuiz-$newest.zip"
258
259 rm -f "$zipdir/nexuizengineonly$date$ext.zip"
260 zip $zipflags -9yr "$zipdir/nexuizengineonly$date$ext.zip" Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll
261 ln -snf nexuizengineonly$date$ext.zip "$zipdir/nexuizengineonly-$newest.zip"
262
263 rm -f "$zipdir/nexuizsource$date$ext.zip"
264 zip $zipflags -9yr "$zipdir/nexuizsource$date$ext.zip"     Nexuiz/gpl.txt                                            Nexuiz/sources
265 ln -snf nexuizsource$date$ext.zip "$zipdir/nexuizsource-$newest.zip"
266
267 $zipdiff -o "Nexuiz/data/datapatch$tag$date.pk3" -f "$basepk3" -t Nexuiz/data/data$tag$date.pk3 -x 'sound/cdtracks/track*.ogg'
268 mkdir -p gfx
269 if unzip "Nexuiz/data/data$tag$date.pk3" gfx/brand.tga; then
270         zip $zipflags -9r "Nexuiz/data/datapatch$tag$date.pk3" gfx/brand.tga
271         rm -rf gfx
272 fi
273
274 rm -f "$zipdir/nexuizpatch$date$ext.zip"
275 zip $zipflags -9yr "$zipdir/nexuizpatch$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/data/datapatch$tag$date.pk3 Nexuiz/pro/*
276 ln -snf nexuizpatch$date$ext.zip "$zipdir/nexuizpatch-$newest.zip"
277
278 rm -f "$zipdir/nexuizdocs$date$ext.zip"
279 zip $zipflags -9yr "$zipdir/nexuizdocs$date$ext.zip"       Nexuiz/gpl.txt Nexuiz/Docs
280 ln -snf nexuizdocs$date$ext.zip "$zipdir/nexuizdocs-$newest.zip"
281
282 rm -f "$zipdir/nexuizdebug$date$ext.zip"
283 zip $zipflags -9yr "$zipdir/nexuizdebug$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/debuginfo/* Nexuiz/sources
284 ln -snf nexuizdebug$date$ext.zip "$zipdir/nexuizdebug-$newest.zip"