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

Last change on this file since 22160 was 22160, checked in by sjm84, 11 years ago

Versions less than 2.84 now have apache manually extracted

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