]> icculus.org git repositories - divverent/nexuiz.git/blob - misc/makebuild.sh
fteqcc build now with GUI
[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 fteqcc="fteqcc -O2"
47 fteqccdir="$base/fteqcc"
48 mingw=/home/polzer/mingw32
49
50 # TODO normalize the builds
51 platforms='x86 amd64 osx'
52 buildon()
53 {
54         host=$1
55         prefix=$2
56         fteqccname=$3
57         path=$4
58         makeflags=$5
59         strip=$6
60
61         fteqccflags=
62         case "$fteqccname" in
63                 *.exe)
64                         fteqccflags=win
65                         ;;
66         esac
67
68         rm -f "$fteqccdir"/*.o
69         rm -f "$fteqccdir"/*.bin
70         rsync --exclude "*.o" --exclude "*.d" --exclude "nexuiz-*" --delete-excluded --delete -zvaSHP . "$copystrip" "$fteqccdir" "$host:$path"
71         ssh "$host" ". ~/.profile && cd $path && COPYSTRIP_STRIP=$strip PATH=$path/copystrip:\$PATH make $makeflags clean nexuiz && cd ${fteqccdir##*/} && make $makeflags $fteqccflags"
72         rsync --exclude "*.o" --exclude "*.d" --delete-excluded --delete -zvaSHP "$host:$path/." .
73         for P in -dedicated -sdl -glx -wgl -agl -dedicated.exe -sdl.exe .exe; do
74                 [ -f nexuiz$P ] && mv nexuiz$P "$tmpdir/$prefix$P"
75                 [ -f nexuiz$P-withdebug ] && mv nexuiz$P-withdebug "$tmpdir/debuginfo/$prefix$P"
76         done
77         case "$fteqccname" in
78                 *.exe)
79                         mv "${fteqccdir##*/}"/fteqcc.exe "$tmpdir/fteqcc/$fteqccname"
80                         ;;
81                 *)
82                         mv "${fteqccdir##*/}"/fteqcc.bin "$tmpdir/fteqcc/$fteqccname"
83                         ;;
84         esac
85         make clean
86 }
87
88 build()
89 {
90         buildon hagger  nexuiz-osx          fteqcc-osx          /tmp/Darkplaces.build 'DP_MAKE_TARGET=macosx CC="i686-apple-darwin8-gcc -g -arch i386 -arch ppc -I/opt/mac/SDKs/MacOSX10.4u.sdk/Library/Frameworks/SDL.framework/Headers"' i686-apple-darwin8-strip
91                 mv "$tmpdir/nexuiz-osx-agl"     "$tmpdir/Nexuiz.app/Contents/MacOS/nexuiz-osx-agl-bin"
92                 mv "$tmpdir/nexuiz-osx-sdl"     "$tmpdir/Nexuiz-SDL.app/Contents/MacOS/nexuiz-osx-sdl-bin"
93         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
94         buildon hagger  nexuiz-linux-686    fteqcc-linux-686    /tmp/Darkplaces.build 'CC="gcc -g"'
95         buildon hector  nexuiz-linux-x86_64 fteqcc-linux-x86_64 /tmp/Darkplaces.build 'CC="gcc -g"'
96 }
97
98 i=
99 while [ -f "$zipdir/nexuiz$date$i$ext.zip" ]; do
100         if [ -z "$i" ]; then
101                 i=a
102         else
103                 i=`echo "$i" | tr a-y b-z`
104         fi
105 done
106 ext=$i$ext
107
108 echo "Using build name nexuiz$date$ext"
109 sleep 3
110
111 if [ -n "$1" ]; then
112         osxhost="$1"
113 fi
114
115 conflicts=`find "$dpdir" "$nexdir" -name '*.orig' -o -name '*.rej' -o -name '*.mine' -o -name '.#*' -o -name '.*~'`
116 if [ -n "$conflicts" ]; then
117         echo "CONFLICTS OR UNNEEDED FILES HAVE BEEN FOUND!"
118         echo "NOT PROCEEDING"
119         echo
120         echo "$conflicts"
121         exit 1
122 fi
123
124 set -x
125
126 rm -rf "$tmpdir"
127 mkdir -p "$tmpdir"
128
129 cd "$dpdir"
130 quilt pop -a || true
131 svn revert -R .
132 quilt push -a # apply all patches
133
134 cp -r "$osxapps"/*.app "$tmpdir"
135 mkdir "$tmpdir/debuginfo"
136 mkdir "$tmpdir/fteqcc"
137
138 svn export "$fteqccdir" "$tmpdir/fteqcc/source"
139 svn info "$fteqccdir" > "$tmpdir/fteqcc/source/fteqcc-base-revision.txt"
140 fteqccrev=$((`grep "Last Changed Rev:" "$tmpdir/fteqcc/source/fteqcc-base-revision.txt" | cut -d : -f 2`))
141 echo "fteqcc rev $fteqccrev"
142
143 rm -f *.exe nexuiz-* *-withdebug* *.o
144 make clean
145 build
146 rm -f *.exe nexuiz-* *-withdebug '.#'* *.o
147 rm -rf fteqcc copystrip
148 make clean
149
150 cd "$tmpdir"
151 cp "$nexdir/"nexuiz-*.sh "$tmpdir/"
152 cp "$nexdir/"nexuiz-*.bat "$tmpdir/"
153 cp "$nexdir/gpl.txt" "$tmpdir/"
154
155 cd "$nexdir/data"
156 svn export . "$tmpdir/data"
157
158 cd "$nexprodir"
159 svn export . "$tmpdir/pro"
160
161 cd "$nexdir/Docs"
162 svn export . "$tmpdir/Docs"
163
164 cd "$tmpdir/data"
165 mkdir -p "$tmpdir/sources"
166 #zip -9r ../sources/gamesource$date.zip qcsrc
167 7za a -mx=9 -tzip ../sources/gamesource$date.zip qcsrc
168
169 cd "$dpdir"
170 svn export . "$tmpdir/darkplaces"
171 svn info > "$tmpdir/darkplaces/nexuiz-base-revision.txt"
172 svn diff > "$tmpdir/darkplaces/nexuiz-engine-changes.diff"
173 svn log > "$tmpdir/darkplaces/ChangeLog"
174
175 cd "$tmpdir"
176 7za a -mx=9 -tzip "$tmpdir/sources/enginesource$date.zip" "darkplaces"
177 rm -rf darkplaces
178
179 cd "$tmpdir"
180 zip -9r "$tmpdir/sources/fteqcc-binaries-and-source-rev$fteqccrev.zip" "fteqcc"
181 rm -rf fteqcc
182
183 cd "$fteqccdir"
184 rm -f *.o *.bin
185 make
186
187 cd "$tmpdir/data/qcsrc/menu"
188 "$fteqccdir/fteqcc.bin" $fteqccflags
189
190 cd "$tmpdir/data/qcsrc/server"
191 "$fteqccdir/fteqcc.bin" $fteqccflags
192
193 rm -rf "$tmpdir/data/qcsrc"
194
195 cd "$tmpdir/Docs"
196 perl -pi -e '/^#---SET nexversion=([0-9.]*)$/ and $_ = "#---SET nexversion='$version'\n"' FAQ.aft
197 perl -pi -e '/^\s*Version ([0-9.]*)<\/div>$/ and $_ = "Version '$version'</div>\n"' Readme.htm
198 cp "$dpdir/darkplaces.txt" .
199 aft FAQ.aft
200 aft FAQ.aft
201 rm FAQ.aft-TOC
202
203 cd "$tmpdir/data"
204 mv common-spog.pk3 ..
205 perl -pi -e '/^set g_nexuizversion "?([0-9.]*)[^"]*"?/ and $_ = "set g_nexuizversion '$version'\n"' default.cfg
206 if [ -n "$versiontag" ]; then
207         perl -pi -e '/^set g_nexuizversion/ and $_ = "showbrand 3\n$_"' default.cfg
208         cp "$buildfiles/brand/$versiontag.tga" gfx/brand.tga
209 fi
210 echo >> default.cfg
211 echo "$defaultcfg" >> default.cfg
212 7za a -mx=7 -tzip ../data.pk3 .
213
214 cd "$tmpdir/pro"
215 perl -pi -e '/^set g_nexuizversion "?([0-9.]*)[^"]*"?/ and $_ = "set g_nexuizversion '$version-pro'\n"' default.cfg
216 if [ -n "$versiontag" ]; then
217         perl -pi -e '/^set g_nexuizversion/ and $_ = "showbrand 3\n$_"' default.cfg
218 fi
219 echo >> default.cfg
220 echo "$defaultcfg" >> default.cfg
221 7za a -mx=7 -tzip ../pro.pk3 .
222
223 cd "$tmpdir"
224 rm -rf data
225 mkdir data
226 mv data.pk3 data/data$date.pk3
227 mv common-spog.pk3 data/
228 rm -rf pro
229 mkdir pro
230 mv pro.pk3 pro/data${date}pro.pk3
231
232 cp -r "$mingwdlls"/* .
233 # fix up permissions
234 chmod 644 *.dll *.exe
235
236 mkdir Nexuiz
237 mv * Nexuiz/ || true
238
239 find . -name .svn -exec rm -rf {} \; -prune
240
241 rm -f "$zipdir/nexuiz$date$ext.zip"
242 zip $zipflags -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 Nexuiz/pro/*
243 ln -snf nexuiz$date$ext.zip "$zipdir/nexuizNEWEST.zip"
244
245 rm -f "$zipdir/nexuizengineonly$date$ext.zip"
246 zip $zipflags -9yr "$zipdir/nexuizengineonly$date$ext.zip" Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll
247 ln -snf nexuizengineonly$date$ext.zip "$zipdir/nexuizengineonlyNEWEST.zip"
248
249 rm -f "$zipdir/nexuizsource$date$ext.zip"
250 zip $zipflags -9yr "$zipdir/nexuizsource$date$ext.zip"     Nexuiz/gpl.txt                                            Nexuiz/sources
251 ln -snf nexuizsource$date$ext.zip "$zipdir/nexuizsourceNEWEST.zip"
252
253 zipdiff -o "Nexuiz/data/datapatch$date.pk3" -f "$basepk3" -t Nexuiz/data/data$date.pk3
254 mkdir -p gfx
255 if unzip "Nexuiz/data/data$date.pk3" gfx/brand.tga; then
256         zip $zipflags -9r "Nexuiz/data/datapatch$date.pk3" gfx/brand.tga
257         rm -rf gfx
258 fi
259
260 rm -f "$zipdir/nexuizpatch$date$ext.zip"
261 zip $zipflags -9yr "$zipdir/nexuizpatch$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll Nexuiz/sources Nexuiz/Docs Nexuiz/data/datapatch$date.pk3 Nexuiz/pro/*
262 ln -snf nexuizpatch$date$ext.zip "$zipdir/nexuizpatchNEWEST.zip"
263
264 rm -f "$zipdir/nexuizdocs$date$ext.zip"
265 zip $zipflags -9yr "$zipdir/nexuizdocs$date$ext.zip"       Nexuiz/gpl.txt Nexuiz/Docs
266 ln -snf nexuizdocs$date$ext.zip "$zipdir/nexuizdocsNEWEST.zip"
267
268 rm -f "$zipdir/nexuizdebug$date$ext.zip"
269 zip $zipflags -9yr "$zipdir/nexuizdebug$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/debuginfo/* Nexuiz/sources
270 ln -snf nexuizdebug$date$ext.zip "$zipdir/nexuizdebugNEWEST.zip"