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

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

Fixed a bug that prevented the Greenstone 2 stable releases from being correctly generated

File size: 18.3 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 <!-- compile c code -->
106 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="clean"/></exec>
107 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="APACHE_HTTPD=1"/></exec>
108 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="LOCAL_LIBRARY=1"/></exec>
109 <mkdir dir="products"/>
110 <copy file="${basedir}/compiled/server.exe" tofile="${basedir}/products/server-${version}.exe"/>
111 <move file="${basedir}/compiled/server.exe" todir="${basedir}/compiled/bin/windows"/>
112
113
114 <!-- linux only -->
115 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
116
117 <!-- add static to configure.in -->
118 <rsr file="${basedir}/compiled/configure.in" pattern="^LDFLAGS=.*$" replacement="LDFLAGS=-static"/>
119 <exec dir="${basedir}/compiled" executable="autoconf" output="${basedir}/compiled/configure">
120 <arg value="configure.in"/>
121 </exec>
122
123 <!-- set environment in packages/configure -->
124 <rsr file="${basedir}/compiled/common-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
125 <rsr file="${basedir}/compiled/build-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
126
127 <!-- run configure -->
128 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
129 <arg line="--enable-apache-httpd"/>
130 <env key="LDFLAGS" value="-static"/>
131 </exec>
132
133 <!-- add -static to makefiles -->
134 <rsr file="${basedir}/compiled/build-src/packages/wv/wv-gs/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static" />
135 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/xlhtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
136 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/ppthtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
137 <rsr file="${basedir}/compiled/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="(-o rtftohtml.{2}EXEEXT.{1})" replacement="$1 -static"/>
138
139 <!-- mac only -->
140 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
141 <!-- run configure -->
142 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
143 <arg line="--enable-apache-httpd"/>
144 </exec>
145
146 <!-- tweak makefiles -->
147 <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"/>
148 <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"/>
149
150 </if></else></if></else></if>
151
152 <!-- mac and linux: compile -->
153 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
154
155 <!-- make -->
156 <exec dir="${basedir}/compiled" executable="make" failonerror="true"/>
157
158 <!-- make install -->
159 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="install"/></exec>
160
161 <!-- make apache-for-dist -->
162 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="apache-for-dist"/></exec>
163
164 <!-- strip executables -->
165 <exec dir="${basedir}/compiled/bin/${os.shell}" executable="find" failonerror="true">
166 <arg line=". ! -name . -type f -maxdepth 1 -exec strip {} &#59;"/>
167 </exec>
168 </if>
169
170 <!-- insert the necessary additional xml parser versions-->
171 <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
172 <!-- Add the 5.6 version if necessary -->
173 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.6"/></not></bool>
174 <copy todir="${basedir}/compiled/perllib/cpan">
175 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.6,perl-5.6/**/*"/>
176 </copy>
177 </if>
178
179 <!-- Add the 5.8 version if necessary -->
180 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.8"/></not></bool>
181 <copy todir="${basedir}/compiled/perllib/cpan">
182 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.8,perl-5.8/**/*"/>
183 </copy>
184 </if>
185
186 <!-- Add the 5.10 version if necessary -->
187 <if><bool><not><available file="${basedir}/compiled/perllib/cpan/perl-5.10"/></not></bool>
188 <copy todir="${basedir}/compiled/perllib/cpan">
189 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="perl-5.10,perl-5.10/**/*"/>
190 </copy>
191 </if>
192 </if>
193
194 <!-- compile gli -->
195 <!-- (linux and mac) -->
196 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
197 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makegli.sh"/></exec>
198 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makejar.sh"/></exec>
199 <!-- windows -->
200 <else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
201 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makegli.bat"/></exec>
202 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makejar.bat"/></exec>
203 </if></else></if>
204
205 <delete dir="compiled/gli/jar"/>
206 <delete dir="compiled/gli/classes/org"/>
207 <move file="compiled/gli/GLIServer.jar" todir="compiled/bin/java"/>
208
209 <!-- compile uninstaller -->
210 <antcall target="insert-and-compile-uninstaller" />
211
212 <!-- build demo collection -->
213 <!-- the envs on these execs simulate the environment when you run setup.bat -->
214 <if>
215 <bool>
216 <equals arg1="${rk.os}" arg2="windows"/>
217 </bool>
218
219 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl">
220 <arg line="-S"/>
221 <arg line="bin/script/import.pl demo"/>
222 <env key="GSDLHOME" path="${basedir}/compiled"/>
223 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
224 <env key="GSDLOS" value="windows"/>
225 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
226 </exec>
227 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/bin/windows/perl/bin/perl">
228 <arg line="-S"/>
229 <arg line="bin/script/buildcol.pl demo"/>
230 <env key="GSDLHOME" path="${basedir}/compiled"/>
231 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
232 <env key="GSDLOS" value="windows"/>
233 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
234 </exec>
235
236 <else>
237 <exec dir="${basedir}/compiled" executable="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="linux"/>
243 <env key="PATH" path="${basedir}/compiled/bin/linux:${basedir}/compiled/bin/script:${env.PATH}"/>
244 </exec>
245 <exec dir="${basedir}/compiled" executable="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="linux"/>
251 <env key="PATH" path="${basedir}/compiled/bin/linux:${basedir}/compiled/bin/script:${env.PATH}"/>
252 </exec>
253 </else>
254 </if>
255 <delete dir="${basedir}/compiled/collect/demo/index"/>
256 <move file="${basedir}/compiled/collect/demo/building" tofile="${basedir}/compiled/collect/demo/index"/>
257
258 <!-- delete the source code -->
259 <delete><fileset dir="compiled" includes="Makefile,config.cache,config.h,config.log,stamp-h,config.status"/></delete>
260 <delete dir="compiled/common-src"/>
261 <delete dir="compiled/build-src"/>
262 <delete dir="compiled/runtime-src"/>
263 <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>
264
265 <!-- strip .svn working-copy dirs -->
266 <antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
267
268 <!-- create needed empty files -->
269 <mkdir dir="compiled/tmp"/>
270 <chmod dir="compiled/tmp" perm="a+rwx"/>
271 <echo file="compiled/etc/usage.txt"></echo>
272
273 <!-- windows -->
274 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
275
276 <!-- make a copy of server.exe in the root -->
277 <copy file="compiled/bin/windows/server.exe" tofile="compiled/server.exe"/>
278
279 <!-- delete sourcecode -->
280 <delete dir="${binzip.dir}/common-src"/>
281 <delete dir="${binzip.dir}/build-src"/>
282 <delete dir="${binzip.dir}/runtime-src"/>
283
284 <!-- create simple zipped binary distribution
285 <mkdir dir="distributions"/>
286 <property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
287 <copy todir="${binzip.dir}"><fileset dir="compiled"/></copy>
288 <delete><fileset dir="${binzip.dir}" includes="README*.txt,Uninstall.bat,Uninst.bat,uninst.jar,win32.mak,win32cfg.h,makegs2.bat" excludes="READMEen.txt"/></delete>
289 -->
290
291 <!-- delete unneeded files -->
292 <delete dir="compiled/bin/linux" />
293 <delete><fileset dir="compiled" includes="*.bash,*.sh,*.csh,.gstermrc"/></delete>
294 <delete><fileset dir="compiled/gli" includes="*.sh,*4gs3.bat"/></delete>
295 <delete dir="compiled/autom4te.cache" />
296
297 <!-- linux -->
298 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
299
300 <!-- grab imagemagick and wv binaries -->
301 <delete dir="compiled/bin/linux/imagemagick"/>
302 <delete dir="compiled/bin/linux/wv"/>
303
304 <if>
305 <bool>
306 <and>
307 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
308 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
309 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
310 </and>
311 </bool>
312
313 <exec executable="svn">
314 <arg value="export"/>
315 <arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
316 <arg value="compiled/bin/linux/imagemagick"/>
317 </exec>
318
319 <exec executable="svn">
320 <arg value="export"/>
321 <arg value="${svn.root}/main/${branch.path}/binaries/linux/wv"/>
322 <arg value="compiled/bin/linux/wv"/>
323 </exec>
324
325 <else>
326 <exec executable="svn">
327 <arg value="export"/>
328 <arg value="${svn.root}/main/trunk/binaries/linux/imagemagick"/>
329 <arg value="compiled/bin/linux/imagemagick"/>
330 </exec>
331
332 <exec executable="svn">
333 <arg value="export"/>
334 <arg value="${svn.root}/main/trunk/binaries/linux/wv"/>
335 <arg value="compiled/bin/linux/wv"/>
336 </exec>
337 </else>
338 </if>
339
340 <!-- delete unneeded files -->
341 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,micotest.cpp"/></delete>
342 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
343 <delete><fileset dir="compiled" includes="*.bat"/></delete>
344 <delete dir="compiled/common-src/packages/windows"/>
345 <delete dir="compiled/common-src/indexers/packages/windows"/>
346
347 <!-- mac -->
348 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
349 <!-- grab imagemagick and ghostscript binaries -->
350 <delete dir="compiled/bin/darwin/imagemagick"/>
351 <delete dir="compiled/bin/darwin/ghostscript"/>
352
353 <if>
354 <bool>
355 <and>
356 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
357 <not><equals arg1="${branch.path}" arg2="tags/stable"/></not>
358 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
359 </and>
360 </bool>
361
362 <exec executable="svn">
363 <arg value="export"/>
364 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/imagemagick"/>
365 <arg value="compiled/bin/darwin/imagemagick"/>
366 </exec>
367
368 <exec executable="svn">
369 <arg value="export"/>
370 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/ghostscript"/>
371 <arg value="compiled/bin/darwin/ghostscript"/>
372 </exec>
373
374 <else>
375 <exec executable="svn">
376 <arg value="export"/>
377 <arg value="${svn.root}/main/trunk/binaries/mac/intel/imagemagick"/>
378 <arg value="compiled/bin/darwin/imagemagick"/>
379 </exec>
380
381 <exec executable="svn">
382 <arg value="export"/>
383 <arg value="${svn.root}/main/trunk/binaries/mac/intel/ghostscript"/>
384 <arg value="compiled/bin/darwin/ghostscript"/>
385 </exec>
386 </else>
387 </if>
388
389 <!-- delete unneeded files -->
390 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,*.bat"/></delete>
391 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
392 <delete dir="compiled/common-src/packages/windows"/>
393
394 </if></else></if></else></if>
395
396 <!-- delete unneeded files -->
397 <delete dir="compiled/uninstaller" />
398 <delete file="compiled/bin/java/SignedGatherer.jar" />
399
400 <!-- tidy up gli -->
401 <antcall target="gli-tidy-for-dist"><param name="glibasedir" value="compiled/gli"/></antcall>
402
403 <!-- mac and linux: insert export to cdrom package -->
404 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
405 <mkdir dir="compiled/bin/windows"/>
406 <get src="${server.exe.location}" dest="compiled/bin/windows/server.exe"/>
407
408 <if>
409 <bool>
410 <and>
411 <not><equals arg1="${branch.path}" arg2="trunk"/></not>
412 <isgreaterthan arg1="${branch.tag.version}" arg2="2.83"/>
413 </and>
414 </bool>
415
416 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
417 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
418
419 <else>
420 <get src="${svn.root}/main/trunk/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
421 <get src="${svn.root}/main/trunk/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
422 </else>
423 </if>
424 </if>
425
426 </target>
427
428</project>
Note: See TracBrowser for help on using the repository browser.