]> icculus.org git repositories - divverent/nexuiz.git/blob - misc/makebuild.sh
makebuild updated
[divverent/nexuiz.git] / misc / makebuild.sh
1 #!/bin/sh
2 set -e
3
4 base=`pwd`
5
6
7 case "$pw" in
8         '')
9                 zipflags=
10                 ;;
11         *)
12                 zipflags="-P $pw"
13                 ;;
14 esac
15 case "$version" in
16         [0-9]*)
17                 versiontag=
18                 ext=_v$version
19                 version=$version
20                 ;;
21         *)
22                 version=
23                 ;;
24 esac
25 case "$versiontag" in
26         '')
27                 ;;
28         *)
29                 version='$1'$versiontag
30                 versiontag=$versiontag
31                 ;;
32 esac
33
34 basepk3=$base/data20060905.pk3
35 nexdir=$base/nexuiz
36 dpdir=$base/darkplaces
37 tmpdir=/tmp/NEX
38 zipdir=/home/polzer/UT/distfiles/nex/
39 buildfiles=$base/buildfiles
40 mingwdlls=$buildfiles/w32
41 osxapps=$buildfiles/osx
42 copystrip=$buildfiles/copystrip
43 fteqcc="fteqcc.bin -O2"
44 mingw=/home/polzer/mingw32
45 ia32=/chroot/fc6-i386
46 osxhost=macmini
47 osxtemp=/Users/rpolzer/Darkplaces.build
48 osxsave=/tmp/Nexuiz.osx
49
50 if [ -n "$1" ]; then
51         osxhost="$1"
52 fi
53
54 conflicts=`find "$dpdir" "$nexdir" -name '*.orig' -o -name '*.rej' -o -name '*.mine' -o -name '.#*' -o -name '.*~'`
55 if [ -n "$conflicts" ]; then
56         echo "CONFLICTS OR UNNEEDED FILES HAVE BEEN FOUND!"
57         echo "NOT PROCEEDING"
58         echo
59         echo "$conflicts"
60         exit 1
61 fi
62
63 : ${date:=`date +%Y%m%d`}
64 : ${versiontag:=}
65 echo "date stamp: $date"
66
67 set -x
68
69 buildosx()
70 {
71         rsync --exclude "*.o" --exclude "*.d" --exclude "nexuiz-*" --delete-excluded --delete -zvaSHP . $copystrip "$osxhost:$osxtemp"
72         ssh "$osxhost" ". ~/.profile && cd $osxtemp && PATH=$osxtemp/copystrip:\$PATH make CC=\"gcc -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk\" clean $*"
73         rmdir "$osxsave" || true
74         if [ -d "$osxsave" ]; then
75                 cp "$osxsave"/* .
76         fi
77         rsync --exclude "*.o" --exclude "*.d" --delete-excluded --delete -zvaSHP "$osxhost:$osxtemp/." .
78         mkdir -p "$osxsave"
79         cp nexuiz-* "$osxsave"/
80 }
81
82 build64()
83 {
84         PATH=$copystrip:$PATH make CC="/opt/gcc-4.1.1/bin/gcc -g" "$@"
85 }
86
87 build32()
88 {
89         PATH=$copystrip:$PATH make CC="/opt/gcc-4.1.1/bin/gcc -g -I$ia32/usr/include -I$ia32/usr/X11R6/include -L$ia32/usr/lib -L$ia32/usr/X11R6/lib -m32" DP_MACHINE=i686 "$@"
90 }
91
92 buildwin()
93 {
94         PATH=$copystrip:$mingw/bin:$PATH make CC="gcc -g" DP_MAKE_TARGET=mingw "$@"
95 }
96
97 rm -rf "$tmpdir"
98 mkdir -p "$tmpdir"
99 cd "$dpdir"
100 quilt pop -a || true
101 quilt push -a
102
103 cp -r "$osxapps"/*.app "$tmpdir"
104 mkdir "$tmpdir/debuginfo"
105 rm -f *.exe nexuiz-* *-withdebug
106
107 make clean
108 buildosx sdl-nexuiz cl-nexuiz sv-nexuiz
109 cp nexuiz-agl "$tmpdir/Nexuiz.app/Contents/MacOS/nexuiz-osx-ppc-agl-bin"
110 cp nexuiz-dedicated "$tmpdir/nexuiz-osx-ppc-dedicated"
111 cp nexuiz-sdl "$tmpdir/Nexuiz-SDL.app/Contents/MacOS/nexuiz-osx-ppc-sdl-bin"
112 cp nexuiz-agl-withdebug "$tmpdir/debuginfo/nexuiz-osx-ppc-agl-bin"
113 cp nexuiz-dedicated-withdebug "$tmpdir/debuginfo/nexuiz-osx-ppc-dedicated-bin"
114 cp nexuiz-sdl-withdebug "$tmpdir/debuginfo/nexuiz-osx-ppc-sdl-bin"
115
116 make clean
117 buildwin nexuiz
118 for x in -dedicated -sdl ''; do
119         cp nexuiz$x.exe "$tmpdir/nexuiz$x.exe"
120         cp nexuiz$x.exe-withdebug "$tmpdir/debuginfo/nexuiz$x.exe"
121 done
122
123 make clean
124 build32 nexuiz
125 for x in dedicated sdl glx; do
126         cp nexuiz-$x "$tmpdir/nexuiz-linux-686-$x"
127         cp nexuiz-$x-withdebug "$tmpdir/debuginfo/nexuiz-linux-686-$x"
128 done
129
130 make clean
131 build64 nexuiz
132 for x in dedicated sdl glx; do
133         cp nexuiz-$x "$tmpdir/nexuiz-linux-x86_64-$x"
134         cp nexuiz-$x-withdebug "$tmpdir/debuginfo/nexuiz-linux-x86_64-$x"
135 done
136
137 cp "$nexdir/"nexuiz-*.{sh,bat} "$tmpdir/"
138 cp "$nexdir/gpl.txt" "$tmpdir/"
139
140 make clean
141 rm -f *.exe nexuiz-* *-withdebug '.#'*
142
143 cd "$nexdir/data"
144 svn export . "$tmpdir/data"
145
146 cd "$nexdir/Docs"
147 svn export . "$tmpdir/Docs"
148
149 cd "$tmpdir/data"
150 mkdir -p "$tmpdir/sources"
151 #zip -9r ../sources/gamesource$date.zip qcsrc
152 7za a -mx=9 -tzip ../sources/gamesource$date.zip qcsrc
153
154 cd "$dpdir"
155 rm -f ChangeLog*
156 cvs2cl.pl
157
158 cd "$dpdir/.."
159 #zip -9r "$tmpdir/sources/enginesource$date.zip" "${dpdir##*/}"
160 7za a -mx=9 -tzip "$tmpdir/sources/enginesource$date.zip" "${dpdir##*/}"
161
162 cd "$tmpdir/data/qcsrc/menu"
163 $fteqcc
164
165 cd "$tmpdir/data/qcsrc/server"
166 $fteqcc
167
168 rm -rf "$tmpdir/data/qcsrc"
169
170 cd "$tmpdir/Docs"
171 perl -pi -e '/^#---SET nexversion=([0-9.]*)$/ and $_ = "#---SET nexversion='$version'\n"' FAQ.aft
172 perl -pi -e '/^\s*Version ([0-9.]*)<\/div>$/ and $_ = "Version '$version'</div>\n"' Readme.htm
173 aft FAQ.aft
174 aft FAQ.aft
175 rm FAQ.aft-TOC
176
177 cd "$tmpdir/data"
178 mv common-spog.pk3 ..
179 perl -pi -e '/^set g_nexuizversion "([0-9.]*)[^"]*"/ and $_ = "set g_nexuizversion \"'$version'\"\n"' default.cfg
180 if [ -n "$versiontag" ]; then
181         perl -pi -e '/^set g_nexuizversion/ and $_ = "showbrand 1\n$_"' default.cfg
182         cp "$buildfiles/brand/$versiontag.tga" gfx/brand.tga
183 fi
184 7za a -mx=7 -tzip ../data.pk3 .
185
186 cd "$tmpdir"
187 rm -rf data
188 mkdir data
189 mv data.pk3 data/data$date.pk3
190 mv common-spog.pk3 data/
191
192 cp -r "$mingwdlls"/* .
193 # fix up permissions
194 chmod 644 *.dll *.exe
195
196 mkdir Nexuiz
197 mv * Nexuiz/ || true
198
199 find . -name .svn -exec rm -rf {} \; -prune
200
201 rm -f "$zipdir/nexuiz$date$ext.zip"
202 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
203 rm -f "$zipdir/nexuizengineonly$date$ext.zip"
204 zip $zipflags -9yr "$zipdir/nexuizengineonly$date$ext.zip" Nexuiz/gpl.txt Nexuiz/nexuiz* Nexuiz/Nexuiz* Nexuiz/*.dll
205 rm -f "$zipdir/nexuizsource$date$ext.zip"
206 zip $zipflags -9yr "$zipdir/nexuizsource$date$ext.zip"     Nexuiz/gpl.txt                                            Nexuiz/sources
207
208 zipdiff -o "Nexuiz/data/datapatch$date.pk3" -f "$basepk3" -t Nexuiz/data/data$date.pk3
209 mkdir -p gfx
210 if unzip "Nexuiz/data/data$date.pk3" gfx/brand.tga; then
211         zip $zipflags -9r "Nexuiz/data/datapatch$date.pk3" gfx/brand.tga
212         rm -rf gfx
213 fi
214
215 rm -f "$zipdir/nexuizpatch$date$ext.zip"
216 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
217
218 rm -f "$zipdir/nexuizdebug$date$ext.zip"
219 zip $zipflags -9yr "$zipdir/nexuizdebug$date$ext.zip"      Nexuiz/gpl.txt Nexuiz/debuginfo/*