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

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

The new wvWare uses GNUmakefile rather than Makefile so rk2 needed to be modified

File size: 19.1 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
57 <!-- unzip expat if the version is less that 2.84 -->
58 <if><bool><and>
59 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
60 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
61 <islessthan arg1="${branch.tag.version}" arg2="2.84"/>
62 </and></bool>
63 <unzip src="${basedir}/compiled/common-src/packages/windows/expat/expat.zip" dest="${basedir}/compiled/common-src/packages/windows/expat"/>
64 </if>
65
66 <unzip src="${basedir}/compiled/common-src/packages/windows/stlport/stlport.zip" dest="${basedir}/compiled/common-src/packages/windows/stlport"/>
67 <unzip src="${basedir}/compiled/common-src/indexers/packages/windows/iconv/iconv.zip" dest="${basedir}/compiled/common-src/indexers/packages/windows/iconv"/>
68 <untar src="${basedir}/compiled/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz" dest="${basedir}/compiled/common-src/packages/sqlite" compression="gzip"/>
69
70 <!-- get winbin from tags if the version is greater than 2.83 otherwise get it from trunk -->
71 <if><bool><not><available file="${basedir}/compiled/bin/windows"/></not></bool>
72 <if><bool><and>
73 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
74 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
75 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
76 </and></bool>
77
78 <exec executable="svn">
79 <arg value="export"/>
80 <arg value="${svn.root}/main/${branch.path}/binaries/windows/bin"/>
81 <arg value="${basedir}/compiled/bin/windows"/>
82 <arg value="-r"/>
83 <arg value="${branch.revision}"/>
84 </exec>
85
86 <else>
87 <exec executable="svn">
88 <arg value="export"/>
89 <arg value="${svn.root}/main/trunk/binaries/windows/bin"/>
90 <arg value="${basedir}/compiled/bin/windows"/>
91 <arg value="-r"/>
92 <arg value="${branch.revision}"/>
93 </exec>
94 </else>
95 </if>
96 </if>
97
98 <!-- insert windows perl -->
99 <unzip src="${rk.home}/shared/windows/perl.zip" dest="compiled/bin/windows"/>
100
101 <exec executable="${basedir}/compiled/bin/windows/gunzip.exe" dir="${basedir}/compiled/runtime-src/packages/apache-httpd">
102 <arg value="-d"/>
103 <arg value="httpd-2.2.11-gs.tar.gz"/>
104 </exec>
105
106 <exec executable="${basedir}/compiled/bin/windows/tar.exe" dir="${basedir}/compiled/runtime-src/packages/apache-httpd">
107 <arg value="-xvf"/>
108 <arg value="httpd-2.2.11-gs.tar"/>
109 </exec>
110
111 <!-- Insert a unique number after every occurrence of the word tempfile to prevent some strange race conditions present on Windows 7 (iuv = InsertUniqueValue) -->
112 <iuv>
113 <fileset dir="${basedir}/compiled/runtime-src/packages/apache-httpd/httpd-2.2.11" includes="**/*.mak"/>
114 <job pattern="tempfile"/>
115 </iuv>
116
117 <rsr>
118 <fileset dir="${basedir}/compiled/runtime-src/packages/apache-httpd/httpd-2.2.11" includes="**/*.mak"/>
119 <job pattern="/MD" replacement="/MT"/>
120 </rsr>
121
122 <!-- compile c code -->
123 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="clean"/></exec>
124 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="APACHE_HTTPD=1"/></exec>
125 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="LOCAL_LIBRARY=1"/></exec>
126 <delete><fileset dir="${basedir}/compiled/apache-httpd" includes="**/*.pdb"/></delete>
127 <mkdir dir="products"/>
128 <copy file="${basedir}/compiled/server.exe" tofile="${basedir}/products/server-${version}.exe"/>
129 <move file="${basedir}/compiled/server.exe" todir="${basedir}/compiled/bin/windows"/>
130
131
132 <!-- linux only -->
133 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
134
135 <!-- add static to configure.in -->
136 <rsr file="${basedir}/compiled/configure.in" pattern="^LDFLAGS=.*$" replacement="LDFLAGS=-static"/>
137 <exec dir="${basedir}/compiled" executable="autoconf" output="${basedir}/compiled/configure">
138 <arg value="configure.in"/>
139 </exec>
140
141 <!-- set environment in packages/configure -->
142 <rsr file="${basedir}/compiled/common-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
143 <rsr file="${basedir}/compiled/build-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
144
145 <!-- run configure -->
146 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
147 <arg line="--enable-apache-httpd"/>
148 <env key="LDFLAGS" value="-static"/>
149 </exec>
150
151 <!-- add -static to makefiles -->
152 <rsr file="${basedir}/compiled/build-src/packages/wv/wv-gs/GNUmakefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static" />
153 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/xlhtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
154 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/ppthtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
155 <rsr file="${basedir}/compiled/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="(-o rtftohtml.{2}EXEEXT.{1})" replacement="$1 -static"/>
156
157 <!-- mac only -->
158 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
159 <!-- run configure -->
160 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
161 <arg line="--enable-apache-httpd"/>
162 </exec>
163
164 <!-- tweak makefiles -->
165 <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"/>
166 <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"/>
167
168 </if></else></if></else></if>
169
170 <!-- mac and linux: compile -->
171 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
172
173 <!-- make -->
174 <exec dir="${basedir}/compiled" executable="make" failonerror="true"/>
175
176 <!-- make install -->
177 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="install"/></exec>
178
179 <!-- make apache-for-dist -->
180 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="apache-for-dist"/></exec>
181
182 <!-- strip executables -->
183 <exec dir="${basedir}/compiled/bin/${os.shell}" executable="find" failonerror="true">
184 <arg line=". ! -name . -type f -maxdepth 1 -exec strip {} &#59;"/>
185 </exec>
186 </if>
187
188 <!-- insert the necessary additional xml parser versions-->
189 <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
190 <!-- Add the 5.6 version if necessary -->
191 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.6"/></not></bool>
192 <copy todir="${basedir}/compiled/perllib/cpan">
193 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.6,perl-5.6/**/*"/>
194 </copy>
195 </if>
196
197 <!-- Add the 5.8 version if necessary -->
198 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.8"/></not></bool>
199 <copy todir="${basedir}/compiled/perllib/cpan">
200 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.8,perl-5.8/**/*"/>
201 </copy>
202 </if>
203
204 <!-- Add the 5.10 version if necessary -->
205 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.10"/></not></bool>
206 <copy todir="${basedir}/compiled/perllib/cpan">
207 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.10,perl-5.10/**/*"/>
208 </copy>
209 </if>
210 </if>
211
212 <!-- compile gli -->
213 <!-- (linux and mac) -->
214 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
215 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makegli.sh"/></exec>
216 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makejar.sh"/></exec>
217 <!-- windows -->
218 <else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
219 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makegli.bat"/></exec>
220 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makejar.bat"/></exec>
221 </if></else></if>
222
223 <delete dir="compiled/gli/jar"/>
224 <delete dir="compiled/gli/classes/org"/>
225 <move file="compiled/gli/GLIServer.jar" todir="compiled/bin/java"/>
226
227 <!-- compile uninstaller -->
228 <antcall target="insert-and-compile-uninstaller" />
229
230 <!-- build demo collection -->
231 <!-- the envs on these execs simulate the environment when you run setup.bat -->
232 <if>
233 <bool>
234 <equals arg1="${rk.os}" arg2="windows"/>
235 </bool>
236
237 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl">
238 <arg line="-S"/>
239 <arg line="bin/script/import.pl demo"/>
240 <env key="GSDLHOME" path="${basedir}/compiled"/>
241 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
242 <env key="GSDLOS" value="windows"/>
243 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
244 </exec>
245 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl">
246 <arg line="-S"/>
247 <arg line="bin/script/buildcol.pl demo"/>
248 <env key="GSDLHOME" path="${basedir}/compiled"/>
249 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
250 <env key="GSDLOS" value="windows"/>
251 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
252 </exec>
253
254 <else>
255 <exec dir="${basedir}/compiled" executable="perl">
256 <arg line="-S"/>
257 <arg line="bin/script/import.pl demo"/>
258 <env key="GSDLHOME" path="${basedir}/compiled"/>
259 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
260 <env key="GSDLOS" value="linux"/>
261 <env key="PATH" path="${basedir}/compiled/bin/linux:${basedir}/compiled/bin/script:${env.PATH}"/>
262 </exec>
263 <exec dir="${basedir}/compiled" executable="perl">
264 <arg line="-S"/>
265 <arg line="bin/script/buildcol.pl demo"/>
266 <env key="GSDLHOME" path="${basedir}/compiled"/>
267 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
268 <env key="GSDLOS" value="linux"/>
269 <env key="PATH" path="${basedir}/compiled/bin/linux:${basedir}/compiled/bin/script:${env.PATH}"/>
270 </exec>
271 </else>
272 </if>
273 <delete dir="${basedir}/compiled/collect/demo/index"/>
274 <move file="${basedir}/compiled/collect/demo/building" tofile="${basedir}/compiled/collect/demo/index"/>
275
276 <!-- delete the source code -->
277 <delete><fileset dir="compiled" includes="Makefile,config.cache,config.h,config.log,stamp-h,config.status"/></delete>
278 <delete dir="compiled/common-src"/>
279 <delete dir="compiled/build-src"/>
280 <delete dir="compiled/runtime-src"/>
281 <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>
282
283 <!-- strip .svn working-copy dirs -->
284 <antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
285
286 <!-- create needed empty files -->
287 <mkdir dir="compiled/tmp"/>
288 <chmod dir="compiled/tmp" perm="a+rwx"/>
289 <echo file="compiled/etc/usage.txt"></echo>
290
291 <!-- windows -->
292 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
293
294 <!-- make a copy of server.exe in the root -->
295 <copy file="compiled/bin/windows/server.exe" tofile="compiled/server.exe"/>
296
297 <!-- delete sourcecode -->
298 <delete dir="${binzip.dir}/common-src"/>
299 <delete dir="${binzip.dir}/build-src"/>
300 <delete dir="${binzip.dir}/runtime-src"/>
301
302 <!-- create simple zipped binary distribution
303 <mkdir dir="distributions"/>
304 <property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
305 <copy todir="${binzip.dir}"><fileset dir="compiled"/></copy>
306 <delete><fileset dir="${binzip.dir}" includes="README*.txt,Uninstall.bat,Uninst.bat,uninst.jar,win32.mak,win32cfg.h,makegs2.bat" excludes="READMEen.txt"/></delete>
307 -->
308
309 <!-- delete unneeded files -->
310 <delete dir="compiled/bin/linux" />
311 <delete><fileset dir="compiled" includes="*.bash,*.sh,*.csh,.gstermrc"/></delete>
312 <delete><fileset dir="compiled/gli" includes="*.sh,*4gs3.bat"/></delete>
313 <delete dir="compiled/autom4te.cache" />
314
315 <!-- linux -->
316 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
317
318 <!-- grab imagemagick and wv binaries -->
319 <delete dir="compiled/bin/linux/imagemagick"/>
320 <delete dir="compiled/bin/linux/wv"/>
321
322 <if><bool><and>
323 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
324 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
325 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
326 </and></bool>
327
328 <exec executable="svn">
329 <arg value="export"/>
330 <arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
331 <arg value="compiled/bin/linux/imagemagick"/>
332 </exec>
333
334 <exec executable="svn">
335 <arg value="export"/>
336 <arg value="${svn.root}/main/${branch.path}/binaries/linux/wv"/>
337 <arg value="compiled/bin/linux/wv"/>
338 </exec>
339
340 <else>
341 <exec executable="svn">
342 <arg value="export"/>
343 <arg value="${svn.root}/main/trunk/binaries/linux/imagemagick"/>
344 <arg value="compiled/bin/linux/imagemagick"/>
345 </exec>
346
347 <exec executable="svn">
348 <arg value="export"/>
349 <arg value="${svn.root}/main/trunk/binaries/linux/wv"/>
350 <arg value="compiled/bin/linux/wv"/>
351 </exec>
352 </else>
353 </if>
354
355 <!-- delete unneeded files -->
356 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,micotest.cpp"/></delete>
357 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
358 <delete><fileset dir="compiled" includes="*.bat"/></delete>
359 <delete dir="compiled/common-src/packages/windows"/>
360 <delete dir="compiled/common-src/indexers/packages/windows"/>
361
362 <!-- mac -->
363 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
364 <!-- grab imagemagick and ghostscript binaries -->
365 <delete dir="compiled/bin/darwin/imagemagick"/>
366 <delete dir="compiled/bin/darwin/ghostscript"/>
367
368 <if><bool><and>
369 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
370 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
371 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
372 </and></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><bool><and>
421 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
422 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
423 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
424 </and></bool>
425 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
426 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
427
428 <else>
429 <get src="${svn.root}/main/trunk/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
430 <get src="${svn.root}/main/trunk/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
431 </else>
432 </if>
433 </if>
434
435 </target>
436
437</project>
Note: See TracBrowser for help on using the repository browser.