source: main/trunk/release-kits/kits/rk3/ant-scripts/compile.xml

Last change on this file was 38335, checked in by kjdon, 6 months ago

the change to specific.os.type to switch between Lion and Mojave downloads of gnome-lib meant that on linux, it was looking for linux-Mojave version. fixed.

File size: 17.0 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="rk3-compile">
3
4
5 <target name="compile">
6
7 <!-- checkout greenstone3 -->
8 <exec executable="svn">
9 <arg line="${global-svn-args}"/>
10 <arg value="checkout"/>
11 <arg value="${svn.root}/main/${branch.path}/greenstone3"/>
12 <arg value="compiled"/>
13 <arg value="-r"/><arg value="${branch.revision}"/>
14 </exec>
15
16 <!-- Comment out any active checkout.gnomelib.ext=true line in build.properties.svn
17 So that the release-kits go back to behaving how they did when the line
18 used to be commented out by default in build properties.
19 For alternative ways to achieve this, see
20 https://jeeva-paramasamy.blogspot.com/2012/07/removeunset-property-in-property-file.html
21 Further options in the propertyfile task https://ant.apache.org/manual/Tasks/propertyfile.html
22 -->
23 <!--<if><bool><equals arg1="${checkout.gnomelib.ext}" arg2="true"/></bool>-->
24 <echo>Release-kit is running, which turns on use.gnomelib.ext, so commenting out checkout.gnomelib.ext=true to deactivate it.</echo>
25 <rsr file="${basedir}/compiled/build.properties.svn" pattern="checkout.gnomelib.ext=true" replacement="#checkout.gnomelib.ext=true"/>
26 <!--</if>-->
27
28 <if><bool><equals arg1="${with.jni}" arg2="false"/></bool>
29 <rsr file="${basedir}/compiled/build.properties.svn" pattern="with.jni=true" replacement="#with.jni=true"/>
30 </if>
31
32 <if><bool><equals arg1="${with.gli.and.gems}" arg2="false"/></bool>
33 <rsr file="${basedir}/compiled/build.properties.svn" pattern="with.gli.and.gems=true" replacement="#with.gli.and.gems=true"/>
34 </if>
35
36 <!-- make sure all c++ compilation is done statically on linux -->
37 <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
38 <property name="forward.compile.static" value="true"/>
39 </if>
40
41 <!-- make sure the c++ compilation can see the support library in the extension folder -->
42 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
43 <property name="forward.use.gnomelib.ext" value="true"/>
44 </if>
45
46 <antcall target="persist-forwarded-properties">
47 <param name="greenstone3basedir" value="compiled"/>
48 </antcall>
49
50 <!-- run greenstone3's ant prepare -->
51 <ant dir="compiled" inheritAll="false">
52 <target name="prepare"/>
53 <propertyset refid="forward.properties"/>
54 <property name="properties.accepted" value="true"/>
55 <property name="global-svn-args" value="${global-svn-args}"/>
56 </ant>
57
58 <!-- set all version numbers -->
59 <antcall target="greenstone3-set-version-numbers"><param name="greenstone3basedir" value="compiled"/></antcall>
60 <antcall target="gli-set-version-numbers"><param name="glibasedir" value="compiled/gli"/></antcall>
61 <antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="compiled/gs2build"/></antcall>
62
63 <!-- mac or linux: compile the support library -->
64 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
65 <!-- checkout the gnome support library extension-->
66
67 <!-- For Lions, need a specific gnome-lib-minimal tar file. The file name contains darwin12 for Lion, it contains the os.shell name (darwin/linux) for other cases.
68 Mac OS X v10.7.4 onwards is Lion/Mountain Lion, different from Leopard/Snow Leopard. See http://en.wikipedia.org/wiki/Darwin_(operating_system) -->
69 <if>
70 <bool>
71 <contains string="${os.shell}" substring="darwin" casesensitive="false"/>
72 </bool>
73 <condition property="specific.os.type" value="${os.shell}-Lion" else="${os.shell}-Mojave">
74 <matches pattern="^(10\.7\.[4-9]|10\.[8-9]|1[1-9]|[2-9])" string="${os.version}"/>
75 </condition>
76 <else>
77 <!-- not a mac-->
78 <property name="specific.os.type" value="${os.shell}"/>
79 </else>
80 </if>
81 <if><bool><or>
82 <equals arg1="${post.2.83.version}" arg2="true"/>
83 </or></bool>
84 <echo>EXPORTING GNOME LIB EXTENSION</echo>
85 <exec executable="svn">
86 <arg line="${global-svn-args}"/>
87 <arg value="export"/>
88 <arg value="${svn.root}/gs2-extensions/gnome-lib/trunk/gnome-lib-minimal-${specific.os.type}${arch}${extension-x64}.tar.gz"/>
89 <arg value="${basedir}/compiled/ext/gnome-lib-${specific.os.type}.tar.gz"/>
90 </exec>
91
92 <exec executable="tar" dir="${basedir}/compiled/ext">
93 <arg value="xvzf"/>
94 <arg value="gnome-lib-${specific.os.type}.tar.gz"/>
95 </exec>
96
97 <exec executable="/bin/bash" dir="${basedir}/compiled/ext/gnome-lib-minimal">
98 <arg value="-c"/>
99 <arg value="source setup.bash_old &amp;&amp; source devel.bash"/>
100 </exec>
101 <echo>DONE COMPILING GNOME LIB EXTENSION</echo>
102 </if>
103 </if>
104
105 <!-- <rsr file="${basedir}/compiled/build.xml" pattern="CFLAGS=&amp;quot;" replacement="CFLAGS=&amp;quot;-fPIC "/> -->
106 <!-- mac only: make errors about missing extern declarations back into warnings as in old (Mojave and before) macs -->
107 <!--
108 <if>
109 <bool><equals arg1="${rk.os}" arg2="mac"/></bool>
110 <rsr file="${basedir}/compiled/build.xml" pattern="CFLAGS=&amp;quot;" replacement="CFLAGS=&amp;quot;-Wno-error=implicit-function-declaration "/>
111 </if>
112 -->
113
114 <!-- run greenstone3's ant install and ant dist-tidy -->
115 <ant dir="compiled" inheritAll="false">
116 <target name="install"/>
117 <target name="dist-tidy"/>
118 <propertyset refid="forward.properties"/>
119 <property name="properties.accepted" value="true"/>
120 <property name="properties.keep.src" value="${keep.src}"/>
121 <property name="global-svn-args" value="${global-svn-args}"/>
122 </ant>
123
124 <!-- Delete all collections apart from the Lucene demo collection -->
125 <delete dir="${basedir}/compiled/web/sites/localsite/collect/gberg"/>
126 <delete dir="${basedir}/compiled/web/sites/localsite/collect/gs2mgdemo"/>
127 <delete dir="${basedir}/compiled/web/sites/localsite/collect/gs2mgppdemo"/>
128 <delete dir="${basedir}/compiled/web/sites/localsite/collect/infomine"/>
129
130 <!-- Delete the entire gnome support library on Linux -->
131 <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
132 <delete dir="${basedir}/compiled/ext/gnome-lib-minimal"/>
133 <delete file="${basedir}/compiled/ext/gnome-lib-linux.tar.gz"/>
134 </if>
135
136 <!-- Delete all but the lib folder of the gnome support library on Mac,
137 then move this smaller gnome-lib-minimal dir from the top-level ext folder
138 to gs2build/ext, since wvware on mac needs gnome-lib-minimal -->
139 <if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
140 <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/cascade-make"/>
141 <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/packages"/>
142 <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/darwin/bin"/>
143 <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/darwin/etc"/>
144 <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/darwin/include"/>
145 <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/darwin/share"/>
146 <delete file="${basedir}/compiled/ext/gnome-lib-minimal/setup.bat"/>
147 <delete file="${basedir}/compiled/ext/gnome-lib-minimal/CASCADE-MAKE.sh"/>
148 <delete file="${basedir}/compiled/ext/gnome-lib-darwin.tar.gz"/>
149 <move file="${basedir}/compiled/ext/gnome-lib-minimal" todir="compiled/gs2build/ext"/>
150 </if>
151
152 <!-- Delete Lucene 3.3 specific ext/solr folders, since we've switched over to Lucene 4.7.2 -->
153 <delete dir="${basedir}/compiled/ext/solr/lib3" />
154 <delete dir="${basedir}/compiled/ext/solr/conf3" />
155 <delete dir="${basedir}/compiled/ext/solr/etc3" />
156
157
158 <if><bool><and>
159 <equals arg1="${rk.os}" arg2="linux"/>
160 <equals arg1="${extension-x64}" arg2="-x64"/>
161 </and></bool>
162 <property name="bitness" value="64"/>
163 <else>
164 <property name="bitness" value="32"/>
165 </else>
166 </if>
167
168 <!-- insert an xml parser (matched to the version of Perl being used by the release kit).
169 For Linux 64 bit, use the 64 bit versions.
170 For other *nix cases, including Macs, we stick to the 32 bit
171 versions since there have been no problems yet, probably
172 because our Mac has 5.12 which is not included in
173 XML-Parser so that our mac then tries to find the xml
174 parser on the system.-->
175 <if><bool><not><equals arg1="${rk.os}" arg2="windows"/></not></bool>
176 <copy todir="compiled/gs2build/perllib/cpan">
177 <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="${bitness}-bit/**/*"/>
178 </copy>
179 <move file="compiled/gs2build/perllib/cpan/${bitness}-bit" tofile="compiled/gs2build/perllib/cpan/XML-Parser"/>
180 </if>
181
182 <!-- insert ant -->
183 <property name="insert.ant.version" value="1.9.13"/> <!-- value="1.8.2" -->
184 <mkdir dir="compiled/packages"/>
185 <!--<get src="http://www.greenstone.org/gs3files/apache-ant-${insert.ant.version}-bin.tar.gz" dest="compiled/packages/apache-ant-${insert.ant.version}-bin.tar.gz"/>-->
186 <exec executable="wget" failonerror="true">
187 <arg value="-P"/>
188 <arg value="compiled/packages"/>
189 <arg value="--no-check-certificate"/>
190 <arg value="https://www.greenstone.org/gs3files/apache-ant-${insert.ant.version}-bin.tar.gz"/>
191 </exec>
192 <untar src="compiled/packages/apache-ant-${insert.ant.version}-bin.tar.gz" dest="compiled/packages/" compression="gzip"/>
193 <move file="compiled/packages/apache-ant-${insert.ant.version}" tofile="compiled/packages/ant"/>
194 <delete file="compiled/packages/apache-ant-${insert.ant.version}-bin.tar.gz"/>
195
196 <!-- put the uninstaller in place -->
197 <antcall target="insert-and-compile-uninstaller"/>
198
199 <!-- (windows only) -->
200 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
201 <!-- insert perl -->
202 <!--<unzip src="${rk.home}/shared/windows/perl.zip" dest="compiled/gs2build/bin/windows"/>-->
203 <exec executable="svn" dir="compiled/gs2build/bin/windows">
204 <arg line="${global-svn-args}"/>
205 <arg value="export"/>
206 <arg value="${svn.root}/main/trunk/release-kits/shared/windows/perl.zip"/>
207 </exec>
208 <unzip src="compiled/gs2build/bin/windows/perl.zip" dest="compiled/gs2build/bin/windows"/>
209 <delete failonerror="false" file="compiled/gs2build/bin/windows/perl.zip" />
210 </if>
211
212 <!-- minify tomcat -->
213 <delete dir="compiled/packages/tomcat/webapps/docs"/>
214 <delete dir="compiled/packages/tomcat/webapps/examples"/>
215
216 <!-- tidy up gli to make it smaller -->
217 <antcall target="gli-tidy-for-dist"><param name="glibasedir" value="compiled/gli"/></antcall>
218
219 <!-- strip out .svn dirs -->
220 <antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
221
222 <!-- get rid of bin/formatconverter on windows and get rid of bin/formatconverter.exe on linux/mac. Now we have specific OS dirs, so get rid of the irrelevant OS dirs instead -->
223 <if>
224 <bool><equals arg1="${rk.os}" arg2="windows"/></bool>
225 <delete dir="compiled/bin/darwin"/>
226 <delete dir="compiled/bin/linux"/>
227 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
228 <delete dir="compiled/bin/windows"/>
229 <delete dir="compiled/bin/linux"/>
230 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
231 <delete dir="compiled/bin/windows"/>
232 <delete dir="compiled/bin/darwin"/>
233 </if></else>
234 </if></else>
235 </if>
236
237 <!-- (linux only) -->
238 <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
239 <!-- grab imagemagick binaries -->
240 <delete dir="compiled/gs2build/bin/linux/imagemagick"/>
241
242 <exec executable="svn">
243 <arg line="${global-svn-args}"/>
244 <arg value="export"/>
245 <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/imagemagick-linux${extension-x64}.tar.gz"/>
246 <arg value="compiled/ext/imagemagick-linux${extension-x64}.tar.gz"/>
247 </exec>
248
249 <exec executable="tar" dir="compiled/ext">
250 <arg value="xvzf"/>
251 <arg value="imagemagick-linux${extension-x64}.tar.gz"/>
252 </exec>
253 <delete file="compiled/ext/imagemagick-linux${extension-x64}.tar.gz"/>
254 <move todir="compiled/gs2build/bin/linux/imagemagick">
255 <fileset dir="compiled/ext/imagemagick/linux"/>
256 </move>
257 <delete dir="compiled/ext/imagemagick"/>
258
259 <!--<delete dir="compiled/gs2build/bin/linux/imagemagick"/>
260 <exec executable="svn">
261 <arg line="${global-svn-args}"/>
262 <arg value="export"/>
263 <arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
264 <arg value="compiled/gs2build/bin/linux/imagemagick"/>
265 </exec>-->
266
267 <!-- We don't want to bundle the old pre-compiled 32 bit wv folder anymore -->
268 <!-- grab wv binaries -->
269 <!--<delete dir="compiled/gs2build/bin/linux/wv"/>
270 <exec executable="svn">
271 <arg line="${global-svn-args}"/>
272 <arg value="export"/>
273 <arg value="${svn.root}/main/${branch.path}/binaries/linux/wv"/>
274 <arg value="compiled/gs2build/bin/linux/wv"/>
275 </exec>
276 -->
277 <!-- (mac only) -->
278 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
279 <!-- grab imagemagick binaries -->
280
281 <delete dir="compiled/gs2build/bin/darwin/imagemagick"/>
282 <!-- before mojave -->
283 <!--<property name="darwin-imagick-tarball" value="imagemagick-darwin-10.5.tar.gz"/>-->
284 <!-- mojave onwards -->
285 <property name="darwin-imagick-tarball" value="imagemagick-darwin-10.11.tar.gz"/>
286 <exec executable="svn">
287 <arg line="${global-svn-args}"/>
288 <arg value="export"/>
289 <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/${darwin-imagick-tarball}"/>
290 <arg value="compiled/ext/${darwin-imagick-tarball}"/>
291 </exec>
292
293 <exec executable="tar" dir="compiled/ext">
294 <arg value="xvzf"/>
295 <arg value="${darwin-imagick-tarball}"/>
296 </exec>
297 <delete file="compiled/ext/${darwin-imagick-tarball}"/>
298 <move todir="compiled/gs2build/bin/darwin/imagemagick">
299 <fileset dir="compiled/ext/imagemagick/darwin"/>
300 </move>
301 <delete dir="compiled/ext/imagemagick"/>
302
303
304 <!--
305 <delete dir="compiled/gs2build/bin/darwin/imagemagick"/>
306 <exec executable="svn">
307 <arg line="${global-svn-args}"/>
308 <arg value="export"/>
309 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/imagemagick"/>
310 <arg value="compiled/gs2build/bin/darwin/imagemagick"/>
311 </exec>-->
312
313 <if><bool><not><equals arg1="${forward.install.flax}" arg2="true"/></not></bool>
314 <!-- grab ghostscript binaries -->
315 <delete dir="compiled/gs2build/bin/darwin/ghostscript"/>
316 <exec executable="svn">
317 <arg line="${global-svn-args}"/>
318 <arg value="export"/>
319 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/ghostscript"/>
320 <arg value="compiled/gs2build/bin/darwin/ghostscript"/>
321 </exec>
322 </if>
323 </if></else></if>
324
325 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
326 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/gs2build/bin/windows/perl/bin/perl">
327 <arg line="-S"/>
328 <arg line="gs2build/bin/script/import.pl -removeold -site localsite lucene-jdbm-demo"/>
329 <env key="GSDLHOME" path="${basedir}/compiled/gs2build"/>
330 <env key="GSDL3HOME" path="${basedir}/compiled/web"/>
331 <env key="GSDL3SRCHOME" path="${basedir}/compiled"/>
332 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/web/sites/localsite/collect"/>
333 <env key="GSDLOS" value="windows"/>
334 <env key="PERL_PERTURB_KEYS" value="0"/>
335 <env key="PERL_HASH_SEED" value="0"/>
336 <env key="PATH" path="${basedir}/compiled/gs2build/bin/windows/perl/bin;${basedir}/compiled/gs2build/bin/windows;${basedir}/compiled/gs2build/bin/script;${env.PATH}"/>
337 </exec>
338 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/gs2build/bin/windows/perl/bin/perl">
339 <arg line="-S"/>
340 <arg line="gs2build/bin/script/buildcol.pl -removeold -site localsite lucene-jdbm-demo"/>
341 <env key="GSDLHOME" path="${basedir}/compiled/gs2build"/>
342 <env key="GSDL3HOME" path="${basedir}/compiled/web"/>
343 <env key="GSDL3SRCHOME" path="${basedir}/compiled"/>
344 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/web/sites/localsite/collect"/>
345 <env key="GSDLOS" value="windows"/>
346 <env key="PERL_PERTURB_KEYS" value="0"/>
347 <env key="PERL_HASH_SEED" value="0"/>
348 <env key="PATH" path="${basedir}/compiled/gs2build/bin/windows/perl/bin;${basedir}/compiled/gs2build/bin/windows;${basedir}/compiled/gs2build/bin/script;${env.PATH}"/>
349 </exec>
350 <delete dir="${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/index"/>
351 <move file="${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/building" tofile="${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/index"/>
352 <else>
353 <echo file="${basedir}/compiled/buildscript.sh">
354 #!/bin/bash
355 source gs3-setup.sh
356 /usr/bin/perl -S ${basedir}/compiled/gs2build/bin/script/import.pl -site localsite lucene-jdbm-demo
357 /usr/bin/perl -S ${basedir}/compiled/gs2build/bin/script/buildcol.pl -site localsite lucene-jdbm-demo
358 rm -rf ${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/index
359 mv ${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/building ${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/index
360 </echo>
361 <chmod perm="775" file="${basedir}/compiled/buildscript.sh"/>
362 <exec dir="${basedir}/compiled" executable="/bin/bash">
363 <arg line="buildscript.sh"/>
364 </exec>
365 <delete file="${basedir}/compiled/buildscript.sh"/>
366 </else>
367 </if>
368
369 </target>
370
371</project>
Note: See TracBrowser for help on using the repository browser.