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