source: main/trunk/release-kits/kits/rk2/ant-scripts/compile.xml@ 22493

Last change on this file since 22493 was 22493, checked in by sjm84, 14 years ago

Some Apache HTTPD debugging files are now removed as they are unnecessary and increased the size of the installer

File size: 19.0 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="rk2-compile">
3
4 <target name="compile" depends="init,gs2-init">
5 <!-- checkout greenstone2 (or gsdl if a pre-2.84 release is being created) and gli -->
6 <if>
7 <bool>
8 <or>
9 <equals arg1="${branch.path}" arg2="trunk"/>
10 <equals arg1="${branch.path}" arg2="tags/stable"/>
11 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
12 </or>
13 </bool>
14 <exec executable="svn">
15 <arg value="checkout"/>
16 <arg value="${svn.root}/main/${branch.path}/greenstone2"/>
17 <arg value="${basedir}/compiled"/>
18 </exec>
19 <else>
20 <exec executable="svn">
21 <arg value="checkout"/>
22 <arg value="${svn.root}/main/${branch.path}/gsdl"/>
23 <arg value="${basedir}/compiled"/>
24 </exec>
25 </else>
26 </if>
27
28 <exec executable="svn">
29 <arg value="checkout"/>
30 <arg value="${svn.root}/main/${branch.path}/gli"/>
31 <arg value="${basedir}/compiled/gli"/>
32 </exec>
33
34 <!-- drop in documentation -->
35 <copy todir="compiled" overwrite="true">
36 <fileset dir="${rk.home}/shared/greenstone2/docs" excludes="READMEar.txt,READMEes.txt,READMEfr.txt,READMEru.txt"/>
37 </copy>
38
39 <!-- set version numbers -->
40 <antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
41 <antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/compiled/gli"/></antcall>
42
43 <!-- we do not want the *.app folders if we are not mac-->
44 <if><bool><not><equals arg1="${rk.os}" arg2="mac"/></not></bool>
45 <delete dir="${basedir}/compiled/client-gli.app"/>
46 <delete dir="${basedir}/compiled/gems.app"/>
47 <delete dir="${basedir}/compiled/gs2-server.app"/>
48 <delete dir="${basedir}/compiled/gli.app"/>
49 </if>
50
51 <!-- windows only -->
52 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
53
54 <!-- unzip packages -->
55 <unzip src="${basedir}/compiled/common-src/packages/windows/crypt/crypt.zip" dest="${basedir}/compiled/common-src/packages/windows/crypt"/>
56 <unzip src="${basedir}/compiled/common-src/packages/windows/expat/expat.zip" dest="${basedir}/compiled/common-src/packages/windows/expat"/>
57 <unzip src="${basedir}/compiled/common-src/packages/windows/stlport/stlport.zip" dest="${basedir}/compiled/common-src/packages/windows/stlport"/>
58 <unzip src="${basedir}/compiled/common-src/indexers/packages/windows/iconv/iconv.zip" dest="${basedir}/compiled/common-src/indexers/packages/windows/iconv"/>
59 <untar src="${basedir}/compiled/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz" dest="${basedir}/compiled/common-src/packages/sqlite" compression="gzip"/>
60
61 <!-- get winbin from tags if the version is greater than 2.83 otherwise get it from trunk -->
62 <if><bool><not><available file="${basedir}/compiled/bin/windows"/></not></bool>
63 <if>
64 <bool>
65 <and>
66 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
67 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
68 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
69 </and>
70 </bool>
71
72 <exec executable="svn">
73 <arg value="export"/>
74 <arg value="${svn.root}/main/${branch.path}/binaries/windows/bin"/>
75 <arg value="${basedir}/compiled/bin/windows"/>
76 <arg value="-r"/>
77 <arg value="${branch.revision}"/>
78 </exec>
79
80 <else>
81 <exec executable="svn">
82 <arg value="export"/>
83 <arg value="${svn.root}/main/trunk/binaries/windows/bin"/>
84 <arg value="${basedir}/compiled/bin/windows"/>
85 <arg value="-r"/>
86 <arg value="${branch.revision}"/>
87 </exec>
88 </else>
89 </if>
90 </if>
91
92 <!-- insert windows perl -->
93 <unzip src="${rk.home}/shared/windows/perl.zip" dest="compiled/bin/windows"/>
94
95 <exec executable="${basedir}/compiled/bin/windows/gunzip.exe" dir="${basedir}/compiled/runtime-src/packages/apache-httpd">
96 <arg value="-d"/>
97 <arg value="httpd-2.2.11-gs.tar.gz"/>
98 </exec>
99
100 <exec executable="${basedir}/compiled/bin/windows/tar.exe" dir="${basedir}/compiled/runtime-src/packages/apache-httpd">
101 <arg value="-xvf"/>
102 <arg value="httpd-2.2.11-gs.tar"/>
103 </exec>
104
105 <!-- Insert a unique number after every occurrence of the word tempfile to prevent some strange race conditions present on Windows 7 (iuv = InsertUniqueValue) -->
106 <iuv>
107 <fileset dir="${basedir}/compiled/runtime-src/packages/apache-httpd/httpd-2.2.11" includes="**/*.mak"/>
108 <job pattern="tempfile"/>
109 </iuv>
110
111 <rsr>
112 <fileset dir="${basedir}/compiled/runtime-src/packages/apache-httpd/httpd-2.2.11" includes="**/*.mak"/>
113 <job pattern="/MD" replacement="/MT"/>
114 </rsr>
115
116 <!-- compile c code -->
117 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="clean"/></exec>
118 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="APACHE_HTTPD=1"/></exec>
119 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="LOCAL_LIBRARY=1"/></exec>
120 <delete><fileset dir="${basedir}/compiled/apache-httpd" includes="**/*.pdb"/></delete>
121 <mkdir dir="products"/>
122 <copy file="${basedir}/compiled/server.exe" tofile="${basedir}/products/server-${version}.exe"/>
123 <move file="${basedir}/compiled/server.exe" todir="${basedir}/compiled/bin/windows"/>
124
125
126 <!-- linux only -->
127 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
128
129 <!-- add static to configure.in -->
130 <rsr file="${basedir}/compiled/configure.in" pattern="^LDFLAGS=.*$" replacement="LDFLAGS=-static"/>
131 <exec dir="${basedir}/compiled" executable="autoconf" output="${basedir}/compiled/configure">
132 <arg value="configure.in"/>
133 </exec>
134
135 <!-- set environment in packages/configure -->
136 <rsr file="${basedir}/compiled/common-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
137 <rsr file="${basedir}/compiled/build-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
138
139 <!-- run configure -->
140 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
141 <arg line="--enable-apache-httpd"/>
142 <env key="LDFLAGS" value="-static"/>
143 </exec>
144
145 <!-- add -static to makefiles -->
146 <rsr file="${basedir}/compiled/build-src/packages/wv/wv-gs/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static" />
147 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/xlhtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
148 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/ppthtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
149 <rsr file="${basedir}/compiled/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="(-o rtftohtml.{2}EXEEXT.{1})" replacement="$1 -static"/>
150
151 <!-- mac only -->
152 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
153 <!-- run configure -->
154 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
155 <arg line="--enable-apache-httpd"/>
156 </exec>
157
158 <!-- tweak makefiles -->
159 <rsr file="${basedir}/compiled/runtime-src/src/recpt/Makefile" pattern="^(LIBS =.*)-L(.)\(PACKAGES_DIR\)/expat/lib -lexpat(.*)$" replacement="$1$2(PACKAGES_DIR)/expat/lib/libexpat.a$3"/>
160 <rsr file="${basedir}/compiled/runtime-src/src/oaiservr/Makefile" pattern="^(LIBS =.*)-L(.)\(PACKAGES_DIR\)/expat/lib -lexpat(.*)$" replacement="$1$2(PACKAGES_DIR)/expat/lib/libexpat.a$3"/>
161
162 </if></else></if></else></if>
163
164 <!-- mac and linux: compile -->
165 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
166
167 <!-- make -->
168 <exec dir="${basedir}/compiled" executable="make" failonerror="true"/>
169
170 <!-- make install -->
171 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="install"/></exec>
172
173 <!-- make apache-for-dist -->
174 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="apache-for-dist"/></exec>
175
176 <!-- strip executables -->
177 <exec dir="${basedir}/compiled/bin/${os.shell}" executable="find" failonerror="true">
178 <arg line=". ! -name . -type f -maxdepth 1 -exec strip {} &#59;"/>
179 </exec>
180 </if>
181
182 <!-- insert the necessary additional xml parser versions-->
183 <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
184 <!-- Add the 5.6 version if necessary -->
185 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.6"/></not></bool>
186 <copy todir="${basedir}/compiled/perllib/cpan">
187 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.6,perl-5.6/**/*"/>
188 </copy>
189 </if>
190
191 <!-- Add the 5.8 version if necessary -->
192 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.8"/></not></bool>
193 <copy todir="${basedir}/compiled/perllib/cpan">
194 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.8,perl-5.8/**/*"/>
195 </copy>
196 </if>
197
198 <!-- Add the 5.10 version if necessary -->
199 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.10"/></not></bool>
200 <copy todir="${basedir}/compiled/perllib/cpan">
201 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.10,perl-5.10/**/*"/>
202 </copy>
203 </if>
204 </if>
205
206 <!-- compile gli -->
207 <!-- (linux and mac) -->
208 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
209 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makegli.sh"/></exec>
210 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makejar.sh"/></exec>
211 <!-- windows -->
212 <else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
213 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makegli.bat"/></exec>
214 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makejar.bat"/></exec>
215 </if></else></if>
216
217 <delete dir="compiled/gli/jar"/>
218 <delete dir="compiled/gli/classes/org"/>
219 <move file="compiled/gli/GLIServer.jar" todir="compiled/bin/java"/>
220
221 <!-- compile uninstaller -->
222 <antcall target="insert-and-compile-uninstaller" />
223
224 <!-- build demo collection -->
225 <!-- the envs on these execs simulate the environment when you run setup.bat -->
226 <if>
227 <bool>
228 <equals arg1="${rk.os}" arg2="windows"/>
229 </bool>
230
231 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl">
232 <arg line="-S"/>
233 <arg line="bin/script/import.pl demo"/>
234 <env key="GSDLHOME" path="${basedir}/compiled"/>
235 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
236 <env key="GSDLOS" value="windows"/>
237 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
238 </exec>
239 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl">
240 <arg line="-S"/>
241 <arg line="bin/script/buildcol.pl demo"/>
242 <env key="GSDLHOME" path="${basedir}/compiled"/>
243 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
244 <env key="GSDLOS" value="windows"/>
245 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
246 </exec>
247
248 <else>
249 <exec dir="${basedir}/compiled" executable="perl">
250 <arg line="-S"/>
251 <arg line="bin/script/import.pl demo"/>
252 <env key="GSDLHOME" path="${basedir}/compiled"/>
253 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
254 <env key="GSDLOS" value="linux"/>
255 <env key="PATH" path="${basedir}/compiled/bin/linux:${basedir}/compiled/bin/script:${env.PATH}"/>
256 </exec>
257 <exec dir="${basedir}/compiled" executable="perl">
258 <arg line="-S"/>
259 <arg line="bin/script/buildcol.pl demo"/>
260 <env key="GSDLHOME" path="${basedir}/compiled"/>
261 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
262 <env key="GSDLOS" value="linux"/>
263 <env key="PATH" path="${basedir}/compiled/bin/linux:${basedir}/compiled/bin/script:${env.PATH}"/>
264 </exec>
265 </else>
266 </if>
267 <delete dir="${basedir}/compiled/collect/demo/index"/>
268 <move file="${basedir}/compiled/collect/demo/building" tofile="${basedir}/compiled/collect/demo/index"/>
269
270 <!-- delete the source code -->
271 <delete><fileset dir="compiled" includes="Makefile,config.cache,config.h,config.log,stamp-h,config.status"/></delete>
272 <delete dir="compiled/common-src"/>
273 <delete dir="compiled/build-src"/>
274 <delete dir="compiled/runtime-src"/>
275 <delete><fileset dir="compiled" includes="Install.txt,acconfig.h,aclocal.m4,config.guess,config.sub,configtest.pl,configure,configure.in,install-sh,Makefile.in,micotest.cpp,config.h.in,win32.mak,win32cfg.h"/></delete>
276
277 <!-- strip .svn working-copy dirs -->
278 <antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
279
280 <!-- create needed empty files -->
281 <mkdir dir="compiled/tmp"/>
282 <chmod dir="compiled/tmp" perm="a+rwx"/>
283 <echo file="compiled/etc/usage.txt"></echo>
284
285 <!-- windows -->
286 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
287
288 <!-- make a copy of server.exe in the root -->
289 <copy file="compiled/bin/windows/server.exe" tofile="compiled/server.exe"/>
290
291 <!-- delete sourcecode -->
292 <delete dir="${binzip.dir}/common-src"/>
293 <delete dir="${binzip.dir}/build-src"/>
294 <delete dir="${binzip.dir}/runtime-src"/>
295
296 <!-- create simple zipped binary distribution
297 <mkdir dir="distributions"/>
298 <property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
299 <copy todir="${binzip.dir}"><fileset dir="compiled"/></copy>
300 <delete><fileset dir="${binzip.dir}" includes="README*.txt,Uninstall.bat,Uninst.bat,uninst.jar,win32.mak,win32cfg.h,makegs2.bat" excludes="READMEen.txt"/></delete>
301 -->
302
303 <!-- delete unneeded files -->
304 <delete dir="compiled/bin/linux" />
305 <delete><fileset dir="compiled" includes="*.bash,*.sh,*.csh,.gstermrc"/></delete>
306 <delete><fileset dir="compiled/gli" includes="*.sh,*4gs3.bat"/></delete>
307 <delete dir="compiled/autom4te.cache" />
308
309 <!-- linux -->
310 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
311
312 <!-- grab imagemagick and wv binaries -->
313 <delete dir="compiled/bin/linux/imagemagick"/>
314 <delete dir="compiled/bin/linux/wv"/>
315
316 <if>
317 <bool>
318 <and>
319 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
320 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
321 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
322 </and>
323 </bool>
324
325 <exec executable="svn">
326 <arg value="export"/>
327 <arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
328 <arg value="compiled/bin/linux/imagemagick"/>
329 </exec>
330
331 <exec executable="svn">
332 <arg value="export"/>
333 <arg value="${svn.root}/main/${branch.path}/binaries/linux/wv"/>
334 <arg value="compiled/bin/linux/wv"/>
335 </exec>
336
337 <else>
338 <exec executable="svn">
339 <arg value="export"/>
340 <arg value="${svn.root}/main/trunk/binaries/linux/imagemagick"/>
341 <arg value="compiled/bin/linux/imagemagick"/>
342 </exec>
343
344 <exec executable="svn">
345 <arg value="export"/>
346 <arg value="${svn.root}/main/trunk/binaries/linux/wv"/>
347 <arg value="compiled/bin/linux/wv"/>
348 </exec>
349 </else>
350 </if>
351
352 <!-- delete unneeded files -->
353 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,micotest.cpp"/></delete>
354 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
355 <delete><fileset dir="compiled" includes="*.bat"/></delete>
356 <delete dir="compiled/common-src/packages/windows"/>
357 <delete dir="compiled/common-src/indexers/packages/windows"/>
358
359 <!-- mac -->
360 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
361 <!-- grab imagemagick and ghostscript binaries -->
362 <delete dir="compiled/bin/darwin/imagemagick"/>
363 <delete dir="compiled/bin/darwin/ghostscript"/>
364
365 <if>
366 <bool>
367 <and>
368 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
369 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
370 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
371 </and>
372 </bool>
373
374 <exec executable="svn">
375 <arg value="export"/>
376 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/imagemagick"/>
377 <arg value="compiled/bin/darwin/imagemagick"/>
378 </exec>
379
380 <exec executable="svn">
381 <arg value="export"/>
382 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/ghostscript"/>
383 <arg value="compiled/bin/darwin/ghostscript"/>
384 </exec>
385
386 <else>
387 <exec executable="svn">
388 <arg value="export"/>
389 <arg value="${svn.root}/main/trunk/binaries/mac/intel/imagemagick"/>
390 <arg value="compiled/bin/darwin/imagemagick"/>
391 </exec>
392
393 <exec executable="svn">
394 <arg value="export"/>
395 <arg value="${svn.root}/main/trunk/binaries/mac/intel/ghostscript"/>
396 <arg value="compiled/bin/darwin/ghostscript"/>
397 </exec>
398 </else>
399 </if>
400
401 <!-- delete unneeded files -->
402 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,*.bat"/></delete>
403 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
404 <delete dir="compiled/common-src/packages/windows"/>
405
406 </if></else></if></else></if>
407
408 <!-- delete unneeded files -->
409 <delete dir="compiled/uninstaller" />
410 <delete file="compiled/bin/java/SignedGatherer.jar" />
411
412 <!-- tidy up gli -->
413 <antcall target="gli-tidy-for-dist"><param name="glibasedir" value="compiled/gli"/></antcall>
414
415 <!-- mac and linux: insert export to cdrom package -->
416 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
417 <mkdir dir="compiled/bin/windows"/>
418 <get src="${server.exe.location}" dest="compiled/bin/windows/server.exe"/>
419
420 <if>
421 <bool>
422 <and>
423 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
424 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
425 </and>
426 </bool>
427
428 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
429 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
430
431 <else>
432 <get src="${svn.root}/main/trunk/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
433 <get src="${svn.root}/main/trunk/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
434 </else>
435 </if>
436 </if>
437
438 </target>
439
440</project>
Note: See TracBrowser for help on using the repository browser.