]> icculus.org git repositories - divverent/nexuiz.git/blob - misc/tools/makebuild.sh
netradiant r222
[divverent/nexuiz.git] / misc / tools / makebuild.sh
1 #!/bin/bash
2
3 set -e
4
5 # Options:
6 #   pw=foo          extract password
7 #   version=2.5     make a FINAL build
8 #   tag=FOO         insert FOO before the date in build names
9
10 base=`pwd`
11
12 # customizable specific stuff
13 netradiant_release=1.5.0-svn222
14 basepk3=$base/data20080229.pk3 # 2.4
15 hotbasepk3= # hotfix
16 nexdir=$base/nexuiz
17 havocdir=$base/nexuiz/havoc
18 dpdir=$base/darkplaces
19 tmpdir=/tmp/NEX
20 zipdir=$base/builds
21 buildfiles=$base/nexuiz/misc/buildfiles
22 mingwdlls=$buildfiles/w32
23 osxapps=$buildfiles/osx
24 copystrip=$buildfiles/copystrip
25 zipdiff=$base/nexuiz/misc/tools/zipdiff
26 fteqccdir="$base/fteqcc"
27 fteqccflags=""
28 menuqc=menu
29 newest=NEWEST
30 aft="perl -I/chroot/debian-etch/usr/share/aft /chroot/debian-etch/usr/bin/aft"
31 # end system specific stuff
32
33 case "$pw" in
34         '')
35                 zipflags=
36                 ;;
37         *)
38                 zipflags="-P $pw"
39                 ;;
40 esac
41
42 : ${date:=`date +%Y%m%d`}
43 : ${versiontag:=}
44 echo "date stamp: $date"
45
46 case "$version" in
47         '')
48                 version=2-svntest-$date
49                 versiontag=test
50                 defaultcfg=
51                 ext=
52                 ;;
53         *)
54                 version=$version
55                 versiontag=$versiontag
56                 defaultcfg=
57                 ext=_$version
58                 ;;
59 esac
60
61 mk7z()
62 {
63         7za a -tzip -mx=9 "$@"
64         chmod 644 "$1"
65 }
66
67 #if [ -n "$EXPERIMENTAL" ]; then
68 #       basepk3=$base/data20071231.pk3 # newer build to make smaller patches
69 #       nexdir=$base/nexuiz
70 #fi
71
72 # TODO normalize the builds
73 platforms='x86 amd64 osx'
74 buildon()
75 {
76         host=$1
77         prefix=$2
78         fteqccname=$3
79         path=$4
80         makeflags=$5
81         strip=$6
82
83         fteqcc_cflags=
84         case "$fteqccname" in
85                 *.exe)
86                         fteqcc_cflags=win
87                         ;;
88         esac
89
90         rm -f "$fteqccdir"/*.o
91         rm -f "$fteqccdir"/*.bin
92         rsync --exclude "*.o" --exclude "*.d" --exclude "nexuiz-*" --delete-excluded --delete -zvaSHP . "$copystrip" "$fteqccdir" "$host:$path"
93         ssh "$host" ". ~/.profile && cd $path && COPYSTRIP_STRIP=$strip PATH=$path/copystrip:\$PATH make $makeflags clean nexuiz && cd ${fteqccdir##*/} && make $makeflags $fteqcc_cflags"
94         rsync --exclude "*.o" --exclude "*.d" --delete-excluded --delete -zvaSHP "$host:$path/." .
95         for P in -dedicated -sdl -glx -wgl -agl -dedicated.exe -sdl.exe .exe; do
96                 [ -f nexuiz$P ] && mv nexuiz$P "$tmpdir/$prefix$P"
97                 [ -f nexuiz$P-withdebug ] && mv nexuiz$P-withdebug "$tmpdir/debuginfo/$prefix$P"
98         done
99         case "$fteqccname" in
100                 *.exe)
101                         mv "${fteqccdir##*/}"/fteqcc.exe "$tmpdir/fteqcc/$fteqccname"
102                         ;;
103                 *)
104                         mv "${fteqccdir##*/}"/fteqcc.bin "$tmpdir/fteqcc/$fteqccname"
105                         ;;
106         esac
107         make clean
108 }
109
110 build()
111 {
112         buildon nexmacbuild                           nexuiz-osx          fteqcc-osx          /tmp/Darkplaces.build 'CC="gcc -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4"' strip
113         buildon eos.thruhere.net                      nexuiz-linux-686    fteqcc-linux-686    /tmp/Darkplaces.build 'CC="gcc -g" DP_MODPLUG_STATIC_LIBDIR=/home/divverent/modplug-i386/lib' strip
114         buildon alientrap.org                         nexuiz-linux-x86_64 fteqcc-linux-x86_64 /tmp/Darkplaces.build 'CC="gcc -g -Wl,--hash-style=sysv" DP_MODPLUG_STATIC_LIBDIR=/home/divverent/modplug-x86_64/lib' strip
115         buildon alientrap.org                         nexuiz              fteqcc.exe          /tmp/Darkplaces.build 'DP_MAKE_TARGET=mingw CC="/chroot/debian-etch/usr/bin/i586-mingw32msvc-gcc -g -DSUPPORTDIRECTX -I/home/divverent/dxheaders" WINDRES=/chroot/debian-etch/usr/bin/i586-mingw32msvc-windres SDL_CONFIG=/home/divverent/sdl-win32/SDL-1.2.13/bin/sdl-config' /chroot/debian-etch/usr/bin/i586-mingw32msvc-strip
116                 mv "$tmpdir/nexuiz-osx-agl"     "$tmpdir/Nexuiz.app/Contents/MacOS/nexuiz-osx-agl-bin"
117                 mv "$tmpdir/nexuiz-osx-sdl"     "$tmpdir/Nexuiz-SDL.app/Contents/MacOS/nexuiz-osx-sdl-bin"
118 }
119
120 # avoid dupes
121 i=
122 while [ -f "$zipdir/nexuiz$date$i$ext.zip" ]; do
123         if [ -z "$i" ]; then
124                 i=a
125         else
126                 i=`echo "$i" | tr a-y b-z`
127         fi
128 done
129 ext=$i$ext
130
131 echo "Using build name nexuiz$date$ext"
132 sleep 3
133
134 # check for remains
135 conflicts=`find "$dpdir" "$nexdir" -name '*.orig' -o -name '*.rej' -o -name '*.mine' -o -name '.#*' -o -name '.*~'`
136 if [ -n "$conflicts" ]; then
137         echo "CONFLICTS OR UNNEEDED FILES HAVE BEEN FOUND!"
138         echo "NOT PROCEEDING"
139         echo
140         echo "$conflicts"
141         exit 1
142 fi
143
144 set -x
145
146 # prepare temp dir
147 rm -rf "$tmpdir"
148 mkdir -p "$tmpdir"
149
150 # clean up and patch DP
151 cd "$dpdir"
152 quilt pop -a || true
153 svn revert -R .
154 if [ -s patches/series ]; then
155         quilt push -a # apply all patches
156 fi
157
158 # prepare directory structure
159 cp -r "$osxapps"/*.app "$tmpdir"
160 mkdir "$tmpdir/debuginfo"
161 mkdir "$tmpdir/fteqcc"
162
163 # prepare fteqcc build
164 svn export "$fteqccdir" "$tmpdir/fteqcc/source"
165 svn info "$fteqccdir" > "$tmpdir/fteqcc/source/fteqcc-base-revision.txt"
166 fteqccrev=$((`grep "Last Changed Rev:" "$tmpdir/fteqcc/source/fteqcc-base-revision.txt" | cut -d : -f 2`))
167 echo "fteqcc rev $fteqccrev"
168
169 # build all executables
170 rm -f *.exe nexuiz-* *-withdebug* *.o
171 make clean
172 build
173 rm -f *.exe nexuiz-* *-withdebug '.#'* *.o
174 rm -rf fteqcc copystrip
175 make clean
176
177 # move shell scripts and license
178 cd "$tmpdir"
179 cp "$nexdir/"nexuiz-*.sh "$tmpdir/"
180 cp "$nexdir/gpl.txt" "$tmpdir/"
181
182 # prepare data
183 cd "$nexdir/data"
184 svn export . "$tmpdir/data"
185 svn info . > "$tmpdir/data/nexuiz-data-base-revision.txt"
186 svn log > "$tmpdir/data/ChangeLog"
187
188 # prepare havoc
189 cd "$havocdir"
190 svn export . "$tmpdir/havoc"
191
192 # prepare Docs
193 cd "$nexdir/Docs"
194 svn export . "$tmpdir/Docs"
195
196 # prepare server
197 cd "$nexdir/server"
198 svn export . "$tmpdir/server"
199
200 # make gamesource
201 cd "$tmpdir/data"
202 mkdir -p "$tmpdir/sources"
203 mk7z ../sources/gamesource$date.zip qcsrc nexuiz-data-base-revision.txt ChangeLog
204
205 # make enginesource
206 cd "$dpdir"
207 svn export . "$tmpdir/darkplaces"
208 svn info > "$tmpdir/darkplaces/nexuiz-base-revision.txt"
209 svn diff > "$tmpdir/darkplaces/nexuiz-engine-changes.diff"
210 svn log > "$tmpdir/darkplaces/ChangeLog"
211 cd "$tmpdir"
212 mk7z "$tmpdir/sources/enginesource$date.zip" "darkplaces"
213 rm -rf darkplaces
214
215 # make fteqcc archive
216 cd "$tmpdir"
217 zip -9r "$tmpdir/sources/fteqcc-binaries-and-source-rev$fteqccrev.zip" "fteqcc"
218 rm -rf fteqcc
219
220 # clean fteqcc dir
221 cd "$fteqccdir"
222 rm -f *.o *.bin
223 make
224
225 # make local compiler
226 cd "$tmpdir/data"
227 make FTEQCC="$fteqccdir/fteqcc.bin"
228
229 # prepare root
230 rm -rf "$tmpdir/data/qcsrc"
231 cd "$tmpdir/Docs"
232 cp "$dpdir/darkplaces.txt" .
233 cd "$tmpdir/data"
234 mv common-spog.pk3 ..
235 perl -pi -e '/^set g_nexuizversion "?([0-9.]*)[^"]*"?/ and $_ = "set g_nexuizversion '$version'\n"' defaultNexuiz.cfg
236 if [ -z "$versiontag" ]; then
237         perl -pi -e 'm|^//!<showbrand| .. m|^//!>showbrand| and $_ = "";' defaultNexuiz.cfg
238         rm -f gfx/brand.tga
239 fi
240 echo >> defaultNexuiz.cfg
241 echo "$defaultcfg" >> defaultNexuiz.cfg
242 mk7z ../data.pk3 .
243 cd "$tmpdir/havoc"
244 mk7z ../havoc.pk3 .
245
246 # make data pk3
247 cd "$tmpdir"
248 rm -rf data
249 mkdir data
250 mv data.pk3 data/data$tag$date.pk3
251 mv common-spog.pk3 data/
252 rm -rf havoc
253 mkdir havoc
254 mv havoc.pk3 havoc/data$tag${date}havoc.pk3
255
256 cp -r "$mingwdlls"/* .
257 # fix up permissions
258 chmod 644 *.dll *.exe
259
260 mkdir extra
261 cd extra
262 wget http://www.icculus.org/netradiant/files/netradiant-${netradiant_release}-win32.zip
263 unzip netradiant-${netradiant_release}-win32.zip
264 mv NetRadiant netradiant-${netradiant_release}-win32
265 rm -f netradiant-${netradiant_release}-win32.zip
266 wget http://www.icculus.org/netradiant/files/netradiant-${netradiant_release}-osxintel.zip
267 unzip netradiant-${netradiant_release}-osxintel.zip
268 mv NetRadiant.app NetRadiant-${netradiant_release}-osxintel.app
269 rm -f netradiant-${netradiant_release}-osxintel.zip
270 cat >> unsupported.txt <<EOF
271 This directory contains NetRadiant, a stabilized Q3 map editor,\r
272 configured for Nexuiz.\r
273 \r
274 It is not officially supported by Alientrap.\r
275 \r
276 Website: http://www.icculus.org/netradiant/\r
277 EOF
278 cd ..
279
280 # make main structure
281 mkdir Nexuiz
282 mv * Nexuiz/ || true
283
284 find . -name .svn -exec rm -rf {} \; -prune
285
286 rm -f "$zipdir/nexuiz$date$ext.zip"
287 zip $zipflags -9yr "$zipdir/nexuiz$date$ext.zip"           Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/server Nexuiz/data/data$tag$date.pk3 Nexuiz/data/common-spog.pk3 Nexuiz/havoc/* Nexuiz/extra/*
288 ln -snf nexuiz$date$ext.zip "$zipdir/nexuiz-$newest.zip"
289
290 rm -f "$zipdir/nexuizengineonly$date$ext.zip"
291 zip $zipflags -9yr "$zipdir/nexuizengineonly$date$ext.zip" Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll
292 ln -snf nexuizengineonly$date$ext.zip "$zipdir/nexuizengineonly-$newest.zip"
293
294 rm -f "$zipdir/nexuizsource$date$ext.zip"
295 zip $zipflags -9yr "$zipdir/nexuizsource$date$ext.zip"     Nexuiz/gpl.txt                                            Nexuiz/sources
296 ln -snf nexuizsource$date$ext.zip "$zipdir/nexuizsource-$newest.zip"
297
298 # TODO remove these excludes after the version after 2.4.2
299 $zipdiff -o "Nexuiz/data/datapatch$tag$date.pk3" -f "$basepk3" -t Nexuiz/data/data$tag$date.pk3 \
300         -x 'sound/cdtracks/track*.ogg' \
301         -x 'sound/cdtracks/brainsukker.ogg' \
302         -x 'sound/cdtracks/breakdown-easy.ogg' \
303         -x 'sound/cdtracks/calling-bogus.ogg' \
304         -x 'sound/cdtracks/chaos-fog.ogg' \
305         -x 'sound/cdtracks/digital-pursuit.ogg' \
306         -x 'sound/cdtracks/infight.ogg' \
307         -x 'sound/cdtracks/neuronal-diving.ogg' \
308         -x 'sound/cdtracks/subcities.ogg' \
309         -x 'sound/cdtracks/thru-the-mirror.ogg'
310 mkdir -p sound/cdtracks
311 ln -snf track001.ogg sound/cdtracks/digital-pursuit.ogg
312 ln -snf track002.ogg sound/cdtracks/breakdown-easy.ogg
313 ln -snf track003.ogg sound/cdtracks/brainsukker.ogg
314 ln -snf track004.ogg sound/cdtracks/chaos-fog.ogg
315 ln -snf track005.ogg sound/cdtracks/infight.ogg
316 ln -snf track006.ogg sound/cdtracks/neuronal-diving.ogg
317 ln -snf track007.ogg sound/cdtracks/subcities.ogg
318 ln -snf track008.ogg sound/cdtracks/thru-the-mirror.ogg
319 ln -snf track009.ogg sound/cdtracks/calling-bogus.ogg
320 zip -9yr "Nexuiz/data/datapatch$tag$date.pk3" sound/cdtracks/*
321 rm -rf sound
322 [ -n "$hotbasepk3" ] && $zipdiff -o "Nexuiz/data/datapatch$tag$date""hotfix.pk3" -f "$hotbasepk3" -t Nexuiz/data/data$tag$date.pk3
323 mkdir -p gfx
324 if unzip "Nexuiz/data/data$tag$date.pk3" gfx/brand.tga; then
325         zip -9r "Nexuiz/data/datapatch$tag$date.pk3" gfx/brand.tga
326         [ -n "$hotbasepk3" ] && zip -9r "Nexuiz/data/datapatch$tag$date""hotfix.pk3" gfx/brand.tga
327         rm -rf gfx
328 fi
329
330 rm -f "$zipdir/nexuizpatch$date$ext.zip"
331 zip $zipflags -9yr "$zipdir/nexuizpatch$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/server Nexuiz/data/datapatch$tag$date.pk3 Nexuiz/havoc/*
332 ln -snf nexuizpatch$date$ext.zip "$zipdir/nexuizpatch-$newest.zip"
333
334 [ -n "$hotbasepk3" ] && rm -f "$zipdir/nexuizhotfix$date$ext.zip"
335 [ -n "$hotbasepk3" ] && zip $zipflags -9yr "$zipdir/nexuizhotfix$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/server Nexuiz/data/datapatch$tag$date""hotfix.pk3 Nexuiz/havoc/*
336 [ -n "$hotbasepk3" ] && ln -snf nexuizhotfix$date$ext.zip "$zipdir/nexuizhotfix-$newest.zip"
337
338 rm -f "$zipdir/nexuizdocs$date$ext.zip"
339 zip $zipflags -9yr "$zipdir/nexuizdocs$date$ext.zip"       Nexuiz/gpl.txt Nexuiz/Docs
340 ln -snf nexuizdocs$date$ext.zip "$zipdir/nexuizdocs-$newest.zip"
341
342 rm -f "$zipdir/nexuizdebug$date$ext.zip"
343 zip $zipflags -9yr "$zipdir/nexuizdebug$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/debuginfo/* Nexuiz/sources
344 ln -snf nexuizdebug$date$ext.zip "$zipdir/nexuizdebug-$newest.zip"
345
346 case "$versiontag" in
347         test)
348                 ;;
349         *)
350                 cat <<'EOF'
351
352 NOTE: This is a RELEASE BUILD.
353
354 To upload and finish the build, these things have to be done:
355
356 - Test the build:
357   - On Linux/ATI
358   - On Vista/nvidia
359   - On Vista/ATI
360   - On Vista/Intel
361   - On OSX/ATI
362   - Turn on "developer 1"; watch out for suspicious messages.
363   - While testing, make sure all campaign levels are tested. In CTF/KH levels,
364     try to do a capture. After that, finish the game by prvm_edictset server 1
365     frags 1000.
366   - Play on a server running the new code. Ideally, that server should be public
367     and "somewhat compatible" to old clients, and some other players should be
368     on it.
369 - Post the build on the forum as a test release. E.g. run this script again
370   with the "version" variable NOT SET, so the build gets marked "testing only",
371   and upload it and post it on the forum for testing. Mention the test server
372   that is already running the new code. Wait for at least one week for critical
373   bug reports.
374 - If needed, fix the reported bugs and re-run this script for a release build.
375   Possibly repeat the testing process.
376 - Upload the "final" build you have just made to Sourceforge (upload.sf.net,
377   incoming). Use the naming scheme nexuiz-25.zip, nexuizpatch-24-to-25.zip
378 - Make the download available on sourceforge.
379 - Announce the build on the forum; update the downloads website. Note that the
380   download may be still unavailable because of the SF mirror system.
381 - Wait for the mirrors to catch up.
382 - Edit the website: make a new news item for the new release, change the logo
383   image in the top left for the new version (ask [-z-]).
384
385 EOF
386                 ;;
387 esac