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