]> icculus.org git repositories - divverent/nexuiz.git/blob - misc/tools/makebuild.sh
here are the dylibs again
[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-svn389
14 basepk3=$base/data20090403.pk3 # 2.5
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.5s
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 nexmacbuild                           nexuiz-osx          fteqcc-osx          /tmp/Darkplaces.build 'CC="gcc -g -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4"' strip
114         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
115         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
116         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
117                 mv "$tmpdir/nexuiz-osx-agl"     "$tmpdir/Nexuiz.app/Contents/MacOS/nexuiz-osx-agl-bin"
118                 mv "$tmpdir/nexuiz-osx-sdl"     "$tmpdir/Nexuiz-SDL.app/Contents/MacOS/nexuiz-osx-sdl-bin"
119 }
120
121 # avoid dupes
122 i=
123 while [ -f "$zipdir/nexuiz$date$i$ext.zip" ]; do
124         if [ -z "$i" ]; then
125                 i=a
126         else
127                 i=`echo "$i" | tr a-y b-z`
128         fi
129 done
130 ext=$i$ext
131
132 echo "Using build name nexuiz$date$ext"
133 sleep 3
134
135 # check for remains
136 conflicts=`find "$dpdir" "$nexdir" -name '*.orig' -o -name '*.rej' -o -name '*.mine' -o -name '.#*' -o -name '.*~'`
137 if [ -n "$conflicts" ]; then
138         echo "CONFLICTS OR UNNEEDED FILES HAVE BEEN FOUND!"
139         echo "NOT PROCEEDING"
140         echo
141         echo "$conflicts"
142         exit 1
143 fi
144
145 set -x
146
147 # prepare temp dir
148 rm -rf "$tmpdir"
149 mkdir -p "$tmpdir"
150
151 # clean up and patch DP
152 cd "$dpdir"
153 quilt pop -a || true
154 svn revert -R .
155 if [ -s patches/series ]; then
156         quilt push -a # apply all patches
157 fi
158
159 # prepare directory structure
160 cp -r "$osxapps"/*.app "$tmpdir"
161 mkdir "$tmpdir/debuginfo"
162 mkdir "$tmpdir/fteqcc"
163
164 # prepare fteqcc build
165 cd "$fteqccdir"
166 git checkout-index -a -f --prefix="$tmpdir/fteqcc/source/"
167 git log -1 > "$tmpdir/fteqcc/source/fteqcc-base-revision.txt"
168 fteqccrev=`git show --pretty=%ct-%H | head -n 1`
169 echo "fteqcc rev $fteqccrev"
170
171 # build all executables
172 cd "$dpdir"
173 rm -f *.exe nexuiz-* *-withdebug* *.o
174 make clean
175 build
176 rm -f *.exe nexuiz-* *-withdebug '.#'* *.o
177 rm -rf fteqcc copystrip
178 make clean
179
180 # move shell scripts and license
181 cd "$tmpdir"
182 cp "$nexdir/"nexuiz-*.sh "$tmpdir/"
183 cp "$nexdir/gpl.txt" "$tmpdir/"
184 cp "$nexdir/readme.html" "$tmpdir/"
185
186 # prepare data
187 cd "$nexdir/data"
188 svn export . "$tmpdir/data"
189 svn info . > "$tmpdir/data/nexuiz-data-base-revision.txt"
190 svn log > "$tmpdir/data/ChangeLog"
191
192 # prepare havoc
193 cd "$havocdir"
194 svn export . "$tmpdir/havoc"
195
196 # prepare Docs
197 cd "$nexdir/Docs"
198 svn export . "$tmpdir/Docs"
199
200 # prepare server
201 cd "$nexdir/server"
202 svn export . "$tmpdir/server"
203
204 # make gamesource
205 cd "$tmpdir/data"
206 mkdir -p "$tmpdir/sources"
207 mk7z ../sources/gamesource$date.zip qcsrc nexuiz-data-base-revision.txt ChangeLog
208
209 # make enginesource
210 cd "$dpdir"
211 svn export . "$tmpdir/darkplaces"
212 svn info > "$tmpdir/darkplaces/nexuiz-base-revision.txt"
213 svn diff > "$tmpdir/darkplaces/nexuiz-engine-changes.diff"
214 svn log > "$tmpdir/darkplaces/ChangeLog"
215 cd "$tmpdir"
216 mk7z "$tmpdir/sources/enginesource$date.zip" "darkplaces"
217 rm -rf darkplaces
218
219 # make fteqcc archive
220 cd "$tmpdir"
221 zip -9r "$tmpdir/sources/fteqcc-binaries-and-source-rev$fteqccrev.zip" "fteqcc"
222 rm -rf fteqcc
223
224 # clean fteqcc dir
225 cd "$fteqccdir"
226 rm -f *.o *.bin
227 make
228
229 # make local compiler
230 cd "$tmpdir/data"
231 make FTEQCC="$fteqccdir/fteqcc.bin"
232
233 # prepare root
234 rm -rf "$tmpdir/data/qcsrc"
235 cd "$tmpdir/Docs"
236 cp "$dpdir/darkplaces.txt" .
237 cd "$tmpdir/data"
238 mv common-spog.pk3 ..
239 perl -pi -e '/^set g_nexuizversion "?([0-9.]*)[^"]*"?/ and $_ = "set g_nexuizversion '$version'\n"' defaultNexuiz.cfg
240 if [ -z "$versiontag" ]; then
241         perl -pi -e 'm|^//!<showbrand| .. m|^//!>showbrand| and $_ = "";' defaultNexuiz.cfg
242         rm -f gfx/brand.tga
243 fi
244 echo >> defaultNexuiz.cfg
245 echo "$defaultcfg" >> defaultNexuiz.cfg
246
247 cd "$nexdir/misc/mediasource/menuskins/wickedz/background_builder"
248 sh append.sh "$version" "$tmpdir/data/gfx/menu/wickedz/"
249 cd "$tmpdir/data"
250
251 mk7z ../data.pk3 .
252
253 cd "$tmpdir/havoc"
254 mk7z ../havoc.pk3 .
255
256 # make data pk3
257 cd "$tmpdir"
258 rm -rf data
259 mkdir data
260 mv data.pk3 data/data$tag$date.pk3
261 mv common-spog.pk3 data/
262 rm -rf havoc
263 mkdir havoc
264 mv havoc.pk3 havoc/data$tag${date}havoc.pk3
265
266 cp -r "$mingwdlls"/* .
267 # fix up permissions
268 chmod 644 *.dll *.exe
269
270 mkdir extra
271 cd extra
272 wget http://www.icculus.org/netradiant/files/netradiant-${netradiant_release}-win32.zip
273 #echo "Downloading netradiant, press enter and type the PWs"
274 #read -r DUMMY
275 #scp divverent@icculus.org:netradiant-webspace/files/netradiant-${netradiant_release}-win32.zip .
276 unzip netradiant-${netradiant_release}-win32.zip
277 mv NetRadiant netradiant-${netradiant_release}-win32
278 rm -f netradiant-${netradiant_release}-win32.zip
279 wget http://www.icculus.org/netradiant/files/netradiant-${netradiant_release}-osxintel.zip
280 #scp divverent@icculus.org:netradiant-webspace/files/netradiant-${netradiant_release}-osxintel.zip .
281 unzip netradiant-${netradiant_release}-osxintel.zip
282 mv NetRadiant.app NetRadiant-${netradiant_release}-osxintel.app
283 rm -f netradiant-${netradiant_release}-osxintel.zip
284 cat >> unsupported.txt <<EOF
285 This directory contains NetRadiant, a stabilized Q3 map editor,\r
286 configured for Nexuiz.\r
287 \r
288 It is not officially supported by Alientrap.\r
289 \r
290 Website: http://www.icculus.org/netradiant/\r
291 EOF
292 cd ..
293
294 # make main structure
295 mkdir Nexuiz
296 mv * Nexuiz/ || true
297
298 find . -name .svn -exec rm -rf {} \; -prune
299
300 rm -f "$zipdir/nexuiz$date$ext.zip"
301 zip $zipflags -9yr "$zipdir/nexuiz$date$ext.zip"           Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/readme.html Nexuiz/server Nexuiz/data/data$tag$date.pk3 Nexuiz/data/common-spog.pk3 Nexuiz/havoc/* Nexuiz/extra/*
302 ln -snf nexuiz$date$ext.zip "$zipdir/nexuiz-$newest.zip"
303
304 rm -f "$zipdir/nexuizengineonly$date$ext.zip"
305 zip $zipflags -9yr "$zipdir/nexuizengineonly$date$ext.zip" Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll
306 ln -snf nexuizengineonly$date$ext.zip "$zipdir/nexuizengineonly-$newest.zip"
307
308 rm -f "$zipdir/nexuizsource$date$ext.zip"
309 zip $zipflags -9yr "$zipdir/nexuizsource$date$ext.zip"     Nexuiz/gpl.txt                                            Nexuiz/sources
310 ln -snf nexuizsource$date$ext.zip "$zipdir/nexuizsource-$newest.zip"
311
312 # TODO remove these excludes after the version after 2.4.2
313 $zipdiff -o "Nexuiz/data/data$tag$date""patch.pk3" -f "$basepk3" -t Nexuiz/data/data$tag$date.pk3
314 [ -n "$hotbasepk3" ] && $zipdiff -o "Nexuiz/data/data$tag$date""hotfix.pk3" -f "$hotbasepk3" -t Nexuiz/data/data$tag$date.pk3
315 mkdir -p gfx
316 if unzip "Nexuiz/data/data$tag$date.pk3" gfx/brand.tga; then
317         zip -9r "Nexuiz/data/data$tag$date""patch.pk3" gfx/brand.tga
318         [ -n "$hotbasepk3" ] && zip -9r "Nexuiz/data/data$tag$date""hotfix.pk3" gfx/brand.tga
319         rm -rf gfx
320 fi
321
322 rm -f "$zipdir/nexuizpatch$date$ext.zip"
323 zip $zipflags -9yr "$zipdir/nexuizpatch$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/readme.html Nexuiz/server Nexuiz/data/data$tag$date""patch.pk3 Nexuiz/havoc/*
324 ln -snf nexuizpatch$date$ext.zip "$zipdir/nexuizpatch-$newest.zip"
325
326 [ -n "$hotbasepk3" ] && rm -f "$zipdir/nexuizhotfix$date$ext.zip"
327 [ -n "$hotbasepk3" ] && zip $zipflags -9yr "$zipdir/nexuizhotfix$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/readme.html Nexuiz/server Nexuiz/data/data$tag$date""hotfix.pk3 Nexuiz/havoc/*
328 [ -n "$hotbasepk3" ] && ln -snf nexuizhotfix$date$ext.zip "$zipdir/nexuizhotfix-$newest.zip"
329
330 rm -f "$zipdir/nexuizdocs$date$ext.zip"
331 zip $zipflags -9yr "$zipdir/nexuizdocs$date$ext.zip"       Nexuiz/gpl.txt Nexuiz/Docs Nexuiz/readme.html
332 ln -snf nexuizdocs$date$ext.zip "$zipdir/nexuizdocs-$newest.zip"
333
334 rm -f "$zipdir/nexuizdebug$date$ext.zip"
335 zip $zipflags -9yr "$zipdir/nexuizdebug$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/debuginfo/* Nexuiz/sources
336 ln -snf nexuizdebug$date$ext.zip "$zipdir/nexuizdebug-$newest.zip"
337
338 case "$versiontag" in
339         test)
340                 ;;
341         *)
342                 cat <<'EOF'
343
344 NOTE: This is a RELEASE BUILD.
345
346 To upload and finish the build, these things have to be done:
347
348 - Test the build:
349   - On Linux/ATI
350   - On Vista/nvidia
351   - On Vista/ATI
352   - On Vista/Intel
353   - On OSX/ATI
354   - Turn on "developer 1"; watch out for suspicious messages.
355   - While testing, make sure all campaign levels are tested. In CTF/KH levels,
356     try to do a capture. After that, finish the game by prvm_edictset server 1
357     frags 1000.
358   - Play on a server running the new code. Ideally, that server should be public
359     and "somewhat compatible" to old clients, and some other players should be
360     on it.
361 - Post the build on the forum as a test release. E.g. run this script again
362   with the "version" variable NOT SET, so the build gets marked "testing only",
363   and upload it and post it on the forum for testing. Mention the test server
364   that is already running the new code. Wait for at least one week for critical
365   bug reports.
366 - If needed, fix the reported bugs and re-run this script for a release build.
367   Possibly repeat the testing process.
368 - Upload the "final" build you have just made to Sourceforge (upload.sf.net,
369   incoming). Use the naming scheme nexuiz-25.zip, nexuizpatch-24-to-25.zip
370 - Make the download available on sourceforge.
371 - Announce the build on the forum; update the downloads website. Note that the
372   download may be still unavailable because of the SF mirror system.
373 - Wait for the mirrors to catch up.
374 - Edit the website: make a new news item for the new release, change the logo
375   image in the top left for the new version (ask [-z-]).
376
377 EOF
378                 ;;
379 esac