source: main/trunk/greenstone3/build.xml@ 32560

Last change on this file since 32560 was 32496, checked in by ak19, 6 years ago

Getting the GS3 target for compiling build-src to actually build Crypt::LE on mac requires GSDLOS to be set and passed into build-src/packages for its make install phase

File size: 187.4 KB
RevLine 
[15124]1<?xml version="1.0"?>
2<!-- ======================================================================
3 March 2005
4
5 Greenstone3 build and install script
6
7 kjdon
8 ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
[20241]10 <echo>os.name: ${os.name}</echo>
[15124]11
[15799]12 <!-- ============ classpath =================== -->
13 <path id="project.classpath">
14 <fileset dir="lib/java">
15 <include name="**/*.jar"/>
16 </fileset>
17 </path>
18
19 <!-- ============ self defined tasks =================== -->
20 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
21 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
[19930]22 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
[21196]23 <!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>-->
[15799]24 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
[26115]25 <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" classpathref="project.classpath"/>
[23854]26 <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
27
[19930]28
[15799]29 <!-- ===================== Property Definitions =========================== -->
30
31 <!--
[15124]32
33 Each of the following properties are used in the build script.
34 Values for these properties are set by the first place they are
35 defined, from the following list:
36
37 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
38
39 * Definitions from a "build.properties" file in the top level
[15799]40 source directory of this application.
[15124]41
42 * Definitions from a "build.properties" file in the user's
[15799]43 home directory.
[15124]44
45 * Default definitions in this build.xml file.
46
47 You will note below that property values can be composed based on the
48 contents of previously defined properties. This is a powerful technique
49 that helps you minimize the number of changes required when your development
50 environment is modified. Note that property composition is allowed within
51 "build.properties" files as well as in the "build.xml" script.
52
[15799]53 -->
[32356]54
55 <!-- Developer property. Set value=true if you want test https certificates issued
56 (as there's a limit on how many real certificates you can be issued per week).
57 If not testing can either uncomment this property or set value=false.
[32383]58 BEWARE: iff test.mode is true (so https.testing gets set to minus-minus-staging)
[32429]59 AND the default protocol is https (server.protocols contains https first), the
60 check-tomcat-running target and any other targets running an ant http condition
61 to test the default GS DL URL (which will be over https) won't work.
62 This is because the testing certificate is not trusted by clients, in this case
63 the ant http condition. (Clients that are browsers can be set to temporarily
64 trust the testing certificate, but don't know how to make ant do that, maybe it
65 needs to be done at Java level.)
[32383]66 Ant socket conditions to the URL will work because socket tests don't use
67 the protocol, just the host and port.
[32356]68 -->
[32350]69 <property name="https.test.mode" value="false"/>
[32482]70 <property name="sudo.or.not" value="/bin/bash"/><!-- by default, we don't run even special commands with sudo -->
[18227]71
[27834]72 <property name="os.linux" value="Linux"/>
73 <property name="os.mac" value="Mac OS X"/>
74 <property name="os.solaris" value="SunOS"/>
75 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
[28042]76 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2"/> <!-- check this!!!-->
[27834]77
78 <!-- this is true for linux and macs -->
79 <condition property="current.os.isunix">
80 <os family="unix"/>
81 </condition>
82
83 <condition property="current.os.isunixnotmac">
84 <and>
85 <os family="unix"/>
86 <not>
87 <os family="mac"/>
88 </not>
89 </and>
90 </condition>
91
92 <condition property="current.os.ismac">
93 <os family="mac"/>
94 </condition>
95
96 <condition property="current.os.iswindows">
97 <os family="windows"/>
98 </condition>
99
[18227]100 <!-- create build.properties if it has not been created yet -->
101 <if>
102 <bool><not><available file="build.properties"/></not></bool>
[32310]103 <copy file="build.properties.svn" tofile="build.properties"/>
[32370]104 <property name="first.run" value="true"/>
[18227]105 </if>
106
[18515]107 <!-- create the packages dir if it has not been created yet -->
108 <mkdir dir="packages"/>
[15799]109
[15859]110 <!--the first three properties have to be put on the top to be used by build.properties-->
[19960]111 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
[15124]112 <property name="src.packages.home" value="${basedir}/src/packages"/>
[15859]113 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
[19878]114
[27860]115 <property name="solr-ext.home" value="${basedir}/ext/solr"/>
116
[15124]117 <property file="build.properties"/>
[16962]118 <if><bool><available file="${user.home}/build.properties"/></bool>
119 <property file="${user.home}/build.properties"/>
120 </if>
[15124]121
[32429]122 <if>
123 <bool><not><matches string="${server.protocols}" pattern="^\s*(https?|http\s*,\s*https|https\s*,\s*http)\s*$"/></not></bool>
124 <fail>@@@@
125 In file build.properties: invalid value for server.protocols.
126 It must contain http or https, or both (in order of preference) separated by commas.
127 </fail>
128 </if>
[32334]129
[32429]130 <!--
[32355]131 * "valid ports range from 1024–49151" is probably about user assignable ports.
132 But 80 is a valid port for running web servers including GS
133 and in future the range may become greater, so don't restrict the port range to 1024-49151.
[32334]134 https://stackoverflow.com/questions/113224/what-is-the-largest-tcp-ip-network-port-number-allowable-for-ipv4
135 -->
136 <if>
137 <bool>
[32429]138 <not><matches string="${localhost.port.http}" pattern="^\d{2,}\s*$"/></not>
[32334]139 </bool>
[32339]140 <fail>...
[32429]141 ********* ERROR: localhost.port.http in file build.properties is set to an invalid port number.
[32355]142 If port 80 is not possible, user assignable ports range from 1024–49151.
143 But don't choose any port already in use by another application.
[32429]144 Try setting to localhost.port.http=8383
[32339]145 </fail>
[32334]146 </if>
147
[32429]148 <!-- if server.protocols contains https, ensure its port number is valid -->
[32339]149 <if>
150 <bool>
151 <and>
[32429]152 <matches string="${server.protocols}" pattern="https"/>
[32355]153 <not><matches string="${tomcat.port.https}" pattern="^\d{2,}\s*$"/></not>
[32339]154 </and>
155 </bool>
156 <fail>...
[32429]157 ********* ERROR: in file build.properties, server.protocols includes https but
158 tomcat.port.https is set to an invalid port number.
[32427]159 If port 443 is not possible, user assignable ports range from 1024–49151.
[32355]160 But don't choose any port already in use by another application.
[32339]161 Try setting tomcat.port.https=8443
162 </fail>
163 </if>
164
[32340]165 <!--
[32346]166 Bail if https is enabled but the keystore password (keystore.pass property) is not set.
[32429]167 However, keystore.pass has no default value and is therefore not set as a rule.
168 So don't bail when 'ant' is run for the first time to create build.props from build.props.svn.
169 But do bail if running ant.prepare and https enabled and password not set.
170 (Maybe put this entire section before the first target: so we only bail after all non-targets
171 are executed so that any other first ever initialisation is completed?)
[32346]172 -->
173 <if>
174 <bool>
175 <and>
[32429]176 <matches string="${server.protocols}" pattern="https"/>
[32346]177 <or>
178 <not><isset property="keystore.pass"/></not>
179 <matches string="${keystore.pass}" pattern="^\s*$"/>
180 </or>
181 </and>
182 </bool>
183 <if>
184 <bool><isset property="first.run"/></bool>
[32429]185 <echo>IMPORTANT: In file build.properties, when property server.protocols includes https,
186 as now, the keystore.pass property must be set to a non-empty value.
187 Either set server.protocols to http by itself, if you don't want support for https,
188 or set keystore.pass if you do want https support.</echo>
[32346]189 <else>
190 <fail>...
[32429]191 ********* ERROR: server.protocols contains https in file build.properties, but the keystore.pass
192 property required for obtaining/renewing the https certificate is not set or is set to the empty
193 string. Choose a password for keystore.pass and set it in build.properties before proceeding.
[32346]194 </fail>
195 </else>
196 </if>
197 </if>
198
[32429]199 <!-- Set the keystore file name for linux versus windows. Ultimately unused/inactive if HTTPS
200 isn't enabled and no certificate obtained. We don't yet have https certification on mac -->
201 <condition property="keystore.file" value="fullchain_and_prvtkey.pfx" else="fullchain_and_prvtkey.p12">
202 <istrue value="${current.os.iswindows}"/>
203 </condition>
204
205 <!-- Originally, https redirectPort when using regular http port 8383
206 was always fixed at 8443. Now we use redirectPort=tomcat.port.https.
[32340]207 -->
[32429]208 <property name="https.redirect.port" value="${tomcat.port.https}"/>
209
210 <!-- The default protocol to be used is the FIRST in the comma separated list for server.protocols
211 The default public tomcat port depends on the default server protocol
[32339]212 -->
213 <if>
[32429]214 <bool><matches string="${server.protocols}" pattern="^https"/></bool>
215 <property name="default.server.protocol" value="https"/>
216 <property name="default.tomcat.port" value="${tomcat.port.https}"/>
217 <else>
218 <property name="default.server.protocol" value="http"/>
219 <property name="default.tomcat.port" value="${localhost.port.http}"/>
220 </else>
[32339]221 </if>
[32429]222
[32339]223
[32429]224 <!-- For setting filter tokens.
225 Used to set up server.xml when configuring tomcat -->
226 <property name="comment.start" value="&lt;!--" />
227 <property name="comment.end" value="--&gt;" />
[32359]228
[32429]229 <!--
230 If https is enabled, regardless of whether it is the default protocol,
231 there's some more work to do:
232 -
233 - if https is not enabled, comment out its Connecter element in server.xml
234 -->
235 <if>
236 <bool><matches string="${server.protocols}" pattern="https"/></bool>
237 <property name="https.comment.out.start" value=""/>
238 <property name="https.comment.out.end" value=""/>
[32334]239
[32429]240 <else>
241 <property name="https.comment.out.start" value="${comment.start}"/>
242 <property name="https.comment.out.end" value="${comment.end}"/>
243 </else>
244 </if>
[32339]245
[32429]246 <!-- if server.protocols doesn't contain http, then http is only to be locally available,
247 e.g. for solr servlet on 127.0.0.1
248 In that case, see https://serverfault.com/questions/218666/how-to-configure-tomcat-to-only-listen-to-127-0-0-1
249 -->
250 <condition property="restrict.http.to.local" value="false" else="true">
251 <matches string="${server.protocols}" pattern="http($|\s+|,)"/>
252 </condition>
253
254 <condition property="http.address.restriction" value="address=&quot;127.0.0.1&quot;" else="">
255 <istrue value="${restrict.http.to.local}"/>
256 </condition>
[32346]257
[32429]258 <!-- No certificates for localhost: https://letsencrypt.org/docs/certificates-for-localhost/
259 But 'localhost' (or actually, 127.0.0.1) needed for solr: solr servlet not accessible to outside world
260 -->
[32432]261 <condition property="local.http.url" value="http://${localhost.server.http}" else="http://${localhost.server.http}:${localhost.port.http}">
262 <equals arg1="${localhost.port.http}" arg2="80" trim="true"/>
263 </condition>
[32429]264
[32416]265 <!-- On linux, if testing https certification, pass in minus-minus-staging. If not testing on linux, nothing extra to pass in.
[32482]266 On windows or mac, if testing https certification, nothing extra to pass in. If not testing on windows or mac, pass in minus-minus-live.
[32416]267 -->
268 <if><bool><istrue value="${current.os.isunixnotmac}"/></bool>
269 <condition property="https.testing" value="" else="--staging">
270 <isfalse value="${https.test.mode}"/>
271 </condition>
272 </if>
[32482]273 <if><bool><or><istrue value="${current.os.iswindows}"/><istrue value="${current.os.ismac}"/></or></bool>
[32416]274 <condition property="https.testing" value="--live" else="">
275 <isfalse value="${https.test.mode}"/>
276 </condition>
[32421]277 <!-- Set bitness of windows OS, so we can use it for the zeroSSL executable.
278 The Java system property os.arch will return x86 for 32 bit and AMD64 (or x64) for 64 bit OS.
279 See https://stackoverflow.com/questions/20856694/how-to-find-the-os-bit-type -->
280 <condition property="os.bitness" value="64" else="32">
281 <matches string="${os.arch}" pattern="64"/>
282 </condition>
[32416]283 </if>
[32350]284
[20464]285 <!-- now we've read in properties, apply defaults -->
286 <property name="disable.collection.building" value="false"/>
287
[15124]288 <!-- get properties from the environment -->
289 <property environment="env"/>
[15799]290
[20127]291 <!-- get the filesets defining components and executables -->
[19975]292 <import file="resources/xml/components.xml"/>
[20127]293 <import file="resources/xml/executables.xml"/>
[15799]294
295 <!-- version properties for external packages -->
[20079]296 <!-- for Java versions < 1.4, we print out the message that Java is too old.
[25131]297 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 7.0-->
[29578]298 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-7.0.57">
[20079]299 <equals arg1="1.4" arg2="${ant.java.version}"/>
300 </condition>
[25131]301 <condition property="tomcat.version.major" value="5" else="7">
[20079]302 <equals arg1="1.4" arg2="${ant.java.version}"/>
303 </condition>
[22320]304 <condition property="privileged.attribute" value="privileged='true'" else="">
[25384]305 <equals arg1="7" arg2="${tomcat.version.major}"/>
[22320]306 </condition>
[20233]307
[29845]308 <!-- external access to the GS3 pages or not
309 https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html -->
310 <condition property="allowed.IPs"
311 value=".*"
312 else="(127\.0\.0\.1|::1|0:0:0:0:0:0:0:1)">
313 <matches pattern="^(1|true|yes)$" string="${server.external.access}"/>
314 </condition>
315
[22405]316 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
317 <property name="axis.dir.version" value="axis-1_4"/>
[24077]318 <property name="sqlite.targz.version" value="sqlite-autoconf-3070602.tar.gz"/>
[15799]319
[15124]320 <property name="build.home" value="${basedir}/build"/>
321 <property name="src.home" value="${basedir}/src/java"/>
[27829]322
323 <if><bool><istrue value="${gsdl3home.isreadonly}"/></bool>
324 <property name="readonly-packages.home" value="${basedir}/packages"/>
325 <property name="packages.home" value="${gsdl3.writablehome}/packages"/>
[30303]326 <!--
[30304]327 To run solr from a read-only location (like a DVD-ROM), its locktype needs to be "single",
[30303]328 else solr tries to write out a lock file to the collection's index folder which is read-only.
329
330 https://cwiki.apache.org/confluence/display/solr/IndexConfig+in+SolrConfig
331 says that the "single" locktype is "for special situations of a read-only index directory, or ...."
332
333 See also http://wiki.apache.org/lucene-java/AvailableLockFactories
[30304]334 And look for the documentation on "locktype" in solr collection's etc/conf/solrconfig.xml
335 for further information on the different locktypes.
[30303]336
337 To set the locktype property from the commandline (it's a property to the server web), pass in
338 "-Dsolr.lock.type=..." to the web server, as explained in
339 http://lucene.472066.n3.nabble.com/Where-can-we-set-the-parameters-in-Solr-Config-td4183706.html
340 -->
341 <property name="readonly.catalina.opts" value="-Dsolr.lock.type=single"/>
[27829]342 <else>
343 <property name="packages.home" value="${basedir}/packages"/>
[30303]344 <property name="readonly.catalina.opts" value=""/>
[27829]345 </else>
346 </if>
347
348 <!-- this may be set in build.properties, e.g. if you move the web dir to
349 tomcats webapps directory -->
[15124]350 <property name="web.home" value="${basedir}/web"/>
[27829]351 <property name="web.writablehome" value="${gsdl3.writablehome}"/>
[30573]352 <!-- If using a dispersed GS3 web folder, then the user web would not contain everything in the
353 default GS3 web (it won't contain a CGI or lib folder inside WEB-INF, for instance) -->
[30568]354 <if>
355 <bool><available file="${web.home}/WEB-INF/cgi" type="dir"/></bool>
356 <property name="full.web.dir" value="${web.home}"/>
357 <else>
358 <property name="full.web.dir" value="${basedir}/web"/>
359 </else>
360 </if>
361
[15124]362 <!-- jar files needed by applets go here -->
363 <property name="web.applet" value="${web.home}/applet"/>
[30568]364
[15124]365 <!-- jar files needed by the servlet (and extra ones) go here -->
366 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
[27829]367 <property name="web.writablelib" value="${web.writablehome}/WEB-INF/lib"/>
[15124]368 <!-- other files needed by the servlet go here -->
369 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
[27829]370 <property name="web.writableclasses" value="${web.writablehome}/WEB-INF/classes"/>
371
372 <if>
373 <bool><istrue value="${gsdl3home.isreadonly}"/></bool>
374 <echo>Greenstone3 home directory is read-only</echo>
375 <echo> => Writable area is: ${gsdl3.writablehome}</echo>
376
377 <condition property="gsdl3.writablehome.already-exists">
378 <available file="${gsdl3.writablehome}" type="dir"/>
379 </condition>
380
381 <if>
382 <bool><not><istrue value="${gsdl3.writablehome.already-exists}"/></not></bool>
383
384 <!-- set up writable area -->
385 <echo>No previous Greenstone home writable area detected</echo>
386 <echo> => Setting up area</echo>
387 <mkdir dir="${gsdl3.writablehome}"/>
388 <mkdir dir="${gsdl3.writablehome}/packages"/>
389 <mkdir dir="${gsdl3.writablehome}/logs"/>
[27860]390 <mkdir dir="${gsdl3.writablehome}/ext/solr"/>
[27829]391
392 <chmod perm="a+rwx" dir="${gsdl3.writablehome}"/>
393 <chmod perm="a+rwx" dir="${gsdl3.writablehome}/packages"/>
394 <chmod perm="a+rwx" dir="${gsdl3.writablehome}/logs"/>
[27860]395 <chmod perm="a+rwx" dir="${gsdl3.writablehome}/ext/solr"/>
[27829]396
397 <!-- copy over packages tomcat folder -->
398
399 <if>
[27834]400 <bool><istrue value="${current.os.iswindows}"/></bool>
[27829]401 <copy todir="${gsdl3.writablehome}/packages/tomcat"
402 preservelastmodified="true"
403 failonerror="true" >
404 <fileset dir="${readonly-packages.home}/tomcat" includes="**"/>
405 </copy>
406
407 <else>
408 <!-- else assume Unix -->
[30279]409 <!-- Can't go through the OS-independent <copy> task as it fails to preserve exec permissions -->
[27829]410 <echo>Copying to ${gsdl3.writablehome}/packages/tomcat</echo>
411 <exec executable="cp" output="/dev/null" spawn="false">
412 <arg value="-r"/>
413 <arg value="${readonly-packages.home}/tomcat"/>
414 <arg value="${gsdl3.writablehome}/packages/."/>
415 </exec>
[30279]416
417 <!-- the packages folder in tmp only has read permissions at this stage, it needs more permissions to work when running GS3 off a disc -->
418 <chmod perm="a+rwx" file="${gsdl3.writablehome}/packages/**" />
419
[27829]420 </else>
421 </if>
422
423 <echo> => Copying Greenstone's web/WEB-INF to writable area</echo>
424 <copy todir="${gsdl3.writablehome}/WEB-INF"
425 preservelastmodified="true"
426 failonerror="true" >
[30568]427 <fileset dir="${full.web.dir}/WEB-INF" includes="**"/>
[27829]428 </copy>
429
430 <copy todir="${gsdl3.writablehome}"
431 preservelastmodified="true"
432 failonerror="true" >
433 <fileset dir="${web.home}" includes="index.html"/>
434 </copy>
435
436 </if>
437 </if>
438
439
[15124]440 <!--- flax: the WordNet home -->
441 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
442
443 <!-- jni libraries and java wrappers go here -->
444 <property name="lib.jni" value="${basedir}/lib/jni"/>
[19878]445
446 <!-- other jar files needed for installation (but not runtime) go here -->
[18110]447 <property name="lib.java" value="${basedir}/lib/java"/>
[15799]448
[15124]449 <property name="javadocs" value="${basedir}/docs/javadoc"/>
450
451 <property name="app.name" value="greenstone3"/>
[31508]452 <property name="app.path" value="/${greenstone.context}"/>
[15124]453
[18124]454 <property name="admin.dir" value="${basedir}/admin"/>
[15124]455
[27829]456 <!-- defaults - set these on the command line or in build.properties or
457 they will take these default values-->
[15124]458 <property name="app.version" value="trunk"/>
459 <property name="branch.path" value="trunk"/>
460 <property name="branch.revision" value="HEAD"/>
461
462 <!--constants -->
463 <property name="svn.root" value="http://svn.greenstone.org"/>
464
[19878]465 <!-- catalina home is set to tomcat basedir if already installed, otherwise
[27829]466 use greenstone's tomcat -->
[20085]467 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
[15124]468 <and>
469 <isset property="tomcat.installed.path"/>
470 <not>
[27829]471 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]472 </not>
473 </and>
474 </condition>
[25131]475
[15124]476
[19933]477 <!-- is there a better way to do this?? what about solaris?? -->
[26765]478 <condition property="os.bin.dir" value="${cross.os}">
479 <istrue value="${compile.cross}"/>
480 </condition>
[19933]481 <condition property="os.bin.dir" value="windows">
482 <os family="windows"/>
483 </condition>
484 <condition property="os.bin.dir" value="darwin">
485 <os family="mac"/>
486 </condition>
487 <condition property="os.bin.dir" value="linux">
488 <and>
489 <os family="unix"/>
490 <not>
491 <os family="mac"/>
492 </not>
493 </and>
494 </condition>
[26765]495
[19933]496
[19878]497 <condition property="collection.building.disabled">
[20464]498 <and>
499 <isset property="disable.collection.building"/>
500 <istrue value="${disable.collection.building}"/>
501 </and>
[19878]502 </condition>
503
[15124]504 <condition property="collection.building.enabled">
505 <not>
[20464]506 <istrue value="${disable.collection.building}"/>
[15124]507 </not>
508 </condition>
[19878]509
[15124]510 <condition property="collection.building.enabled.windows">
511 <and>
[20464]512 <istrue value="${collection.building.enabled}"/>
[15124]513 <isset property="current.os.iswindows"/>
514 </and>
515 </condition>
516
517 <condition property="collection.building.enabled.unix">
518 <and>
[20464]519 <istrue value="${collection.building.enabled}"/>
[15124]520 <isset property="current.os.isunix"/>
521 </and>
522 </condition>
[22847]523
[20085]524 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
[19931]525 <isset property="compile.static"/>
526 </condition>
[22184]527
[27199]528 <!-- If building a release then we want to adjust environment variables so that the support library can be seen during compilation -->
[27185]529 <if><bool><isset property="use.gnomelib.ext"/></bool>
[23599]530 <property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
[22845]531
[23599]532 <if><bool><isset property="env.CFLAGS"/></bool>
533 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CFLAGS}&quot;"/>
534 <else>
535 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
536 </else>
537 </if>
[22845]538
[23599]539 <if><bool><isset property="env.CPPFLAGS"/></bool>
540 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CPPFLAGS}&quot;"/>
541 <else>
542 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
543 </else>
544 </if>
[22847]545
[23599]546 <if><bool><isset property="env.CXXFLAGS"/></bool>
547 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CXXFLAGS}&quot;"/>
548 <else>
549 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
550 </else>
551 </if>
552
[30883]553 <!--https://groups.google.com/forum/#!topic/openkinect/m-hfXeYwKtU
554 compiling up libwv on ElCapitan needs -framework CoreFoundation -->
[23599]555 <if><bool><isset property="env.LDFLAGS"/></bool>
[30884]556 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib ${env.LDFLAGS}&quot;"/>
[23599]557 <else>
[30884]558 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib&quot;"/>
[23599]559 </else>
560 </if>
561
562 <if><bool><isset property="env.PATH"/></bool>
563 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin:${env.PATH}&quot;"/>
564 <else>
565 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin&quot;"/>
566 </else>
567 </if>
568
569 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
570 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig:${env.PKG_CONFIG_PATH}&quot;"/>
571 <else>
572 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig&quot;"/>
573 </else>
574 </if>
[30758]575
[23611]576 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
[30864]577 <!--<if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
[30786]578 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}&quot;"/>
579 <else>
580 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
[30864]581 </else>
582 </if>
583 -->
[30865]584 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
[23599]585 <else>
[30759]586 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
[23611]587 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
588 <else>
589 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
590 </else>
591 </if>
[23599]592 </else>
593 </if>
594
[30758]595
[23599]596 <else>
597 <if><bool><isset property="env.CFLAGS"/></bool>
598 <property name="cflags.arg" value="CFLAGS=&quot;${env.CFLAGS}&quot;"/>
599 <else>
600 <property name="cflags.arg" value=" "/>
601 </else>
602 </if>
603
604 <if><bool><isset property="env.CPPFLAGS"/></bool>
605 <property name="cppflags.arg" value="CPPFLAGS=&quot;${env.CPPFLAGS}&quot;"/>
606 <else>
607 <property name="cppflags.arg" value=" "/>
608 </else>
609 </if>
610
611 <if><bool><isset property="env.CXXFLAGS"/></bool>
612 <property name="cxxflags.arg" value="CXXFLAGS=&quot;${env.CXXFLAGS}&quot;"/>
613 <else>
614 <property name="cxxflags.arg" value=" "/>
615 </else>
616 </if>
617
618 <if><bool><isset property="env.LDFLAGS"/></bool>
[30884]619 <property name="ldflags.arg" value="LDFLAGS=&quot;${env.LDFLAGS}&quot;"/>
[23599]620 <else>
[30884]621 <property name="ldflags.arg" value=" "/>
[23599]622 </else>
623 </if>
624
625 <if><bool><isset property="env.PATH"/></bool>
626 <property name="path.arg" value="PATH=&quot;${env.PATH}&quot;"/>
627 <else>
628 <property name="path.arg" value=" "/>
629 </else>
630 </if>
631
632 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
633 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${env.PKG_CONFIG_PATH}&quot;"/>
634 <else>
635 <property name="pcpath.arg" value=" "/>
636 </else>
637 </if>
638
[23611]639 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
640 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
641 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
642 <else>
643 <property name="ldlpath.arg" value=" "/>
644 </else>
645 </if>
[23599]646 <else>
[23611]647 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
648 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
649 <else>
650 <property name="ldlpath.arg" value=" "/>
651 </else>
652 </if>
653 </else>
[23599]654 </if>
655 </else>
[22868]656 </if>
[23611]657 <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
[22868]658
[26765]659 <condition property="opt.cross.build"
660 value="--build=${cross.build}" else=" ">
661 <isset property="cross.build"/>
662 </condition>
663
664
665 <condition property="cross.configure.args"
[26806]666 value="--host=${cross.host} ${opt.cross.build} CPP=${cross.host}-cpp CC=${cross.host}-gcc CXX=${cross.host}-g++ LD=${cross.host}-ld AR=${cross.host}-ar RANLIB=${cross.host}-ranlib STRIP=${cross.host}-strip ${cross.configure.extraargs} crossOS=${cross.os}" else=" ">
[26765]667 <istrue value="${compile.cross}"/>
668 </condition>
669
[28311]670 <!-- if we're told to work with gnome-lib, or if there's a gnome-lib-minimal that the user
671 has placed in gs2build/ext, then compile gs2build after sourcing gnome-lib environment -->
672 <condition property="opt.gnomelibext.arg"
673 value="--enable-gnome-lib-ext" else=" ">
674 <or>
675 <available file="${gs2build.home}/ext/gnome-lib-minimal" type="dir"/>
676 <istrue value="${use.gnomelib.ext}"/>
677 <istrue value="${checkout.gnomelib.ext}"/>
678 </or>
679 </condition>
680
[27028]681<!-- if you want to disable wvware, do so here: set the value (not else) field to contain minus-minus-disable-wvware -->
[28311]682 <condition property="gs2.opt.args" value="${opt.gnomelibext.arg} " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
[22184]683 <istrue value="${with.jni}"/>
684 </condition>
685 <condition property="gs2.compile.target" value="with-jni" else="without-jni">
686 <istrue value="${with.jni}"/>
687 </condition>
688 <condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
689 <istrue value="${with.jni}"/>
690 </condition>
691 <condition property="gs2.windows.enablejni" value="1" else="0">
692 <istrue value="${with.jni}"/>
693 </condition>
[22976]694 <condition property="gs2.windows.enablemg" value="1" else="0">
695 <istrue value="${with.jni}"/>
696 </condition>
697 <condition property="gs2.windows.enablemgpp" value="1" else="0">
698 <istrue value="${with.jni}"/>
699 </condition>
700 <!-- Should accent folding not also be set here ?? -->
701 <condition property="gs2.windows.usegdbm" value="1" else="0">
702 <istrue value="${with.jni}"/>
703 </condition>
704 <condition property="gs2.windows.usesqlite" value="1" else="0">
705 <istrue value="${with.jni}"/>
706 </condition>
[19931]707
[15799]708 <!-- where is search4j tool -->
[20085]709 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
[15799]710 <isset property="current.os.iswindows"/>
[15136]711 </condition>
712
[15799]713
[15124]714 <!-- ============= Base dirs for each package and component ============ -->
715 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
716 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
717 <property name="gli.home" value="${basedir}/gli"/>
718 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
719
[21347]720 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
[20464]721 <istrue value="${disable.collection.building}"/>
[19871]722 </condition>
[19931]723
724 <property name="build.src.home" value="${gs2build.home}/build-src"/>
[19871]725 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
726 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
727 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
728 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
729
[15799]730 <!-- ==================== Compilation Control Options ==================== -->
[15124]731
[15799]732 <!--
[15124]733
734 These properties control option settings on the Javac compiler when it
735 is invoked using the <javac> task.
736
737 compile.debug Should compilation include the debug option?
738
739 compile.deprecation Should compilation include the deprecation option?
740
741 compile.optimize Should compilation include the optimize option?
742
[15799]743 -->
[15124]744
745 <property name="compile.debug" value="true"/>
746 <property name="compile.deprecation" value="true"/>
747 <property name="compile.optimize" value="true"/>
[29515]748 <property name="compile.encoding" value="UTF8"/>
[28137]749 <property name="compile.includeantruntime" value="false"/> <!-- to get rid of annoying 'ant' warning -->
[15124]750
[15799]751 <!--
[15124]752
753 Rather than relying on the CLASSPATH environment variable, Ant includes
754 features that makes it easy to dynamically construct the classpath you
755 need for each compilation. The example below constructs the compile
756 classpath to include the servlet.jar file, as well as the other components
757 that Tomcat makes available to web applications automatically, plus anything
758 that you explicitly added.
759
[15799]760 -->
[20079]761
762 <!-- All elements that Tomcat 5 exposes to applications -->
763 <path id="tomcat5">
[20085]764 <pathelement location="${catalina.home}/common/classes"/>
765 <fileset dir="${catalina.home}/common/endorsed">
766 <include name="*.jar"/>
767 </fileset>
768 <fileset dir="${catalina.home}/common/lib">
769 <include name="*.jar"/>
770 </fileset>
771 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
772 <pathelement location="${catalina.home}/shared/classes"/>
773 <fileset dir="${catalina.home}/shared/lib">
774 <include name="*.jar"/>
775 </fileset>
[20079]776 </path>
777
[25131]778 <!-- All elements that Tomcat 7 exposes to applications -->
779 <path id="tomcat7">
[20085]780 <fileset dir="${catalina.home}/lib">
781 <include name="*.jar"/>
782 </fileset>
[20079]783 </path>
784
[15124]785 <path id="compile.classpath">
786 <!-- Include all jar files and libraries in our jni lib directory -->
787 <pathelement location="${lib.jni}"/>
788 <fileset dir="${lib.jni}">
789 <include name="*.jar"/>
790 </fileset>
791 <!-- Include all jar files in our web lib directory -->
792 <pathelement location="${web.lib}"/>
793 <fileset dir="${web.lib}">
794 <include name="*.jar"/>
795 </fileset>
796
[18110]797 <pathelement location="${lib.java}"/>
798 <fileset dir="${lib.java}">
799 <include name="*.jar"/>
800 </fileset>
[15124]801
802 <!-- include the jar files from the source packages -->
803 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
804 so we add them in by name -->
[22184]805 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
[15124]806 <pathelement location="${lib.jni}/mg.jar"/>
807 <pathelement location="${lib.jni}/mgpp.jar"/>
808
[20085]809 <!-- Include all elements that Tomcat exposes to applications -->
810 <path refid="tomcat${tomcat.version.major}"/>
811
[15124]812 </path>
813
814 <path id="local.tomcat.classpath">
815 <!-- explicitly include the jni java wrappers in the classpath -->
816 <pathelement location="${lib.jni}"/>
817 <fileset dir="${lib.jni}">
818 <include name="*.jar"/>
819 </fileset>
[25095]820
[27829]821 <pathelement location="${web.writablelib}"/>
822 <fileset dir="${web.writablelib}">
[29903]823 <include name="derbyclient.jar"/> <!--<include name="derby.jar"/>-->
[25095]824 </fileset>
[15124]825 </path>
826
[29903]827 <path id="derby.server.classpath">
[30568]828 <pathelement location="${web.writablelib}/derbynet.jar"/>
829 <pathelement location="${web.writablelib}/derby.jar"/>
[29903]830 </path>
831
[32153]832
833 <if><bool><isset property="env.PATH"/></bool>
834 <path id="local.tomcat.path">
835 <pathelement location="${basedir}/bin/script"/>
836 <pathelement location="${basedir}/bin"/>
837 <pathelement location="${lib.jni}"/>
838 <pathelement path="${env.PATH}"/>
839 <pathelement path="${wn.home}/bin"/>
840 </path>
841 <!-- Windows can be case sensitive about env.PATH, preferring env.Path. See https://ant.apache.org/manual/Tasks/property.html -->
842 <else><if><bool><isset property="env.Path"/></bool>
843 <path id="local.tomcat.path">
844 <pathelement location="${basedir}/bin/script"/>
845 <pathelement location="${basedir}/bin"/>
846 <pathelement location="${lib.jni}"/>
847 <pathelement path="${env.Path}"/>
848 <pathelement path="${wn.home}/bin"/>
849 </path>
850 <!-- else print error about no path set -->
851 <else>
852 <echo>No env.PATH (or env.Path) set. Unable to set local.tomcat.path property</echo>
853 </else></if></else>
854 </if>
[29903]855
[15124]856 <target name="test-setup">
857 <echo>ant java version=${ant.java.version}</echo>
858 <echo>is unix : ${current.os.isunix}</echo>
859 <echo>is mac : ${current.os.ismac}</echo>
860 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
861 <echo>is windows : ${current.os.iswindows}</echo>
862 <echo>os.unix: ${os.unix}</echo>
[32153]863 <echo>env.PATH: ${env.PATH}</echo>
864 <echo>env.Path: ${env.Path}</echo>
[15124]865 </target>
[27369]866
[31121]867 <target name="needs-gs3-setup">
868 <!-- has the gs3-setup script been run?? -->
869 <condition property="gs3-setup-not-done">
870 <not>
871 <isset property="env.GSDL3HOME"/>
872 </not>
873 </condition>
874
875 <fail if="gs3-setup-not-done" message="Please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before starting the Greenstone server."/>
876 </target>
877
[27369]878 <!-- Appends the current env to the file environment.txt. For debugging env vars used by the release-kit. -->
[29341]879 <target name="write-env" description="Writes out the environment that this build.xml is executed in to file environment.txt. For debugging.">
[27369]880 <echo message="*****************ENVIRONMENT OUTPUT:****************${line.separator}" file="environment.txt" append="true" />
881
882 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[32152]883 <exec executable="cmd" dir="${basedir}" failonerror="false" output="environment.txt" append="true">
[29343]884 <arg value="/c" />
885 <arg value="set" />
886 </exec>
[27369]887 <else>
888 <exec executable="env" dir="${basedir}" failonerror="false" output="environment.txt" append="true" />
889 </else>
890 </if>
891
892 <echo message="${line.separator}" file="environment.txt" append="true" />
893 </target>
894
[20085]895
[15799]896 <!-- ==================== Primary and Global Targets ============================= -->
[15124]897
[32310]898 <target name="prepare" depends="accept-properties,init,copy-dot-svn-files,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
[15124]899 description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional subversion checkouts and downloads, so you need to be online to run this.">
900
901 <!-- make sure .sh files are executable -->
902 <chmod dir="${basedir}" perm="ugo+rx"
903 includes="*.sh"/>
904 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
905 includes="*.sh,*.pl"/>
906 </target>
[16936]907
[19871]908 <!-- install-common-src and install-collection-building are mutually exclusive and either one or the other will be done depending on whether collection building is enabled or not -->
[28311]909 <!--before configuring build-src, make sure that gnome-lib is compiled up-->
[28611]910 <target name="install" depends="init,compile-imagemagick,compile-gnome-lib,install-common-src,install-collection-building,install-runtime,install-solr-ext,setup-for-eclipse,get-isisgdl"
[32425]911 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'.">
912 <echo>
913 After successful compilation, you can turn on https support on Windows and Linux (requires sudo/admin permissions)
914 by editing build.properties and running 'ant setup-https-cert'.
915 </echo>
916 </target>
[19843]917
[19931]918 <target name="install-common-src" depends="init"
919 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
[30788]920 <antcall target="configure-common-src">
921 <param name="set.ld.path" value="true"/>
922 </antcall>
923 <antcall target="compile-common-src">
924 <param name="set.ld.path" value="true"/>
925 </antcall>
[19894]926 <antcall target="install-auxiliary-jar-files"/>
927 <antcall target="install-jni-files"/>
928 </target>
[19878]929
[19894]930 <target name="install-collection-building" depends="init" if="collection.building.enabled"
931 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
932 <antcall target="configure-collection-building"/>
[19931]933 <antcall target="tweak-makefiles" />
[19894]934 <antcall target="compile-collection-building"/>
935 </target>
936
[19878]937
[20209]938 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
[19878]939 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
940
941 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
[15124]942 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
943
944 <target name="configure" depends="init,configure-tomcat,configure-web"
[23855]945 description="Configure the installation (not the C++ code). Includes setting up config files. Should be re-run if you change the build.properties file, including if you change the port number."/>
[15124]946
[20209]947 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
[19878]948 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
[15124]949
[20209]950 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
[19878]951 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
[15799]952
[19878]953 <target name="update" depends="init,svnupdate,clean,install"
954 description="Update (thru Subversion) all the source (including common-src or collection-building, and runtime), then clean, and re-install. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/>
[15124]955
[23854]956
957 <target name="perl-for-building" depends="init">
958 <!-- uses perl.path if set in build.properties, otherwise try for
959 environment variable PERLPATH, and failing that assumes 'perl'
960 is on environment PATH -->
[23856]961 <!-- if, outside build.properties, we only set perl.path if we have gs2build/build-src (collection building), then we won't set perl.path in a (flax) binary, since it doesn't have build-src -->
[23857]962 <if><bool><available file="${gs2build.home}"/></bool>
[23854]963
964 <if><bool><not><isset property="perl.path"/></not></bool>
965
966 <if>
967 <bool>
968 <and>
969 <isset property="env.PERLPATH"/>
970 <not><equals arg1="${env.PERLPATH}" arg2=""/></not>
971 </and>
972 </bool>
[27859]973 <!-- set perlpath to env.PERLPATH.
974 This is the path to perl\bin that's found by findperl.bat when the server is launched
975 through GLI instead of the console.
976 For windows, this env.PERLPATH is the bin folder and needs a backslash at end, since it
977 will appear suffixed with "perl.exe" in the perl setting in packages\tomcat\config\web.xml.
978 This web.xml's path to perl is then used to find perl when running the perl scripts in the
979 cgi folder, so without a slash appended at this point it becomes "binperl" in web.xml, and
980 things will break when GLI launches the server on Windows and the online GS3 metadata editor
981 is used to save user-edited metadata. -->
982 <if><bool><istrue value="${current.os.iswindows}"/></bool>
983 <property name="perl.path" value="${env.PERLPATH}\"/>
984 <else>
985 <property name="perl.path" value="${env.PERLPATH}"/>
986 </else>
987 </if>
988
[23854]989 <else>
990 <echo>
[23896]991 Using PATH environment variable to locate Perl.
[23854]992 </echo>
993 <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
994 <arg value="perl" />
995 </exec>
996
[28044]997 <exec executable="${gs2build.home}/bin/windows/which" osfamily="windows" spawn="false" outputproperty="full.perl.path">
[23941]998 <arg value="perl" />
999 </exec>
[23896]1000
[25640]1001 <stringutil string="${full.perl.path}" property="partial.perl.path">
1002 <replace regex="\/[^\/]*$" replacement="/" />
[23854]1003 </stringutil>
[27484]1004 <stringutil string="${partial.perl.path}" property="perl.path">
[25640]1005 <replace regex="\\[^\\]*$" replacement="\\" />
1006 </stringutil>
[23896]1007 <if><bool><istrue value="${current.os.isunix}"/></bool>
1008 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
1009 <echo>
[23854]1010 Non-standard location of Perl found: ${full.perl.path}
1011 Set the environment variable PERLPATH or the perl.path property in
[27484]1012 build.properties to explicitly control the version of Perl used.
[23896]1013 </echo>
1014 </if>
[23854]1015 </if>
1016 </else>
1017 </if>
1018 </if>
1019
1020 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
1021 <if><bool><isset property="perl.path"/></bool>
1022 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
1023 <else>
1024 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
1025 </else>
1026 </if>
[23857]1027
1028 <!-- gs2build not available, perl.path -->
1029 <else>
1030 <property name="perl.path" value=""/>
1031 </else>
1032 </if>
[27484]1033 <stringutil string="${perl.path}" property="escaped.perl.path">
1034 <replace regex="\\" replacement="\\\\" />
1035 </stringutil>
[23854]1036 </target>
1037
[25549]1038 <target name="get-default-servlet-url">
[32429]1039 <echo>${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}${server.default.servlet}</echo>
[31489]1040 </target>
[29988]1041
[32432]1042 <!-- returns the base local URL, something like HTTP://127.0.0.1:<HTTPport>
1043 or some sane equivalent for 127.0.0.1 -->
1044 <target name="get-local-base-http-url">
1045 <echo>${local.http.url}</echo>
1046 </target>
1047 <!-- Returns something like HTTP://127.0.0.1:<HTTPport>/greenstone3/library -->
1048 <target name="get-local-http-servlet-url">
1049 <echo>${local.http.url}${app.path}${server.default.servlet}</echo>
1050 </target>
1051
[32429]1052 <!-- solr should only be accessible locally, which therefore also means only over http.
[32432]1053 Note that for http, 127.0.0.1 is safer than localhost (as localhost can be mapped to something
1054 other than 127.0.0.1). See also https://letsencrypt.org/docs/certificates-for-localhost/ -->
[31489]1055 <target name="get-solr-servlet-url">
[32429]1056 <!--<echo>${default.server.protocol}://${tomcat.server}:${default.tomcat.port}/${solr.context}</echo>-->
[32432]1057 <echo>${local.http.url}/${solr.context}</echo>
[31489]1058 </target>
1059
[29988]1060 <target name="check-derbyserver-running">
1061 <condition property="derby.isrunning" value="true" else="false">
1062 <!--<socket server="jdbc:derby://${derby.server}" port="${derby.server.port}"/>-->
1063 <socket server="${derby.server}" port="${derby.server.port}"/><!-- like telnet machine port -->
1064 </condition>
1065 <echo>Derby is running: ${derby.isrunning}</echo>
[29903]1066 </target>
[29988]1067
[30013]1068 <!-- Need a copy of the check-derby-running target with a distinct property, because ant restart runs
1069 both stop and start, which stop and start derby respectively. Both need check the derby socket.
1070 Because each property can be set only once during an invocation with ant, ant restart will need
1071 two check-derbyserver properties, one for each derby check. -->
1072 <target name="check-derbyserver-started">
1073 <condition property="derby.isstarted" value="true" else="false">
1074 <socket server="${derby.server}" port="${derby.server.port}"/>
1075 </condition>
1076 <echo>Derby is running: ${derby.isstarted}</echo>
1077 </target>
1078
1079
1080 <!-- Unused -->
[29988]1081 <target name="start-derby-java" depends="check-derbyserver-running">
1082 <if><bool><not><istrue value="${derby.isrunning}"/></not></bool>
1083 <echo>Launching derby on ${derby.server}:${derby.server.port}...</echo>
1084 <java classname="org.apache.derby.drda.NetworkServerControl" fork="true" spawn="true" clonevm="true">
1085 <arg value="start"/>
1086 <classpath refid="derby.server.classpath"/>
1087 </java>
1088 <else>
1089 <echo>Derby server ALREADY RUNNING on ${derby.server}:${derby.server.port}</echo>
1090 </else>
1091 </if>
1092 </target>
[29903]1093
[30013]1094 <target name="start-derby" depends="check-derbyserver-started">
1095 <if><bool><not><istrue value="${derby.isstarted}"/></not></bool>
1096 <echo>About to launch derby on ${derby.server}:${derby.server.port}</echo>
1097 <antcall target="force-start-derby"/>
1098 <else>
1099 <echo>Derby networked server ALREADY RUNNING on ${derby.server}:${derby.server.port}</echo>
1100 </else>
1101 </if>
1102 </target>
1103
[29903]1104 <!-- Using derby 10.1.2.1
1105 See db-derby-10.1.2.1-bin/docs/html/adminguide/index.html -->
[30013]1106 <target name="force-start-derby">
[29988]1107 <property name="derby.server.classpath.prop" refid="derby.server.classpath" />
1108
1109 <exec executable="java" spawn="true"><!-- failonerror="true"-->
1110 <env key="CLASSPATH" path="${derby.server.classpath.prop}"/>
1111 <arg value="org.apache.derby.drda.NetworkServerControl"/>
1112 <arg value="start"/>
1113 <arg value="-p"/>
1114 <arg value="${derby.server.port}"/>
1115 </exec>
[30013]1116
[29903]1117 </target>
1118
[29988]1119 <target name="force-stop-derby">
[29903]1120 <java classname="org.apache.derby.drda.NetworkServerControl">
1121 <arg value="shutdown"/>
[30170]1122 <arg value="-p"/>
1123 <arg value="${derby.server.port}"/>
[29903]1124 <classpath refid="derby.server.classpath"/>
1125 </java>
1126 </target>
1127
[29988]1128 <target name="stop-derby" description="Shutdown derby server only if running" depends="check-derbyserver-running"><!-- if="${derby.isrunning}" checks if true or false only from ant 1.8 on -->
1129 <if><bool><istrue value="${derby.isrunning}"/></bool>
1130 <!--<echo>Derby is |${derby.isrunning}| running</echo>-->
1131 <antcall target="force-stop-derby"/>
1132 <else>
1133 <echo>Derby is not running</echo>
1134 </else>
1135 </if>
1136 </target>
1137
[31121]1138 <target name="start" depends="needs-gs3-setup,init,configure-tomcat,configure-web,configure-solr-ext,start-derby,start-tomcat"
[15124]1139 description="Startup the Tomcat server." >
[15799]1140 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
[32412]1141 <echo>Tomcat: ${catalina.home}</echo>
[16936]1142 <echo>Java : ${java.home}</echo>
[23849]1143 <if><bool><available file="${build.src.home}"/></bool>
1144 <echo>Perl : ${full.perl.path}</echo>
1145 </if>
[23936]1146 <if><bool><isset property="install.flax"/></bool>
[32429]1147 <property name="url" value="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}/flax"/>
[23936]1148 <else>
[32429]1149 <property name="url" value="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}/"/>
[23936]1150 </else>
1151 </if>
1152 <echo>URL : ${url}</echo>
[15799]1153 <!-- assuming that index.html is not needed here -->
[26033]1154
1155 <!--Now write out the url with oaiserver suffix as the baseURL property in OAIConfig.xml-->
[32310]1156 <available file="${basedir}/resources/oai/OAIConfig.xml.in" property="oaiconfig.present"/>
[26033]1157 <antcall target="init-oaiconfig">
1158 <param name="url" value="${url}"/>
1159 </antcall>
[15124]1160 </target>
1161
[26033]1162 <target name="init-oaiconfig" if="oaiconfig.present">
[27829]1163 <echo>Writing out baseURL ${url}oaiserver to ${web.writableclasses}/OAIConfig.xml</echo>
[32310]1164 <copy file="${basedir}/resources/oai/OAIConfig.xml.in" tofile="${web.writableclasses}/OAIConfig.xml"/>
[28136]1165 <rsr verbosity="1" file="${web.writableclasses}/OAIConfig.xml" pattern="&lt;baseURL&gt;.*&lt;/baseURL&gt;" replacement="&lt;baseURL&gt;${url}oaiserver&lt;/baseURL&gt;" />
[26033]1166 </target>
1167
[29903]1168 <target name="stop" depends="init,stop-tomcat,stop-derby"
[15124]1169 description="Shutdown the Tomcat server."/>
1170
1171 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
1172
[15799]1173 <!-- =========== Help targets =================================== -->
[15124]1174
1175 <property name="install-command" value="ant [options] prepare install"/>
1176
1177 <target name="usage" description="Print a help message">
1178 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
1179 <echo message=" Execute 'ant -help' for Ant help."/>
[23849]1180 <echo>
1181 To install Greenstone3, run '${install-command}'.
1182 There are properties defined in build.properties. The install
1183 process will ask you if these properties are set correctly.
1184 To avoid this prompt, use the '-Dproperties.accepted=yes'
1185 option.
1186 To log the output, use the '-logfile build.log' option.
1187 The README.txt file has more information about the ant targets
1188 and install process.
[15124]1189 </echo>
1190 </target>
1191
1192 <target name="help" depends="usage" description="Print a help message"/>
1193
1194 <target name="debug" depends="init" description="Display all the currently used properties">
1195 <echoproperties/>
1196 </target>
1197
[15799]1198 <!-- ====== initialization and setup targets ================== -->
[15124]1199
1200 <target name="accept-properties" unless="properties.accepted">
1201 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
[32429]1202 server.protocols=${server.protocols}
[15799]1203 tomcat.server=${tomcat.server}
[32337]1204 tomcat.port.https=${tomcat.port.https}
[32429]1205 localhost.port.http=${localhost.port.http}
1206
1207 default.server.protocol=${default.server.protocol}
1208 default.tomcat.port=${default.tomcat.port}
1209 Local base HTTP URL used by Greenstone: ${local.http.url}
1210
[15799]1211 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
1212 proxy.host=${proxy.host}
1213 proxy.port=${proxy.port}
[19878]1214 disable.collection.building=${disable.collection.building}
[19910]1215 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
[15124]1216 </input>
1217 <condition property="do.abort">
1218 <equals arg1="n" arg2="${properties.ok}"/>
1219 </condition>
1220 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
1221 </target>
[32334]1222
[15124]1223 <!-- this sets up some initial properties -->
1224 <target name="init">
[20085]1225
[15124]1226 <condition property="java.too.old">
1227 <or>
[16936]1228 <equals arg1="1.1" arg2="${ant.java.version}"/>
1229 <equals arg1="1.2" arg2="${ant.java.version}"/>
1230 <equals arg1="1.3" arg2="${ant.java.version}"/>
[15124]1231 </or>
1232 </condition>
[20208]1233 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
[15124]1234
1235 <available file="${basedir}/gli" property="gli.present"/>
[19878]1236 <available file="${basedir}/common-src" property="common.src.present"/>
[15124]1237 <available file="${basedir}/gs2build" property="gs2build.present"/>
[28643]1238 <available file="${gnome-lib-dir}" property="gnome-lib.present"/>
[15124]1239
1240 <condition property="tomcat.islocal">
1241 <or>
[16936]1242 <not><isset property="tomcat.installed.path"/></not>
1243 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]1244 </or>
1245 </condition>
1246
1247 <condition property="proxy.present">
1248 <and>
[16936]1249 <isset property="proxy.host"/>
1250 <not><equals arg1="" arg2="${proxy.host}"/></not>
[15124]1251 </and>
1252 </condition>
1253
[20235]1254 <!--
[20290]1255 the next block checks if the bundled tomcat is present in the 'packages' directory,
[25131]1256 and checks for the lethal combination of tomcat 7 and java 1.4. Test for
[20290]1257 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
1258 download, as there is no other surefire way to check tomcat version under java 1.4
[20235]1259 -->
1260 <condition property="packages.tomcat.ispresent" value="true" else="false">
1261 <available file="packages/tomcat"/>
1262 </condition>
[25131]1263 <condition property="packages.tomcat.istomcat7" value="true" else="false">
1264 <available file="packages/tomcat/tomcat7.txt"/>
[20290]1265 </condition>
[20235]1266 <if>
1267 <bool>
[20290]1268 <and>
1269 <istrue value="${packages.tomcat.ispresent}"/>
[25131]1270 <istrue value="${packages.tomcat.istomcat7}"/>
[20290]1271 <equals arg1="1.4" arg2="${ant.java.version}"/>
1272 </and>
[20235]1273 </bool>
[20290]1274 <fail>Your Java (version 1.4) is too old to work with the bundled Apache Tomcat (version 6). Please upgrade to Java version 1.5 or greater. Alternatively, you may remove the bundled Apache Tomcat from the 'packages' folder and then run 'ant prepare-tomcat'.</fail>
[20235]1275 </if>
1276
[15124]1277 </target>
1278
1279 <target name="setup-proxy" depends="init" if="proxy.present">
1280 <condition property="ask.user">
1281 <or>
[16936]1282 <equals arg1="" arg2="${proxy.user}"/>
1283 <equals arg1="" arg2="${proxy.password}"/>
[15124]1284 </or>
1285 </condition>
[19878]1286
[15124]1287 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
1288 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
1289 </target>
[32310]1290
1291 <target name="copy-dot-svn-files" depends="init"
[32312]1292 description="Copies all resources .svn files to .in versions - which are used during configure to generate the runtime versions." >
[32310]1293 <if><bool><available file="${basedir}/resources/tomcat/greenstone3.xml.in"/></bool>
1294 <copy file="${basedir}/resources/tomcat/greenstone3.xml.in" tofile="${basedir}/resources/tomcat/greenstone3.xml.in.backup" overwrite="true"/>
[28904]1295 </if>
1296
[32310]1297 <copy file="${basedir}/resources/tomcat/greenstone3.xml.svn" tofile="${basedir}/resources/tomcat/greenstone3.xml.in" overwrite="true"/>
1298 <if><bool><available file="${basedir}/resources/tomcat/server_tomcat5.xml.in"/></bool>
1299 <copy file="${basedir}/resources/tomcat/server_tomcat5.xml.in" tofile="${basedir}/resources/tomcat/server_tomcat5.xml.in.backup" overwrite="true"/>
[28904]1300 </if>
[32310]1301 <copy file="${basedir}/resources/tomcat/server_tomcat5.xml.svn" tofile="${basedir}/resources/tomcat/server_tomcat5.xml.in" overwrite="true"/>
1302 <if><bool><available file="${basedir}/resources/tomcat/server_tomcat7.xml.in"/></bool>
1303 <copy file="${basedir}/resources/tomcat/server_tomcat7.xml.in" tofile="${basedir}/resources/tomcat/server_tomcat7.xml.in.backup" overwrite="true"/>
[28904]1304 </if>
[32310]1305 <copy file="${basedir}/resources/tomcat/server_tomcat7.xml.svn" tofile="${basedir}/resources/tomcat/server_tomcat7.xml.in" overwrite="true"/>
1306 <if><bool><available file="${basedir}/resources/tomcat/web.xml.in"/></bool>
1307 <copy file="${basedir}/resources/tomcat/web.xml.in" tofile="${basedir}/resources/tomcat/web.xml.in.backup" overwrite="true"/>
[28904]1308 </if>
[32310]1309 <copy file="${basedir}/resources/tomcat/web.xml.svn" tofile="${basedir}/resources/tomcat/web.xml.in" overwrite="true"/>
1310 <if><bool><available file="${basedir}/resources/oai/OAIConfig.xml.in"/></bool>
1311 <copy file="${basedir}/resources/oai/OAIConfig.xml.in" tofile="${basedir}/resources/oai/OAIConfig.xml.in.backup" overwrite="true"/>
[28904]1312 </if>
[32310]1313 <copy file="${basedir}/resources/oai/OAIConfig.xml.svn" tofile="${basedir}/resources/oai/OAIConfig.xml.in" overwrite="true"/>
1314 <if><bool><available file="${basedir}/resources/cgi/gsdl3site.cfg.in"/></bool>
1315 <copy file="${basedir}/resources/cgi/gsdl3site.cfg.in" tofile="${basedir}/resources/cgi/gsdl3site.cfg.in.backup" overwrite="true"/>
[28907]1316 </if>
[32310]1317 <copy file="${basedir}/resources/cgi/gsdl3site.cfg.svn" tofile="${basedir}/resources/cgi/gsdl3site.cfg.in" overwrite="true"/>
1318 <if><bool><available file="${basedir}/resources/web/global.properties.in"/></bool>
1319 <copy file="${basedir}/resources/web/global.properties.in" tofile="${basedir}/resources/web/global.properties.in.backup" overwrite="true"/>
[28908]1320 </if>
[32310]1321 <copy file="${basedir}/resources/web/global.properties.svn" tofile="${basedir}/resources/web/global.properties.in" overwrite="true"/>
1322 <if><bool><available file="${basedir}/resources/web/log4j.properties.in"/></bool>
1323 <copy file="${basedir}/resources/web/log4j.properties.in" tofile="${basedir}/resources/web/log4j.properties.in.backup" overwrite="true"/>
[28908]1324 </if>
[32310]1325 <copy file="${basedir}/resources/web/log4j.properties.svn" tofile="${basedir}/resources/web/log4j.properties.in" overwrite="true"/>
[28904]1326 </target>
[32310]1327
[15799]1328 <!-- ========== Web app Targets ================================ -->
1329
[20089]1330 <target name="prepare-web" depends="init">
[27829]1331 <mkdir dir="${web.writablehome}/applet"/>
1332 <mkdir dir="${web.writablehome}/logs"/>
1333 <mkdir dir="${web.writablehome}/logs/tmp"/>
[15124]1334 </target>
1335
[24607]1336 <!-- if we are using java 1.5+, we need the xalan.jar file in web/WEB-INF/lib, but if we are using java 1.4, we can't have it there.
1337 The test for whether we need it assumes we won't be trying to compile GS3 against Java versions less than 1.4. -->
[15124]1338 <target name="configure-java-version" depends="init"
[15139]1339 description="Activates or deactivates some jar libraries as needed depending on your java version">
[15136]1340
[15799]1341 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
[15124]1342 <condition property="need.xalan.jar">
[15799]1343 <or>
[24607]1344 <not><equals arg1="1.4" arg2="${ant.java.version}"/></not>
[15799]1345 </or>
1346 </condition>
[15136]1347
[15799]1348 <!-- if they have xalan.jar but dont need it -->
1349 <if>
1350 <bool>
[16936]1351 <and>
1352 <isset property="have.xalan.jar"/>
1353 <not><isset property="need.xalan.jar"/></not>
1354 </and>
[15799]1355 </bool>
1356 <antcall target="deactivate-xalan-jar"/>
1357 </if>
[15136]1358
[15799]1359 <!-- if they need xalan.jar but dont have it -->
1360 <if>
1361 <bool>
[16936]1362 <and>
1363 <not><isset property="have.xalan.jar"/></not>
1364 <isset property="need.xalan.jar"/>
1365 </and>
[15799]1366 </bool>
1367 <antcall target="activate-xalan-jar"/>
1368 </if>
[15136]1369
[15124]1370 </target>
1371
[15139]1372 <target name="activate-xalan-jar">
[15799]1373 <echo>activating xalan.jar</echo>
[15124]1374 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
[20085]1375 <if>
1376 <bool>
1377 <and>
1378 <isset property="current.os.ismac"/>
1379 <available file="${catalina.home}/common/endorsed" type="dir"/>
1380 </and>
1381 </bool>
1382 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
[15799]1383 </if>
[15124]1384 </target>
[15035]1385
[15139]1386 <target name="deactivate-xalan-jar">
[15799]1387 <echo>deactivating xalan.jar</echo>
[15124]1388 <delete file="${web.lib}/xalan.jar"/>
[20089]1389 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
[15124]1390 </target>
1391
[15837]1392
[25491]1393 <target name="prepare-collections" depends="init"
1394 description="Unpack all the collections from their svn zipped versions">
[16936]1395 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
[32435]1396 <property name="index-and-archives.zip" value="index-and-archives.zip"/>
[15799]1397
[16936]1398 <echo message="installing collections..."/>
1399 <antcall target="gs2mgdemo-install"/>
1400 <antcall target="gs2mgppdemo-install"/>
1401 <antcall target="gberg-install"/>
[25214]1402 <antcall target="lucene-jdbm-demo-install"/>
[16936]1403 </target>
[15837]1404
[16936]1405 <target name="gs2mgdemo-prepare" if="collect.dir">
1406 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
[15799]1407
[16936]1408 <condition property="gs2mgdemo.present">
1409 <and>
[32435]1410 <available file="${gs2mgdemo.dir}/${index-and-archives.zip}"/>
[16936]1411 </and>
1412 </condition>
1413 </target>
[15799]1414
[17008]1415 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
[32435]1416 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index-and-archives.zip}" />
[16936]1417 <echo>collection gs2mgdemo installed</echo>
1418 </target>
[15799]1419
[16936]1420 <target name="gs2mgppdemo-prepare" if="collect.dir">
1421 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
[15837]1422
[16936]1423 <condition property="gs2mgppdemo.present">
1424 <and>
[32435]1425 <available file="${gs2mgppdemo.dir}/${index-and-archives.zip}"/>
[16936]1426 </and>
1427 </condition>
1428 </target>
[15799]1429
[16936]1430 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
[32435]1431 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index-and-archives.zip}" />
[16936]1432 <echo>collection gs2mgppdemo installed</echo>
1433 </target>
[15799]1434
[16936]1435 <target name="gberg-prepare" if="collect.dir">
1436 <property name="gberg.dir" value="${collect.dir}/gberg"/>
[32435]1437 <available file="${gberg.dir}/index/index.zip" property="gberg.present"/>
[16936]1438 </target>
[15799]1439
[16936]1440 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
[32435]1441 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/index.zip"/>
[16936]1442 <echo>collection gberg installed</echo>
1443 </target>
[15799]1444
[25214]1445 <target name="lucene-jdbm-demo-prepare" if="collect.dir">
1446 <property name="lucene-jdbm-demo.dir" value="${collect.dir}/lucene-jdbm-demo"/>
[32435]1447 <available file="${lucene-jdbm-demo.dir}/${index-and-archives.zip}" property="lucene-jdbm-demo.present"/>
[25214]1448 </target>
1449
1450 <target name="lucene-jdbm-demo-install" if="lucene-jdbm-demo.present" depends="lucene-jdbm-demo-prepare">
[32435]1451 <unzip dest="${lucene-jdbm-demo.dir}" src="${lucene-jdbm-demo.dir}/${index-and-archives.zip}"/>
[25214]1452 <echo>collection lucene-jdbm-demo installed</echo>
1453 </target>
1454
[27846]1455
[28115]1456 <target name="install-solr-ext" depends="init" >
[28044]1457 <exec executable="ant.bat" osfamily="windows" dir="${solr-ext.home}" spawn="false">
[27846]1458 <arg value="add-service"/>
1459 </exec>
[27849]1460 <exec executable="ant" os="${os.unix}" dir="${solr-ext.home}" spawn="false">
1461 <arg value="add-service"/>
1462 </exec>
[27846]1463 <antcall target="solr-jdbm-demo-install"/>
1464 </target>
1465
1466 <target name="solr-jdbm-demo-prepare" if="collect.dir">
1467 <property name="solr-jdbm-demo.dir" value="${collect.dir}/solr-jdbm-demo"/>
1468 <available file="${solr-jdbm-demo.dir}/${index.zip}" property="solr-jdbm-demo.present"/>
1469 </target>
1470
1471 <target name="solr-jdbm-demo-install" if="solr-jdbm-demo.present" depends="solr-jdbm-demo-prepare">
1472 <unzip dest="${solr-jdbm-demo.dir}" src="${solr-jdbm-demo.dir}/${index.zip}"/>
1473 <echo>collection solr-jdbm-demo installed</echo>
1474 </target>
1475
[28612]1476 <!-- Until 64 bit Linux and Mac (Lion) machines can generate a working IsisGdl,
1477 use the ones generated on a 32 bit Linux and Mac (Leopard), respectively -->
[28952]1478 <target name="get-isisgdl" if="${current.os.isunix}">
[28613]1479 <exec executable="uname" dir="${basedir}" failonerror="false"
[28612]1480 outputproperty="uname.val">
1481 <arg value="-m"/>
1482 </exec>
1483
1484 <if><bool><equals arg1="${uname.val}" arg2="x86_64"/></bool>
1485 <echo>Bitness: ${uname.val}</echo>
1486 <if><bool><contains string="${os.bin.dir}" substring="darwin" casesensitive="false"/></bool>
1487 <get src="http://www.greenstone.org/caveat-emptor/IsisGdl.macleopard"
1488 dest="${basedir}/gs2build/bin/${os.bin.dir}/IsisGdl"/>
1489 </if>
1490 <if><bool><contains string="${os.bin.dir}" substring="linux" casesensitive="false"/></bool>
1491 <get src="http://www.greenstone.org/caveat-emptor/IsisGdl.bin32"
1492 dest="${basedir}/gs2build/bin/${os.bin.dir}/IsisGdl"/>
1493 </if>
[28611]1494 <chmod file="${basedir}/gs2build/bin/${os.bin.dir}/IsisGdl" perm="755"/>
1495 </if>
1496 </target>
[27846]1497
[27484]1498 <target name="set-perl-shebangs" depends="perl-for-building">
1499 <if>
1500 <bool>
1501 <and><isset property="perl.path"/>
1502 <not><equals arg1="${perl.path}" arg2=""/></not>
1503 </and>
1504 </bool>
1505
1506 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[27486]1507 <property name="perl.exec" value="${perl.path}perl.exe"/>
[27484]1508 <else>
[27486]1509 <property name="perl.exec" value="${perl.path}perl"/>
[27484]1510 </else>
1511 </if>
1512
1513 <!--<echo>**** PERLPATH: ${perl.path}</echo>-->
[28158]1514 <echo>Setting perl shebangs to Perl Exec: ${perl.exec}</echo>
[27484]1515
1516 <!-- set the shebangs in the cgi files to point to the correct perlpath -->
[27829]1517 <if>
1518 <bool><not><equals arg1="${web.home}" arg2="${web.writablehome}"></equals></not></bool>
1519 <mkdir dir="${web.writablehome}"/>
[30568]1520 <copy file="${full.web.dir}/WEB-INF/cgi/gliserver.pl" tofile="${web.writablehome}/WEB-INF/cgi/gliserver.pl" overwrite="true"/>
1521 <copy file="${full.web.dir}/WEB-INF/cgi/metadata-server.pl" tofile="${web.writablehome}/WEB-INF/cgi/metadata-server.pl" overwrite="true"/>
1522 <copy file="${full.web.dir}/WEB-INF/cgi/checksum.pl" tofile="${web.writablehome}/WEB-INF/cgi/checksum.pl" overwrite="true"/>
[27829]1523 </if>
1524
[28136]1525 <rsr verbosity="1" file="${web.writablehome}/WEB-INF/cgi/gliserver.pl" pattern="^#!.*" replacement="#!${perl.exec} -w" lines="1"/>
1526 <rsr verbosity="1" file="${web.writablehome}/WEB-INF/cgi/metadata-server.pl" pattern="^#!.*" replacement="#!${perl.exec} -w" lines="1"/>
1527 <rsr verbosity="1" file="${web.writablehome}/WEB-INF/cgi/checksum.pl" pattern="^#!.*" replacement="#!${perl.exec} -w" lines="1"/>
[27484]1528 <else>
[27829]1529 <echo>WARNING: perl.path is empty. Unable to set the shebangs in the perl files in ${web.writablehome}/WEB-INF/cgi</echo>
[27484]1530 </else>
1531 </if>
1532 </target>
1533
[32338]1534 <target name="configure-web" depends="init,perl-for-building"
[15124]1535 description="Configure only the web app config files">
1536 <!-- we want a unix path in the global.properties file -->
1537 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
1538 <path path="${web.home}"/>
1539 </pathconvert>
[27829]1540 <pathconvert targetos="unix" property="src.gsdl3.writablehome.unix">
1541 <path path="${web.writablehome}"/>
1542 </pathconvert>
[27484]1543
1544 <antcall target="set-perl-shebangs" inheritAll="true" />
[32344]1545
[25830]1546 <filter token="gsdlhome" value="${gs2build.home}"/>
[30614]1547 <filter token="gsdlhomequoted" value="&quot;${gs2build.home}&quot;"/>
[25830]1548 <filter token="gsdl3srchome" value="${basedir}"/>
[30614]1549 <filter token="gsdl3srchomequoted" value="&quot;${basedir}&quot;"/>
[15124]1550 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
[30614]1551 <filter token="gsdl3homequoted" value="&quot;${src.gsdl3.home.unix}&quot;"/>
[27829]1552 <filter token="gsdl3writablehome" value="${src.gsdl3.writablehome.unix}"/>
[15124]1553 <filter token="gsdl3version" value="${app.version}"/>
[32429]1554 <filter token="server.protocols" value="${server.protocols}"/>
1555 <filter token="default.server.protocol" value="${default.server.protocol}"/>
[15124]1556 <filter token="tomcat.server" value="${tomcat.server}"/>
[32429]1557 <filter token="default.tomcat.port" value="${default.tomcat.port}"/>
[32432]1558 <filter token="localhost.server.http" value="${localhost.server.http}"/>
[32429]1559 <filter token="localhost.port.http" value="${localhost.port.http}"/>
[32436]1560 <filter token="tomcat.port.https" value="${tomcat.port.https}"/>
1561 <filter token="restrict.http.to.local" value="${restrict.http.to.local}"/>
[30673]1562 <filter token="greenstone.context" value="${greenstone.context}"/>
[32379]1563 <filter token="solr.context" value="${solr.context}"/>
[29977]1564 <filter token="derbyserver" value="${derby.server}"/>
[29903]1565 <filter token="derbyserver.port" value="${derby.server.port}"/>
[24868]1566 <filter token="perlpath" value="${escaped.perl.path}"/>
[27484]1567 <filter token="disable.collection.building" value="${disable.collection.building}"/>
[32310]1568 <copy file="${basedir}/resources/cgi/gsdl3site.cfg.in" tofile="${web.writablehome}/WEB-INF/cgi/gsdl3site.cfg" filtering="true" overwrite="true"/>
1569 <copy file="${basedir}/resources/web/global.properties.in" tofile="${web.writableclasses}/global.properties" filtering="true" overwrite="true"/>
1570 <copy file="${basedir}/resources/web/log4j.properties.in" tofile="${web.writableclasses}/log4j.properties" filtering="true" overwrite="true"/>
[27829]1571 <if><bool><istrue value="${gsdl3home.isreadonly}"/></bool>
1572 <!-- uncomment the writablehome properties -->
[28136]1573 <rsr verbosity="1" file="${web.writableclasses}/global.properties" pattern="^#gsdl3\.(writable{1})?home" replacement="gsdl3.$1home" />
[27829]1574 </if>
1575 <chmod file="${web.writableclasses}/global.properties" perm="644"/>
1576 <chmod file="${web.writableclasses}/log4j.properties" perm="644"/>
[15124]1577 </target>
1578
1579 <target name="compile-web" depends="init">
1580 <javac srcdir="${web.classes}"
1581 destdir="${web.classes}"
[28137]1582 includeantruntime="${compile.includeantruntime}"
[15124]1583 debug="${compile.debug}"
1584 deprecation="${compile.deprecation}"
[29515]1585 optimize="${compile.optimize}"
1586 encoding="${compile.encoding}">
[16936]1587 <classpath><path refid="compile.classpath"/></classpath>
[15124]1588 </javac>
1589 </target>
1590
[20209]1591 <target name="compile-classpath-jars" depends="init">
1592 <if><bool><available file="admin/cp.mf"/></bool>
1593 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
1594 </if>
1595 <if><bool><available file="${lib.java}/cp.mf"/></bool>
1596 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
1597 </if>
1598 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
1599 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
1600 </if>
1601 <if><bool><available file="${web.lib}/cp.mf"/></bool>
1602 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
1603 </if>
1604 <jar destfile="cp.jar">
1605 <manifest>
[20211]1606 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
[20209]1607 </manifest>
1608 </jar>
1609 </target>
1610
1611 <target name="clean-classpath-jars" depends="init">
1612 <delete file="admin/cp.jar"/>
1613 <delete file="${lib.java}/cp.jar"/>
1614 <delete file="${lib.jni}/cp.jar"/>
1615 <delete file="${web.lib}/cp.jar"/>
1616 <delete file="cp.jar"/>
1617 </target>
1618
1619
[15799]1620 <target name="svnupdate-web" unless="nosvn.mode">
[20930]1621 <exec executable="svn">
1622 <arg value="update"/>
[27829]1623 <arg value="${web.writablehome}"/>
[20930]1624 <arg value="-r"/><arg value="${branch.revision}"/>
1625 </exec>
[15799]1626 </target>
[15124]1627
1628 <target name="update-web" depends="init,svnupdate-web,configure-web"
1629 description="update only the web stuff (config files)"/>
1630
[32349]1631 <!-- ============ Targets concerned with https certification ================ -->
[32384]1632
1633 <target name="setup-https-cert-info">
[32349]1634 <echo>
1635 *********************************************************************
1636 NOTE TO OBTAINING A TLS (SSL) CERTIFICATE FOR HTTPS
1637 *********************************************************************
[32477]1638 A signed certificate is needed for your GS server to serve pages over https.
[32349]1639 This target will attempt to obtain a certificate for you from the official and free Certificate Authority Let's Encrypt.
[32477]1640 However, a certificate can only be obtained if you have admin/sudo permissions on this machine that you're installing Greenstone on.
[32349]1641
1642 Note that:
[32384]1643 * if you already have a certificate, then you probably don't want to be running this target but the 'ant renew-existing-https-cert' target instead, to renew your existing certificate.
[32349]1644 * if you run this target when you already have a generated certificate, the existing certificate will remain unchanged and the script will terminate with a message alerting you to this fact.
1645 </echo>
1646 </target>
[32424]1647
[32349]1648
1649 <target name="https-conditions-set">
1650 <input addproperty="https.conditions.ok" validargs="y,n">
1651 To run this target, ensure you have:
[32422]1652 * (if on unix) sudo permissions. Enter the sudo password if prompted.
[32482]1653 * (if on windows) sufficient privileges to run the included tomcat on port 80.
[32349]1654 * nothing running on port 80 when you run this target
1655 * edited the build.properties file with
1656 - tomcat.server set to the/a domain name of your server
[32482]1657 - server.protocols comma-separated list set to contain at least 'https' if not also http (the first in this list will be the default protocol)
[32465]1658 - tomcat.port.https set to a valid port number not yet in use
[32349]1659 - keystore.pass set to a password for the certification process
1660 * read the Let's Encrypt Subscriber Agreement at https://letsencrypt.org/repository/
1661 If any of the above is not possible, quit this target. Continue [y/n]?
1662 </input>
1663
1664 <condition property="quit.https.setup">
1665 <equals arg1="n" arg2="${https.conditions.ok}"/>
1666 </condition>
1667
1668 <fail if="quit.https.setup">https certification step aborted by user. Please edit build.properties to set server.protocol=http and comment out tomcat.port.https.</fail>
1669 </target>
[32424]1670
[32349]1671
[32483]1672 <target name="setup-https-cert" depends="setup-https-cert-info,https-conditions-set">
1673 <if><bool><not><matches string="${server.protocols}" pattern="https"/></not></bool>
1674 <fail>To setup https certification, the server.protocols property in file build.properties must contain 'https'</fail>
1675 </if>
1676
[32349]1677 <input addproperty="https.cert.email">Enter an email that Let's Encrypt, the certification authority, can send any important notifications to</input>
[32423]1678 <input addproperty="https.other.domains">Besides tomcat.server=${tomcat.server}, enter a comma separated list of additional domains to support, if any</input>
[32349]1679 <input addproperty="https.cert.agree" validargs="y,n">You've read the Let's Encrypt Subscriber Agreement at https://letsencrypt.org/repository/ and agree</input>
1680 <if>
1681 <bool><equals arg1="y" arg2="${https.cert.agree}"/></bool>
1682
1683 <condition property="https.cert.domains" value="${tomcat.server},${https.other.domains}" else="${tomcat.server}">
1684 <and>
1685 <isset property="https.other.domains" />
1686 <not><matches string="${https.other.domains}" pattern="^\s*$"/></not>
1687 </and>
1688 </condition>
1689
1690 <input addproperty="https.do.cert" validargs="y,n">
1691 You've agreed to the Let's Encrypt TOS with
1692 - email: ${https.cert.email}
1693 - domains: ${https.cert.domains}
1694 Looks okay? [y/n]
1695 </input>
1696 </if>
1697
1698 <if><bool><equals arg1="n" arg2="${https.do.cert}"/></bool>
1699 <echo>Not proceeding with https certification for the Greenstone 3 web server</echo>
1700 <else>
[32422]1701 <echo>Proceeding...</echo>
1702 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[32423]1703 <antcall target="setup-https-cert-windows">
1704 <param name="https.cert.renewal" value=""/><!-- for cert issuance, there are none of the additional parameters specific to cert renewal -->
1705 </antcall>
[32422]1706 </if>
1707 <if><bool><istrue value="${current.os.isunixnotmac}"/></bool>
1708 <antcall target="setup-https-cert-linux"/>
1709 </if>
[32482]1710 <if><bool><istrue value="${current.os.ismac}"/></bool>
1711 <antcall target="setup-https-cert-mac"/>
1712 </if>
[32412]1713 </else>
1714 </if>
1715
1716 </target>
1717
[32424]1718
[32412]1719 <target name="setup-https-cert-windows">
[32423]1720
[32412]1721 <echo>********** The included tomcat will be stopped, then restarted on port 80 and stopped again</echo>
1722
1723 <!-- create folder packages\tomcat\webapps\ROOT\.well-known\acme-challenge -->
1724 <mkdir dir="${packages.home}/tomcat/webapps/ROOT/.well-known/acme-challenge"/>
1725 <mkdir dir="${packages.home}/tomcat/conf/https_cert"/>
1726
[32477]1727 <!--
1728 For Windows, Greenstone can generate the account and domain keys with the openSSL we compiled up ourselves
1729 and put on SVN (at GS3/bin/windows/openssl) rather than let ZeroSSL generate these keys for the user.
1730 Letting Greenstone generate the keys may be considered more trustworthy by the user than letting a 3rd
1731 party do so. See https://zerossl.com/usage.html#First_time_run_and_regular_use for OpenSSL commands
1732 If we don't generate the keys ourselves with our OpenSSL, then ZeroSSL will do so automatically in the
1733 call to le64/32.exe further below, as it's passed in the flag generate-missing.
1734 -->
1735 <!-- We generate the account key named "privkey.key" in ${packages.home}\tomcat\conf\https_cert -->
1736 <exec executable="cmd" osfamily="windows" dir="${basedir}/bin/${os.bin.dir}/openssl/bin" spawn="false">
1737 <arg value="/c" />
1738 <arg value="openssl.exe" />
1739 <arg value="genrsa" />
1740 <arg value="-out" /><arg value="${packages.home}\tomcat\conf\https_cert\privkey.key" /><arg value="4096" />
1741 </exec>
1742
1743 <!-- Also generate the domain key (for csr-key parameter to zeroSSL's le.exe)
1744 ${packages.home}\tomcat\conf\https_cert\${tomcat.server}.key
1745 Using 2048 instead of 4096 bits for this. See https://zerossl.com/usage.html#First_time_run_and_regular_use
1746 -->
1747 <exec executable="cmd" osfamily="windows" dir="${basedir}/bin/${os.bin.dir}/openssl/bin" spawn="false">
1748 <arg value="/c" />
1749 <arg value="openssl.exe" />
1750 <arg value="genrsa" />
1751 <arg value="-out" /><arg value="${packages.home}\tomcat\conf\https_cert\${tomcat.server}.key" /><arg value="2048" />
1752 </exec>
1753
[32412]1754 <!-- stop the included tomcat (also stopping derby and solr) -->
1755 <antcall target="stop" />
1756
1757 <!-- rerun tomcat on port 80
1758 See https://ant.apache.org/manual/Tasks/antcall.html -->
1759 <antcall target="start">
[32429]1760 <param name="localhost.port.http" value="80"/>
1761 <param name="default.tomcat.port" value="80"/>
[32437]1762 <param name="local.http.url" value="http://${localhost.server.http}"/><!-- For port 80 over http, leave out port number in URL -->
[32429]1763 <param name="http.address.restriction" value=""/><!-- don't prevent public access over http of port 80 -->
[32412]1764 <param name="https.comment.out.start" value="${comment.start}"/>
1765 <param name="https.comment.out.end" value="${comment.end}"/>
1766 </antcall>
1767
1768 <!-- get the certificate: use zerossl for windows
1769 Download from https://github.com/do-know/Crypt-LE/releases,
1770 For licence see https://github.com/do-know/Crypt-LE/
1771 Usage instructions at https://zerossl.com/usage.html
1772
1773 le64 ==key "${packages.home}\tomcat\conf\https_cert\privkey.key" ==csr "${packages.home}\tomcat\conf\https_cert\${tomcat.server}.csr" ==csr-key "${packages.home}s\tomcat\conf\https_cert\${tomcat.server}.key" ==crt "${packages.home}\tomcat\conf\https_cert\${tomcat.server}.crt" ==domains "${https.cert.domains}" ==path "${packages.home}\tomcat\webapps\ROOT\.well-known\acme-challenge" ==generate-missing ==unlink ==live -export-pfx "${keystore.pass}"
1774
[32416]1775 which generates a .pfx file with the same name as the PEM certificate (.crt param below)
[32412]1776 .pfx vs .p12: https://stackoverflow.com/questions/6819079/convert-pfx-format-to-p12
1777
1778 In this case "fullchain_and_prvtkey.pfx" is generated, which is the windows value of ${keystore.file} property
[32432]1779
1780 Helpful for debugging: https://stackoverflow.com/questions/10302489/ant-script-have-exec-tag-dump-out-entire-command-line
[32412]1781 -->
1782 <exec executable="cmd" osfamily="windows" dir="${basedir}/bin/${os.bin.dir}" spawn="false">
1783 <arg value="/c" />
[32421]1784 <arg value="le${os.bitness}" />
[32412]1785 <arg value="--key" /><arg value="${packages.home}\tomcat\conf\https_cert\privkey.key" />
1786 <arg value="--csr" /><arg value="${packages.home}\tomcat\conf\https_cert\${tomcat.server}.csr" />
1787 <arg value="--csr-key" /><arg value="${packages.home}\tomcat\conf\https_cert\${tomcat.server}.key" />
[32423]1788 <!--<arg value="==crt" /><arg value="${packages.home}\tomcat\conf\https_cert\${tomcat.server}.crt" />-->
[32412]1789 <arg value="--crt" /><arg value="${packages.home}\tomcat\conf\https_cert\fullchain_and_prvtkey.crt" />
1790 <arg value="--domains" /><arg value="${https.cert.domains}" />
1791 <arg value="--path" /><arg value="${packages.home}\tomcat\webapps\ROOT\.well-known\acme-challenge" />
1792 <arg value="--generate-missing" />
1793 <arg value="--unlink" />
[32416]1794 <arg line="${https.testing}" /><!-- minus-minus-live if not testing, empty if testing. https://stackoverflow.com/questions/11840284/pass-arguments-to-apache-ant-exec-task-based-on-the-variables-value -->
[32478]1795 <!--<arg value="==export-pfx" /><arg value="${keystore.pass}" />
1796 <arg value="==tag-pfx" /><arg value="greenstone3-tomcat" />--><!--Convert the certificate (that contains the full chain AND private key) to pfx format hereafter using OpenSSL instead-->
[32482]1797 <arg line="${https.cert.renewal}" /><!-- renew command on windows/mac appends min-min-renew XX, where if the day the renewal is run is XX days within expiry, the certificate will get renewed. -->
[32422]1798 </exec>
[32482]1799
[32412]1800 <!-- stop the tomcat running on port 80 -->
1801 <antcall target="stop">
[32429]1802 <param name="localhost.port.http" value="80"/>
1803 <param name="default.tomcat.port" value="80"/>
[32437]1804 <param name="local.http.url" value="http://${localhost.server.http}"/><!-- For port 80 over http, leave out port number in URL -->
[32429]1805 <param name="http.address.restriction" value=""/>
[32412]1806 <param name="https.comment.out.start" value="${comment.start}"/>
1807 <param name="https.comment.out.end" value="${comment.end}"/>
1808 </antcall>
[32482]1809
[32478]1810 <!-- Use OpenSSL instead of ZeroSSL to convert the certificate to the .pfx format that tomcat likes, using this cmd:
1811 GS3/bin/windows/openssl/bin/openssl.exe pkcs12 -inkey domain.key -in domain.crt -passin pass:pwd -passout pass:pwd -export -out ${keystore.file}
1812 GS3/bin/windows/openssl/bin/openssl.exe pkcs12 -inkey domain.key -in domain.crt -password pass:pwd -export -out ${keystore.file}
1813 where on windows, keystore.file = fullchain_and_prvtkey.pfx
1814 -->
1815 <exec executable="cmd" osfamily="windows" dir="${basedir}/bin/${os.bin.dir}/openssl/bin" spawn="false">
1816 <arg value="/c" />
1817 <arg value="openssl.exe" />
1818 <arg value="pkcs12" />
1819 <arg value="-inkey" /><arg value="${packages.home}\tomcat\conf\https_cert\${tomcat.server}.key" />
1820 <arg value="-in" /><arg value="${packages.home}\tomcat\conf\https_cert\fullchain_and_prvtkey.crt" />
1821 <arg value="-export" />
1822 <arg value="-out" /><arg value="${packages.home}\tomcat\conf\https_cert\${keystore.file}" />
1823 <arg value="-name"/><arg value="greenstone3-tomcat"/><!-- See https://stackoverflow.com/questions/808669/convert-a-cert-pem-certificate-to-a-pfx-certificate -->
1824 <arg value="-password"/><arg value="pass:${keystore.pass}"/>
1825 </exec>
1826
[32412]1827 </target>
[32483]1828
1829
1830 <!-- On Mac as on Linux, we need sudo permissions to setup https certification.
1831 But unlike on Linux, on Mac we only need to sudo when running tomcat on port 80
1832 and when stopping tomcat running on port 80. But we don't need to sudo on a Mac when calling le.pl.
1833 This also means all the files in https_cert have the correct (user, not root) permissions.
1834 -->
[32482]1835 <target name="setup-https-cert-mac">
1836
1837 <echo>********** The included tomcat will be stopped, then restarted on port 80 and stopped again</echo>
1838
1839 <!-- create folder packages\tomcat\webapps\ROOT\.well-known\acme-challenge -->
1840 <mkdir dir="${packages.home}/tomcat/webapps/ROOT/.well-known/acme-challenge"/>
1841 <mkdir dir="${packages.home}/tomcat/conf/https_cert"/>
[32424]1842
[32482]1843 <!--
1844 See comments under setup-https-cert-WINDOWS
1845 -->
1846 <!-- We generate the account key named "privkey.key" in ${packages.home}\tomcat\conf\https_cert -->
1847 <if><bool><not><available file="${packages.home}/tomcat/conf/https_cert/privkey.key"/></not></bool>
1848 <exec executable="openssl" osfamily="mac" dir="${basedir}/bin/${os.bin.dir}/openssl/bin" spawn="false">
1849 <arg value="genrsa" />
1850 <arg value="-out" /><arg value="${packages.home}/tomcat/conf/https_cert/privkey.key" /><arg value="4096" />
1851 </exec>
1852 </if>
1853
1854 <!-- Also generate the domain key (for csr-key parameter to zeroSSL's le.pl)
1855 ${packages.home}\tomcat\conf\https_cert\${tomcat.server}.key
1856 Using 2048 instead of 4096 bits for this. See https://zerossl.com/usage.html#First_time_run_and_regular_use
1857 -->
1858 <if><bool><not><available file="${packages.home}/tomcat/conf/https_cert/${tomcat.server}.key"/></not></bool>
1859 <exec executable="openssl" osfamily="mac" dir="${basedir}/bin/${os.bin.dir}/openssl/bin" spawn="false">
1860 <arg value="genrsa" />
1861 <arg value="-out" /><arg value="${packages.home}/tomcat/conf/https_cert/${tomcat.server}.key" /><arg value="2048" />
1862 </exec>
1863 </if>
1864
1865 <!-- stop the included tomcat (also stopping derby and solr) -->
1866 <antcall target="stop" />
1867
1868 <!-- rerun tomcat on port 80
1869 See https://ant.apache.org/manual/Tasks/antcall.html -->
1870 <antcall target="start">
1871 <param name="sudo.or.not" value="/usr/bin/sudo" />
1872 <param name="localhost.port.http" value="80"/>
1873 <param name="default.tomcat.port" value="80"/>
1874 <param name="local.http.url" value="http://${localhost.server.http}"/><!-- For port 80 over http, leave out port number in URL -->
1875 <param name="http.address.restriction" value=""/><!-- don't prevent public access over http of port 80 -->
1876 <param name="https.comment.out.start" value="${comment.start}"/>
1877 <param name="https.comment.out.end" value="${comment.end}"/>
1878 </antcall>
1879
1880 <!-- get the certificate: use zerossl's le.pl compiled up for Mac.
1881 For further notes, see under setup-https-cert-WINDOWS
1882 -->
1883
1884 <exec executable="perl" osfamily="mac" dir="${gs2build.home}/perllib/cpan/Crypt/LE/bin" spawn="false">
1885 <env key="PERL5LIB" value="${gs2build.home}/perllib/cpan${path.separator}${gs2build.home}/perllib/cpan/perl-5.18"/>
1886 <arg value="-S" />
1887 <arg value="${gs2build.home}/perllib/cpan/Crypt/LE/bin/le.pl" />
1888 <arg value="--key" /><arg value="${packages.home}/tomcat/conf/https_cert/privkey.key" />
1889 <arg value="--csr" /><arg value="${packages.home}/tomcat/conf/https_cert/${tomcat.server}.csr" />
1890 <arg value="--csr-key" /><arg value="${packages.home}/tomcat/conf/https_cert/${tomcat.server}.key" />
1891 <!--<arg value="==crt" /><arg value="${packages.home}/tomcat/conf/https_cert/${tomcat.server}.crt" />-->
1892 <arg value="--crt" /><arg value="${packages.home}/tomcat/conf/https_cert/fullchain_and_prvtkey.crt" />
1893 <arg value="--domains" /><arg value="${https.cert.domains}" />
1894 <arg value="--path" /><arg value="${packages.home}/tomcat/webapps/ROOT/.well-known/acme-challenge" />
1895 <arg value="--generate-missing" />
1896 <arg value="--unlink" />
1897 <arg line="${https.testing}" /><!-- minus-minus-live if not testing, empty if testing. https://stackoverflow.com/questions/11840284/pass-arguments-to-apache-ant-exec-task-based-on-the-variables-value -->
1898 <!--<arg value="==export-pfx" /><arg value="${keystore.pass}" />
1899 <arg value="==tag-pfx" /><arg value="greenstone3-tomcat" />--><!-- not sure if this generates a keystore filename with ext .p12 or .pfx for Macs -->
1900 <arg line="${https.cert.renewal}" /><!-- renew command on windows/mac appends min-min-renew XX, where if the day the renewal is run is XX days within expiry, the certificate will get renewed. -->
1901 </exec>
1902
1903 <!-- stop the tomcat running on port 80 -->
1904 <antcall target="stop">
1905 <param name="sudo.or.not" value="/usr/bin/sudo" />
1906 <param name="localhost.port.http" value="80"/>
1907 <param name="default.tomcat.port" value="80"/>
1908 <param name="local.http.url" value="http://${localhost.server.http}"/>
1909 <param name="http.address.restriction" value=""/>
1910 <param name="https.comment.out.start" value="${comment.start}"/>
1911 <param name="https.comment.out.end" value="${comment.end}"/>
1912 </antcall>
1913
1914 <!-- Use OpenSSL instead of ZeroSSL to convert the certificate to the .pfx format that tomcat likes, using this cmd:
1915 GS3/bin/windows/openssl/bin/openssl.exe pkcs12 -inkey domain.key -in domain.crt -passin pass:pwd -passout pass:pwd -export -out ${keystore.file}
1916 GS3/bin/windows/openssl/bin/openssl.exe pkcs12 -inkey domain.key -in domain.crt -password pass:pwd -export -out ${keystore.file}
1917 where on windows, keystore.file = fullchain_and_prvtkey.pfx
1918 -->
1919 <exec executable="openssl" osfamily="mac" dir="${basedir}/bin/${os.bin.dir}/openssl/bin" spawn="false">
1920 <arg value="pkcs12" />
1921 <arg value="-inkey" /><arg value="${packages.home}/tomcat/conf/https_cert/${tomcat.server}.key" />
1922 <arg value="-in" /><arg value="${packages.home}/tomcat/conf/https_cert/fullchain_and_prvtkey.crt" />
1923 <arg value="-export" />
1924 <arg value="-out" /><arg value="${packages.home}/tomcat/conf/https_cert/${keystore.file}" />
1925 <arg value="-name"/><arg value="greenstone3-tomcat"/><!-- See https://stackoverflow.com/questions/808669/convert-a-cert-pem-certificate-to-a-pfx-certificate -->
1926 <arg value="-password"/><arg value="pass:${keystore.pass}"/>
1927 </exec>
1928
1929 </target>
1930
1931
1932
[32412]1933 <target name="setup-https-cert-linux">
[32350]1934 <!-- Running as
1935 ./certbot-auto certonly ==standalone ==preferred-challenges http ==email EMAIL -d DOMAINS
1936 expects input from stdin to accept (A) ToS and say Yes (Y) to sharing email.
1937 We can run in non-interactive mode as the user has at this stage already agreed
1938 to LetsEncrypt's Terms of Service and provided an email address.
1939 -->
[32349]1940 <exec executable="/bin/bash" dir="${basedir}/bin/${os.bin.dir}" failonerror="true">
1941 <arg value="./certbot-auto"/>
1942 <arg value="certonly"/>
[32381]1943 <arg line="${https.testing}"/><!-- https://stackoverflow.com/questions/11840284/pass-arguments-to-apache-ant-exec-task-based-on-the-variables-value -->
[32349]1944 <arg value="--standalone"/>
1945 <arg value="--non-interactive"/>
1946 <arg value="--agree-tos"/>
1947 <arg value="--preferred-challenges"/><arg value="http"/>
1948 <arg value="--email"/><arg value="${https.cert.email}"/>
1949 <arg value="--domains"/><arg value="${https.cert.domains}"/>
1950 </exec>
1951
1952 <!-- sudo openssl pkcs12 -export -out /tmp/DOMAIN_fullchain_and_key.p12 \
1953 -in /etc/letsencrypt/live/DOMAIN/fullchain.pem \
1954 -inkey /etc/letsencrypt/live/DOMAIN/privkey.pem \
1955 -name tomcat
[32350]1956 Must run as sudo because only admin has access to the pem files that admin
1957 generated in /etc/letsencrypt
[32349]1958 See https://computingforgeeks.com/tomcat-7-with-letsencrypt-ssl-certificate/
1959 but also https://community.letsencrypt.org/t/using-lets-encrypt-with-tomcat/41082
1960 which bypasses the step to generate the java keystore jks file
1961 and uses openssl to generate a pfx file instead of a p12 file
1962 -->
1963
1964 <exec executable="sudo" dir="/tmp" failonerror="true">
[32350]1965 <arg value="${basedir}/bin/${os.bin.dir}/openssl/bin/openssl"/>
1966 <arg value="pkcs12"/>
1967 <arg value="-export"/>
1968 <arg value="-out"/><arg value="/tmp/${tomcat.server}_fullchain_and_key.p12"/>
1969 <arg value="-in"/><arg value="/etc/letsencrypt/live/${tomcat.server}/fullchain.pem"/>
1970 <arg value="-inkey"/><arg value="/etc/letsencrypt/live/${tomcat.server}/privkey.pem"/>
[32478]1971 <arg value="-name"/><arg value="greenstone3-tomcat"/>
[32350]1972 <arg value="-password"/><arg value="pass:${keystore.pass}"/>
[32349]1973 </exec>
1974
1975 <!-- Finally, mkdir ${packages.home}/tomcat/conf/https_cert
1976 and copy the file /tmp/${tomcat.server}_fullchain_and_key.p12 into it
[32432]1977 and rename to a slightly shorter and simpler name,
1978 see https://stackoverflow.com/questions/8971187/ant-renaming-while-copying-file
[32349]1979 The file in tmp has root permissions. But copying it from tmp into
1980 the local account will give the copy local account permissions.
1981 Then sudo to remove the original copy in /tmp
1982 -->
1983 <mkdir dir="${packages.home}/tomcat/conf/https_cert"/>
1984 <!--<copy file="/tmp/${tomcat.server}_fullchain_and_key.p12" todir="${packages.home}/tomcat/conf/https_cert"/>-->
1985 <copy todir="${packages.home}/tomcat/conf/https_cert">
1986 <fileset file="/tmp/${tomcat.server}_fullchain_and_key.p12"/>
[32412]1987 <globmapper from="${tomcat.server}_fullchain_and_key.p12" to="${keystore.file}"/>
[32349]1988 </copy>
1989
1990 <exec executable="sudo" dir="/tmp" failonerror="true">
[32412]1991 <arg line="rm -f /tmp/${tomcat.server}_fullchain_and_key.p12" />
1992 </exec>
[32349]1993
1994 </target>
[32424]1995
1996
1997 <!-- Revoke the certificate and remove it, including folders.
1998 See https://certbot.eff.org/docs/using.html#revoking-certificates
1999 which also states "if a certificate is a test certificate obtained via the
2000 ==staging or ==test-cert flag, that flag must be passed to the revoke subcommand."
2001 -->
[32483]2002 <target name="remove-https-cert">
[32424]2003 <echo>
2004 NOTE: If you're on Linux, you need to have sudo permissions to execute this target.
2005 Enter the sudo password if prompted.
2006 </echo>
2007 <!--
2008 On linux, we use certbot-auto.
2009 It says at https://github.com/certbot/certbot/issues/1741
2010 "you shouldn't run letsencrypt-auto [now called certbot-auto] as superuser,
2011 because the program will invoke sudo when it needs to automatically."
2012 We need to send Y(es) as inputstring to confirm that the
2013 /etc/letsencrypt/live/${tomcat.server} folder can be deleted.
2014 Note osfamily="unix" is separate from osfamily="mac", which comes out handy here as we haven't set up certbot-auto for mac (yet).
2015 -->
[32482]2016 <exec executable="./certbot-auto" os="${os.linux},${os.solaris}" dir="${basedir}/bin/${os.bin.dir}" failonerror="true" inputstring="Y">
[32424]2017 <arg value="revoke"/>
2018 <arg line="${https.testing}"/>
2019 <arg value="--cert-path"/><arg value="/etc/letsencrypt/live/${tomcat.server}/cert.pem"/>
2020 </exec>
2021 <!-- The above command already deletes the folder when Y(es) was passed in. Explicitly deleting:
2022 <exec executable="./certbot-auto" dir="${basedir}/bin/${os.bin.dir}" failonerror="true">
2023 <arg value="delete"/>
2024 <arg value="==cert-name"/><arg value="${tomcat.server}"/>
2025 </exec>
2026 -->
2027
[32482]2028 <!-- On Windows and Mac, we use zeroSSl. For the revoke command, see https://zerossl.com/usage.html#Certificate_revocation -->
2029 <exec executable="cmd" osfamily="windows" dir="${basedir}/bin/${os.bin.dir}" spawn="false">
[32424]2030 <arg value="/c" />
[32482]2031 <arg value="le${os.bitness}" />
2032 <arg value="--key" /><arg value="${packages.home}\tomcat\conf\https_cert\privkey.key" />
[32424]2033 <arg value="--crt" /><arg value="${packages.home}\tomcat\conf\https_cert\fullchain_and_prvtkey.crt"/>
[32482]2034 <arg value="--revoke"/>
2035 <arg line="${https.testing}"/>
2036 </exec>
[32424]2037
[32482]2038 <!-- On Mac, we use the le.pl we compiled up (Crypt::LE) and which needs to have PERL5LIB set correctly to run -->
2039 <exec executable="perl" osfamily="mac" dir="${gs2build.home}/perllib/cpan/Crypt/LE/bin" spawn="false">
2040 <env key="PERL5LIB" value="${gs2build.home}/perllib/cpan${path.separator}${gs2build.home}/perllib/cpan/perl-5.18"/>
2041 <arg value="-S" />
2042 <arg value="${gs2build.home}/perllib/cpan/Crypt/LE/bin/le.pl" />
2043 <arg value="--key" /><arg value="${packages.home}/tomcat/conf/https_cert/privkey.key" />
2044 <arg value="--crt" /><arg value="${packages.home}/tomcat/conf/https_cert/fullchain_and_prvtkey.crt"/>
2045 <arg value="--revoke"/>
2046 <arg line="${https.testing}"/>
2047 </exec>
2048
[32424]2049 <!-- And remove the https_cert folder -->
2050 <delete dir="${packages.home}/tomcat/conf/https_cert"/>
2051 </target>
2052
2053
2054 <!-- Renewing existing https certificate
2055 Linux:
2056 https://certbot.eff.org/docs/using.html#renewing-certificates
2057 ./path/to/GS3/bin/linux/certbot-auto renew ==quiet ==no-self-upgrade
2058 Windows: reuse Windows issuance target
2059 see https://zerossl.com/usage.html#Certificate_renewal
2060 -->
2061 <target name="renew-existing-https-cert">
2062 <echo>
2063 NOTE: To run this target,
[32482]2064 * ensure nothing is running on port 80
2065 * if you're on Linux or Mac, you need to have sudo permissions. Enter the sudo password if prompted.
[32349]2066
[32424]2067 If you want your cronjob to renew a certificate, you can add pre and post hooks
2068 refer to https://certbot.eff.org/docs/using.html#renewing-certificates
2069 For more information run:
2070 ./path/to/GS3/bin/linux/certbot-auto --help renew
2071 </echo>
[32482]2072 <exec executable="./certbot-auto" os="${os.linux},${os.solaris}" dir="${basedir}/bin/${os.bin.dir}" failonerror="true">
[32424]2073 <arg value="renew"/>
2074 <arg value="--quiet"/>
2075 <arg value="--no-self-upgrade"/>
2076 </exec>
2077
[32482]2078 <!-- For renewal on Windows or Mac, we use ZeroSSL as intermediary between GS3 and Let's Encrypt.
2079 And when using ZeroSSL we need to re-run the original (issuance) command and append "min-min-renew XX" to it,
2080 where if it's within XX days of expiry, the certificate will get renewed.
2081 See https://zerossl.com/usage.html#Certificate_renewal -->
2082 <if><bool><or>
2083 <istrue value="${current.os.iswindows}"/>
2084 <istrue value="${current.os.ismac}"/>
2085 </or></bool>
2086
2087 <input addproperty="https.other.domains">Enter a comma separated list of additional domains besides tomcat.server=${tomcat.server} that you registered on issuance, if any</input>
2088 <condition property="https.cert.domains" value="${tomcat.server},${https.other.domains}" else="${tomcat.server}">
2089 <and>
2090 <isset property="https.other.domains" />
2091 <not><matches string="${https.other.domains}" pattern="^\s*$"/></not>
2092 </and>
2093 </condition>
2094 <if><bool><istrue value="${current.os.iswindows}"/></bool>
2095 <antcall target="setup-https-cert-windows">
2096 <param name="https.cert.renewal" value="--renew 10"/>
2097 </antcall>
2098 <else>
2099 <antcall target="setup-https-cert-mac">
2100 <param name="https.cert.renewal" value="--renew 10"/>
2101 </antcall>
2102 </else>
2103 </if>
2104 </if>
[32424]2105 </target>
2106
[15799]2107 <!-- ======================= Tomcat Targets ========================== -->
[15124]2108
2109 <!-- this target downloads and installs Tomcat -->
[25131]2110 <!-- we download tomcat (version 7 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
[20089]2111 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
[25131]2112 description="downloads the appropriate version of Tomcat (Tomcat 5 if using Java 1.4, Tomcat 7 if using Java 1.5 or higher). If you want to change which version of Java you are using between 1.4 and 1.5/7 then you need to run prepare-tomcat">
2113 <if>
[16951]2114 <bool>
2115 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
2116 </bool>
2117
2118 <!-- check that packages dir is there -->
2119 <mkdir dir="${packages.home}"/>
2120 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
2121 dest="${packages.home}/${tomcat.version}.zip"
2122 usetimestamp="true"/>
2123 <unzip src="${packages.home}/${tomcat.version}.zip"
2124 dest="${packages.home}"/>
[30723]2125
[20085]2126 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
2127 we would need to have the tomcat compat package to work with Java 1.4-->
2128 <if>
2129 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
2130 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
2131 dest="${packages.home}/${tomcat.version}-compat.zip"
2132 usetimestamp="true"/>
2133 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
2134 dest="${packages.home}"/>
2135 </if>
2136
[16951]2137 <!-- delete any existing tomcat -->
2138 <delete dir="${packages.home}/tomcat"/>
2139 <move todir="${packages.home}/tomcat">
2140 <fileset dir="${packages.home}/${tomcat.version}"/>
2141 </move>
[30723]2142
2143 <!-- To avoid the CGI permissions error appearing continuously in the (localhost) log,
[30725]2144 need privileged=true set in the root context.xml file too, not just greenstone context file.
2145 See http://stackoverflow.com/questions/9845936/tomcat-v7-0-load-exception-marking-servlet-ssi-as-unavailable/10305471#10305471
2146 For usage of IfTask IsLessThan: http://antelope.stage.tigris.org/nonav/docs/manual/bk03ch05s02.html -->
[30723]2147 <if><bool><not><islessthan arg1="${tomcat.version.major}" arg2="7"/></not></bool>
[32315]2148 <copy file="${basedir}/resources/tomcat/root_context.xml.in" tofile="${packages.home}/tomcat/conf/context.xml" overwrite="true" />
[30723]2149 </if>
2150
2151
[25133]2152 <!--
[16951]2153 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
2154 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
2155 overwrite="true"/>
2156 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
2157 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
2158 overwrite="true"/>
[25133]2159 -->
[16951]2160 <!-- make sure we have execute permission for the .sh files -->
2161 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
2162 includes="*.sh"/>
2163
2164 <echo file="${packages.home}/tomcat/.flagfile">
2165 the timestamp of this file is the time that tomcat was extracted from the zip files.
2166 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
2167 </echo>
2168
[20089]2169 <!-- this is not strictly a prepare tomcat thing, but if one changes
2170 Java, then they need to change tomcat as well, so might as well call
2171 it here -->
2172 <antcall target="configure-java-version"/>
[16951]2173 <else>
2174 <echo>Tomcat has been prepared, will not prepare</echo>
2175 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
2176 </else>
2177
2178 </if>
2179
[30037]2180 </target>
[15124]2181
2182 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
2183
[32338]2184 <target name="configure-tomcat-local" depends="init,perl-for-building" if="tomcat.islocal">
[15124]2185 <!-- re-setup the server.xml file -->
[32310]2186 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml.in"
[20079]2187 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
[15124]2188 <filterset>
[16936]2189 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
[32346]2190 <filter token="https.redirect.port" value="${https.redirect.port}"/>
[32429]2191 <filter token="localhost.port.http" value="${localhost.port.http}"/>
[32346]2192 <filter token="tomcat.port.https" value="${tomcat.port.https}"/>
[32416]2193 <!-- Relative path preferred for keystore.file, in case tomcat is moved elsewhere -->
2194 <!--<filter token="keystore.file" value="conf/https_cert/${tomcat.server}.jks" />-->
2195 <!--ON UNIX: <filter token="keystore.file" value="conf/https_cert/fullchain_and_prvtkey.p12" />-->
[32412]2196 <!--ON WINDOWS: <filter token="keystore.file" value="conf/https_cert/fullchain_and_prvtkey.pfx" />-->
2197 <filter token="keystore.file" value="conf/https_cert/${keystore.file}" />
[32349]2198 <!-- tomcat Connector's keystoreType param defaults to JKS (Java keystore), see https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
2199 We'll follow the instructions at https://community.letsencrypt.org/t/using-lets-encrypt-with-tomcat/41082,
2200 https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/
2201 and https://computingforgeeks.com/tomcat-7-with-letsencrypt-ssl-certificate/
2202 (minus the keytool step) and use the PKCS12 file generated by openssl directly,
2203 instead of an additional step to generate the java keystore file from that -->
2204 <filter token="keystore.type" value="PKCS12"/>
[32346]2205 <filter token="keystore.pass" value="${keystore.pass}"/>
[32429]2206 <!--
2207 if server.protocols doesn't contain http, then http is only to be locally available (e.g. for solr servlet on 127.0.0.1)
2208 In that case, see https://serverfault.com/questions/218666/how-to-configure-tomcat-to-only-listen-to-127-0-0-1
2209 -->
[32436]2210 <filter token="http.address.restriction" value="${http.address.restriction}"/>
[32346]2211 <filter token="https.comment.out.start" value="${https.comment.out.start}"/>
2212 <filter token="https.comment.out.end" value="${https.comment.out.end}"/>
[15124]2213 </filterset>
2214 </copy>
[30035]2215
2216 <!-- set up the solr context -->
[30036]2217
[30038]2218 <!-- First work out the IPv4 address for this machine -->
2219 <exec executable="${basedir}/bin/script/IPv4.sh" os="${os.unix}" failonerror="false" outputproperty="ipv4.val">
2220 <arg value="-format-for-tomcat-context"/>
2221 </exec>
2222 <exec executable="${basedir}/bin/script/IPv4.bat" osfamily="windows" failonerror="false" outputproperty="ipv4.val">
2223 <arg value="-format-for-tomcat-context"/>
2224 </exec>
[30036]2225
[30035]2226 <copy file="${basedir}/ext/solr/solr-tomcat-context.xml.in" tofile="${packages.home}/tomcat/conf/Catalina/localhost/solr.xml" overwrite="true">
2227 <filterset>
[32426]2228 <filter token="solr.context" value="${solr.context}"/>
[30035]2229 <filter token="gsdl3webhome" value="${web.writablehome}"/>
2230 <filter token="tomcathome" value="${basedir}/packages/tomcat"/>
[30036]2231 <filter token="IPv4" value="${ipv4.val}"/>
[30035]2232 </filterset>
2233 </copy>
2234
[28297]2235 <!-- set up the greenstone3 context, it may have a custom name specified in build.properties -->
[30673]2236 <if><bool><not><equals arg1="greenstone3" arg2="${greenstone.context}"></equals></not></bool>
[32310]2237 <copy file="${basedir}/resources/tomcat/greenstone3.xml.in" tofile="${basedir}/resources/tomcat/${greenstone.context}.xml.in" overwrite="true"/>
[28297]2238 </if>
[32310]2239 <copy file="${basedir}/resources/tomcat/${greenstone.context}.xml.in" tofile="${packages.home}/tomcat/conf/Catalina/localhost/${greenstone.context}.xml" overwrite="true">
[15124]2240 <filterset>
[16936]2241 <filter token="gsdl3webhome" value="${web.home}"/>
[27829]2242 <filter token="gsdl3webwritablehome" value="${web.writablehome}"/>
[29845]2243 <filter token="privilegedattribute" value="${privileged.attribute}"/>
2244 <filter token="allowedIPs" value="${allowed.IPs}"/>
[29977]2245 <filter token="derbyserver" value="${derby.server}"/>
[29903]2246 <filter token="derbyserverport" value="${derby.server.port}"/>
[15124]2247 </filterset>
2248 </copy>
[28297]2249 <if>
2250 <bool>
2251 <and>
2252 <available file="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml"/>
[30673]2253 <not><equals arg1="greenstone3" arg2="${greenstone.context}"></equals></not>
[28297]2254 </and>
2255 </bool>
2256 <delete file="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml"/>
2257 </if>
[25570]2258
[27860]2259 <!-- set up the greenstone3 web.xml file -->
[32310]2260 <copy file="${basedir}/resources/tomcat/web.xml.in" tofile="${packages.home}/tomcat/conf/web.xml" overwrite="true">
[27860]2261 <filterset>
2262 <filter token="perlpath" value="${perl.path}"/>
2263 </filterset>
2264 </copy>
[15124]2265 </target>
[28297]2266
[15124]2267 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
2268 <!-- re-setup the server.xml file -->
2269 <!-- need to edit the config file, or do we get the user to do this???-->
2270 </target>
[26495]2271
[27860]2272 <target name="configure-solr-ext" depends="init" >
2273 <!-- re-setup the web/ext/solr/solr.xml file -->
[28178]2274 <copy file="${web.home}/ext/solr/solr.xml.in"
[27866]2275 tofile="${gsdl3.writablehome}/ext/solr/solr.xml" filtering="true" overwrite="true">
[27860]2276 <filterset>
2277 <filter token="gsdl3.home" value="${src.gsdl3.home.unix}"/>
2278 <filter token="gsdl3.writablehome" value="${src.gsdl3.writablehome.unix}"/>
2279 </filterset>
2280 </copy>
2281 </target>
[22551]2282
[26495]2283 <!-- This target runs tomcat's "bin/catalina.bat(.sh) jpda start"
2284 to allow debugging the running GS3 server in Eclipse. See the instructions at
2285 http://www.wikijava.org/wiki/Debugging_a_servlet_with_tomcat_and_Eclipse_tutorial
2286 on how to use this with eclipse
2287 -->
[32338]2288 <target name="debug-start-tomcat" description="Startup Tomcat for debugger" depends="init" if="tomcat.islocal">
[26495]2289 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
2290 <property name="tomcat.path" refid="local.tomcat.path"/>
2291
2292 <if><bool>
2293 <isset property="fedora.maxpermsize"/></bool>
[30303]2294 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts} ${fedora.maxpermsize}"/>
[26495]2295 <else>
[30303]2296 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts}"/>
[26495]2297 </else>
2298 </if>
2299
[27829]2300 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
2301 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
[26495]2302
2303 <exec executable="${catalina.home}/bin/catalina.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
2304 <arg value="jpda" />
2305 <arg value="start" />
2306 <env key="JPDA_ADDRESS" value="8000"/> <!-- for debugging Tomcat in Eclipse -->
2307 <env key="JPDA_TRANSPORT" value="dt_socket"/> <!-- for debugging Tomcat in Eclipse -->
2308 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
2309 <env key="PATH" path="${tomcat.path}"/>
2310 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
2311 <env key="CATALINA_HOME" value="${catalina.home}"/>
2312 <env key="CLASSPATH" path="${tomcat.classpath}"/>
2313 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
2314 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
2315 <env key="WNHOME" path="${wn.home}"/>
2316 <env key="FEDORA_HOME" path="${fedora.home}"/>
2317 </exec>
[28044]2318 <exec executable="${catalina.home}/bin/catalina.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="true">
[26495]2319 <arg value="jpda" />
2320 <arg value="start" />
2321 <env key="JPDA_ADDRESS" value="8000"/> <!-- for debugging Tomcat in Eclipse -->
2322 <env key="JPDA_TRANSPORT" value="dt_socket"/> <!-- for debugging Tomcat in Eclipse -->
2323 <env key="GSDLOS" value="windows"/>
2324 <env key="GSDL3HOME" value="${basedir}"/>
2325 <env key="Path" path="${tomcat.path}"/>
2326 <env key="PATH" path="${tomcat.path}"/>
2327 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
2328 <env key="CATALINA_HOME" value="${catalina.home}"/>
2329 <env key="CLASSPATH" path="${tomcat.classpath}"/>
2330 <env key="FEDORA_HOME" path="${fedora.home}"/>
2331 </exec>
2332 <!-- wait for the server to startup in case other targets need it running -->
2333 <waitfor maxwait="5" maxwaitunit="second">
2334 <and>
[32429]2335 <socket server="${tomcat.server}" port="${default.tomcat.port}"/>
2336 <!--<http url="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}/index.html"/>-->
2337 <http url="${local.http.url}${app.path}/index.html"/>
[26495]2338 </and>
2339 </waitfor>
2340 </target>
[23854]2341
[30013]2342 <target name="start-tomcat" description="Startup only Tomcat" depends="check-tomcat-started">
[23854]2343
[30013]2344 <if><bool><istrue value="${tomcat.isstarted}"/></bool>
[29988]2345 <echo>**************************************</echo>
[32429]2346 <echo>A WEB SERVER IS ALREADY RUNNING ON ${default.server.protocol}://${tomcat.server}:${default.tomcat.port} (${local.http.url}). NOT STARTING.</echo>
[29988]2347 <echo>**************************************</echo>
2348 <else>
[30013]2349 <antcall target="force-start-tomcat"/>
2350 </else>
2351 </if>
2352 </target>
2353
2354 <!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
[32338]2355 <target name="force-start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
[30013]2356
[15799]2357 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
[15124]2358 <property name="tomcat.path" refid="local.tomcat.path"/>
[25095]2359
[26359]2360 <if><bool>
2361 <isset property="fedora.maxpermsize"/></bool>
[30303]2362 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts} ${fedora.maxpermsize}"/>
[26359]2363 <else>
[30303]2364 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts}"/>
[26359]2365 </else>
2366 </if>
2367
[27829]2368 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
2369 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
[28043]2370
2371 <!-- using osfamily instead of testing os against os.windows list of recognised windows versions
[28044]2372 so that future windows versions are included. See http://simonharrer.wordpress.com/tag/osfamily/
2373 Can't use the osfamily test for linux-type machines as a group since osfamily=unix is separate from osfamily=mac,
2374 see http://ant-contrib.sourceforge.net/tasks/tasks/osfamily.html -->
[28043]2375
[32482]2376 <!--<exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">-->
2377 <exec executable="${sudo.or.not}" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]2378 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
2379 <env key="GSDL3HOME" value="${basedir}"/>
2380 <env key="PATH" path="${tomcat.path}"/>
2381 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
2382 <env key="CATALINA_HOME" value="${catalina.home}"/>
2383 <env key="CLASSPATH" path="${tomcat.classpath}"/>
2384 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
[22184]2385 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
[15124]2386 <env key="WNHOME" path="${wn.home}"/>
[26433]2387 <env key="FEDORA_HOME" path="${fedora.home}"/>
[32482]2388 <arg value="${catalina.home}/bin/startup.sh"/>
[15124]2389 </exec>
[28043]2390 <exec executable="${catalina.home}/bin/startup.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="true">
[15124]2391 <env key="GSDLOS" value="windows"/>
2392 <env key="GSDL3HOME" value="${basedir}"/>
2393 <env key="Path" path="${tomcat.path}"/>
2394 <env key="PATH" path="${tomcat.path}"/>
2395 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
[16628]2396 <env key="CATALINA_HOME" value="${catalina.home}"/>
[15124]2397 <env key="CLASSPATH" path="${tomcat.classpath}"/>
[26433]2398 <env key="FEDORA_HOME" path="${fedora.home}"/>
[15124]2399 </exec>
2400 <!-- wait for the server to startup in case other targets need it running -->
2401 <waitfor maxwait="5" maxwaitunit="second">
2402 <and>
[32429]2403 <socket server="${tomcat.server}" port="${default.tomcat.port}"/>
2404 <!--<http url="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}/index.html"/>-->
2405 <http url="${local.http.url}${app.path}/index.html"/>
[15124]2406 </and>
2407 </waitfor>
[29988]2408
[15124]2409 </target>
2410
[22551]2411 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
[32338]2412 <target name="reconfigure" description="Reconfigure the message router">
[22551]2413 <waitfor maxwait="5" maxwaitunit="second">
[32429]2414 <!--<http url="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>-->
2415 <http url="${local.http.url}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
[22551]2416 </waitfor>
2417 </target>
2418
2419 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
[32338]2420 <target name="reconfigure-collection" description="Reconfigure the collection">
[22551]2421 <waitfor maxwait="5" maxwaitunit="second">
[32429]2422 <!--<http url="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>-->
2423 <http url="${local.http.url}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
[22551]2424 </waitfor>
2425 </target>
2426
[15124]2427 <!-- windows: do we want to launch a webrowser?? -->
[25418]2428 <!-- shouldn't this test whether anything is running first?
2429 It's safer to always attempt to stop tomcat: that way we won't be dependent on the right time
2430 to check whether the server is stopped or still running before attempting to start again.
2431 This target, which was recently called force-stop-tomcat for a while but is back to being
2432 called stop-tomcat, now hides the Java exception output that appears whenever tomcat is already
2433 stopped as happens when stop-tomcat is called consecutively. -->
[25420]2434 <target name="force-stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
[32482]2435 <!--<exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">-->
2436 <exec executable="${sudo.or.not}" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[26433]2437 <env key="FEDORA_HOME" path="${fedora.home}"/>
[15124]2438 <env key="CATALINA_HOME" value="${catalina.home}"/>
[32482]2439 <arg value="${catalina.home}/bin/shutdown.sh"/>
[25418]2440 <arg line=">/dev/null 2>&amp;1"/>
[15124]2441 </exec>
[28043]2442 <exec executable="${catalina.home}/bin/shutdown.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="false">
[26433]2443 <env key="FEDORA_HOME" path="${fedora.home}"/>
[16628]2444 <env key="CATALINA_HOME" value="${catalina.home}"/>
[25418]2445 <arg line=">nul 2>&amp;1"/>
[25443]2446 </exec>
[15124]2447 </target>
2448
[25418]2449 <!-- Can also try the "socket" condition in place of the "http" condition
2450 And also use a <waitfor> in place of <condition>, such as:
2451 <waitfor maxwait="5" maxwaitunit="second" timeoutproperty="tomcat.isstopped"><http url="..."/></waitfor>
[25420]2452 The http URL resolves to host:port/greenstone3
2453 Condition uses <http/> rather than <socket/> for testing, since if the server was stopped, the socket
2454 might still be in use for some moments. We test the URL with the http condition since it's likelier to
2455 fail sooner if the server has indeed been stopped. -->
[32338]2456 <target name="check-tomcat-running">
[25418]2457 <condition property="tomcat.isrunning">
[32429]2458 <!--<http url="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}"/>-->
2459 <!--<http url="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}"/>--><!-- untrusted certificates won't work, so don't test https urls-->
2460 <http url="${local.http.url}"/><!-- testing the local http url instead -->
[25418]2461 </condition>
[25321]2462 </target>
[30013]2463
[32049]2464 <!--
2465 <target name="verbose-check-tomcat-running">
2466 <condition property="tomcat.isrunning" value="true" else="false">
[32429]2467 <http url="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}"/>
2468 <http url="${local.http.url}"/>
[32049]2469 </condition>
2470 <echo>Tomcat is running: ${tomcat.isrunning}</echo>
2471 </target>
2472 -->
2473 <target name="verbose-check-tomcat-running" depends="check-tomcat-running">
2474 <if>
2475 <bool>
2476 <istrue value="${tomcat.isrunning}"/>
2477 </bool>
2478 <echo>Tomcat is running: ${tomcat.isrunning}</echo>
2479 <else><echo>Tomcat is running: false</echo></else><!-- tomcat.isrunning not set -->
2480 </if>
2481 </target>
2482
[30013]2483 <!-- Need a copy of the check-tomcat-running target with a distinct property, because ant restart runs
2484 both stop and start, both of which need to do tomcat checks. Each property can be set only once during
2485 an invocation with ant. So ant restart will need two properties to store each of the tomcat checks -->
[32338]2486 <target name="check-tomcat-started">
[30013]2487 <condition property="tomcat.isstarted">
[32429]2488 <!--<http url="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}"/>-->
2489 <http url="${local.http.url}"/>
[30013]2490 </condition>
2491 </target>
[25321]2492
[30013]2493
2494
[25443]2495 <!-- stop-tomcat checks if the tomcat server is already running. If it appears to be running
2496 (regardless of whether tomcat was just starting to shut down), this target calls force-stop-tomcat
2497 to issue the shutdown command to tomcat. Then it waits for at most 15 seconds for the server to
2498 actually stop by checking the socket at which tomcat listens every second, printing a warning
2499 at the end of the max wait time of 15 seconds if tomcat was still running. -->
2500 <target name="stop-tomcat" description="Shutdown only Tomcat if running" depends="check-tomcat-running" if="tomcat.isrunning">
[25321]2501 <antcall target="force-stop-tomcat"/>
[25443]2502
2503 <property name="wait.numchecks" value="15"/>
2504 <echo>Waiting for the server to shutdown... (${wait.numchecks} seconds max)</echo>
2505 <waitfor maxwait="${wait.numchecks}" maxwaitunit="second" checkevery="1" checkeveryunit="second" timeoutproperty="tomcat.timedout">
[32429]2506 <not><socket server="${tomcat.server}" port="${default.tomcat.port}"/></not>
[25443]2507 </waitfor>
2508
2509 <if>
2510 <bool>
2511 <isset property="${tomcat.timedout}"/>
2512 </bool>
2513 <property name="tomcat.isrunning" value="true"/>
[32429]2514 <echo>WARNING: Checked the socket ${wait.numchecks} times, but port ${default.tomcat.port} is still busy.</echo>
[25443]2515 <else>
2516 <echo>Tomcat is stopped.</echo>
2517 <property name="tomcat.isrunning" value="false"/>
2518 </else>
2519 </if>
[25420]2520 </target>
[25321]2521
[30013]2522 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,force-start-tomcat"/>
[15124]2523
2524 <target name="setup-catalina-ant-tasks">
2525 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
2526 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
2527 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2528 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
2529 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2530 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
2531 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2532 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
2533 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2534 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
2535 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2536 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
2537 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2538 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
2539 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2540 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
2541 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2542 </target>
2543
[25449]2544 <!-- http://blog.andrewbeacock.com/2007/11/how-to-truncate-log-file-using-ubuntu.html
2545 Doing "cat </dev/null > packages/tomcat/logs/catalina.out" doesn't work as an ant target.
2546 It seems to have a problem with cat or </dev/null, with or without the < sign. -->
[26776]2547 <target name="reset-logs" description="Empties catalina.out, greenstone.log and contents of web/logs/tmp">
[29156]2548 <echo>Truncating catalina.out, solr.log, greenstone.log and server.log, and emptying ${web.writablehome}/logs/tmp</echo>
[26185]2549 <exec executable="rm" os="${os.unix}" dir="${catalina.home}/logs" spawn="false">
2550 <arg value="-f"/>
[25449]2551 <arg value="catalina.out"/>
2552 </exec>
[27829]2553 <exec executable="rm" os="${os.unix}" dir="${web.writablehome}/logs" spawn="false">
[26185]2554 <arg value="-f"/>
[25449]2555 <arg value="greenstone.log"/>
2556 </exec>
[27829]2557 <exec executable="rm" os="${os.unix}" dir="${web.writablehome}/logs" spawn="false">
[26185]2558 <arg value="-f"/>
[26002]2559 <arg value="server.log"/>
2560 </exec>
[15124]2561
[26185]2562 <exec executable="touch" os="${os.unix}" dir="${catalina.home}/logs"
2563 spawn="false">
2564 <arg value="catalina.out"/>
2565 </exec>
[27829]2566 <exec executable="touch" os="${os.unix}" dir="${web.writablehome}/logs"
[26185]2567 spawn="false">
2568 <arg value="greenstone.log"/>
2569 </exec>
[27829]2570 <exec executable="touch" os="${os.unix}" dir="${web.writablehome}/logs"
[26185]2571 spawn="false">
2572 <arg value="server.log"/>
2573 </exec>
2574
[28044]2575 <exec executable="cmd" osfamily="windows" dir="${catalina.home}/logs" spawn="false">
[25449]2576 <arg line="/c echo. > catalina.out"/>
2577 </exec>
[28044]2578 <exec executable="cmd" osfamily="windows" dir="${web.writablehome}/logs" spawn="false">
[25449]2579 <arg line="/c echo. > greenstone.log"/>
2580 </exec>
[28044]2581 <exec executable="cmd" osfamily="windows" dir="${web.writablehome}/logs" spawn="false">
[26002]2582 <arg line="/c echo. > server.log"/>
2583 </exec>
[25449]2584
[29156]2585 <!-- if ext/solr/logs/solr.log exists, truncate it -->
2586 <if><bool><available file="${solr-ext.home}/logs/solr.log" type="file"/></bool>
2587 <exec executable="rm" os="${os.unix}" dir="${solr-ext.home}/logs" spawn="false">
2588 <arg value="-f"/>
2589 <arg value="solr.log"/>
2590 </exec>
2591 <exec executable="touch" os="${os.unix}" dir="${solr-ext.home}/logs" spawn="false">
2592 <arg value="solr.log"/>
2593 </exec>
2594 <exec executable="cmd" osfamily="windows" dir="${solr-ext.home}/logs" spawn="false">
2595 <arg line="/c echo. > solr.log"/>
2596 </exec>
2597 </if>
2598
[25501]2599 <if>
[27829]2600 <bool><available file="${web.writablehome}/logs/tmp" type="dir"/></bool>
[25501]2601 <delete>
[27829]2602 <fileset dir="${web.writablehome}/logs/tmp" includes="**/*"/>
[25501]2603 </delete>
2604 </if>
[25449]2605 </target>
2606
[29438]2607 <target name="clear-tomcat-sessions" description="Clear the Tomcat Session info." depends="init">
2608 <exec executable="cmd" osfamily="windows" dir="${catalina.home}/work/Catalina/localhost/greenstone3" spawn="false">
2609 <arg line="/c echo. > SESSIONS.ser"/>
2610 </exec>
2611 <exec executable="rm" os="${os.unix}" dir="${catalina.home}/work/Catalina/localhost/greenstone3" spawn="false">
2612 <arg value="-f"/>
2613 <arg value="SESSIONS.ser"/>
2614 </exec>
2615
2616 </target>
[15799]2617 <!-- ======================= ant Targets ============================ -->
[15124]2618 <target name="prepare-ant" depends="init">
[16951]2619 <if>
2620 <bool>
2621 <not><available file="${packages.home}/ant/.flagfile"/></not>
2622 </bool>
[32367]2623 <property name="ant.download.version" value="apache-ant-1.9.13" />
[32365]2624 <get src="http://www.greenstone.org/gs3files/${ant.download.version}-bin.zip"
2625 dest="${packages.home}/${ant.download.version}-bin.zip"
[16951]2626 usetimestamp="true"/>
[32365]2627 <unzip src="${packages.home}/${ant.download.version}-bin.zip"
[16951]2628 dest="${packages.home}"/>
2629 <move todir="${packages.home}/ant">
[32365]2630 <fileset dir="${packages.home}/${ant.download.version}"/>
[16951]2631 </move>
2632 <echo file="${packages.home}/ant/.flagfile">
2633 the timestamp of this file is the time that ant was extracted from the zip files.
2634 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
2635 </echo>
2636
2637 <else>
2638 <echo>Ant has been prepared, will not prepare</echo>
2639 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
2640 </else>
2641
2642 </if>
[15124]2643 </target>
2644
[25338]2645 <!-- ======================= Admin Targets ============================ -->
2646
2647 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
2648 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
2649 But you can do: echo mypassword | ant config-admin -->
2650 <target name="config-admin" description="Reset admin password">
[30055]2651 <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-20 characters):&gt;">
[25338]2652 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
2653 </input>
[25343]2654 <!--<echo>PWD: ${admin.password}</echo>-->
[25338]2655 <antcall target="update-userdb">
2656 <param name="user.username" value="admin"/>
2657 <param name="user.password" value="${admin.password}"/>
2658 <param name="user.groups" value=""/>
2659 <param name="user.status" value=""/>
2660 <param name="user.comment" value="Password updated."/>
2661 <param name="user.email" value=""/>
2662 </antcall>
2663 </target>
2664
2665 <target name="config-user" description="Add or modify users" depends="get-user-data,update-userdb"/>
2666
2667 <target name="get-user-data" description="Get user details">
2668 <input addproperty="user.username" message="Username:&gt;"/>
[30055]2669 <input addproperty="user.password" defaultvalue="" message="Password (3-20 characters):&gt;">
[25338]2670 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
2671 </input>
[30196]2672 <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list, e.g. personal-collections-editor):&gt;"/>
[25338]2673 <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
2674 <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
2675 <input addproperty="user.email" defaultvalue="" message="Email:&gt;"/>
2676 </target>
2677
[30055]2678 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
2679 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
2680 But you can do: echo mypassword | ant config-admin -->
2681 <target name="update-userdb" description="Add or modify users" depends="start-derby">
[25418]2682
[29903]2683 <!--
2684 We're now using derby networked server, so stopping and starting tomcat is not necessary.
2685 For embedded derby: stop tomcat if running, since derby db is embedded
2686 and only allows connections from one jvm instance at a time
[25418]2687 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
2688 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
[30055]2689
2690 <!-- Need the derby networked server to be running in order to modify the usersDB.
2691 The start-derby task will check if derby is already running (if not, ${derby.isstarted} will
2692 be false) and will only start up networked derby if it is not already running.
2693 The ${derby.isstarted} property is set by the depends-target "start-derby", since it won't
2694 set the property if called with antcall (like launching in a subshell). Have to use 'depends'.
2695 We'll check ${derby.isstarted} at the end to stop derby again if we had to start it up now.-->
2696 <!--<antcall target="start-derby"/>-->
[25338]2697
[30055]2698 <!-- wait a max of 5 seconds for the derbyserver to have started up -->
[31142]2699 <waitfor maxwait="5" maxwaitunit="second">
[30055]2700 <socket server="${derby.server}" port="${derby.server.port}"/>
2701 </waitfor>
2702
[25338]2703 <!--<echo>${admin.password}</echo>--> <!-- for testing -->
[30235]2704 <echo>gsdl3.writablehome: ${gsdl3.writablehome}</echo> <!-- for testing -->
[30236]2705 <echo>web.home: ${web.home}</echo> <!-- for testing -->
[25338]2706 <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
2707 <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
[30196]2708 <sysproperty key="gsdl3.writablehome" value="${gsdl3.writablehome}" /> <!-- passes -D<syspropKey=syspropVal> to java class ModifyUsersDB. Available in java code as System.getProperty("syspropKey") -->
[27921]2709 <arg file="${web.home}/etc/usersDB"/>
[25338]2710 <arg value="${user.username}"/>
2711 <arg value="password=${user.password}"/>
2712 <arg value="groups=${user.groups}"/>
2713 <arg value="status=${user.status}"/>
2714 <arg value="comment=${user.comment}"/>
2715 <arg value="email=${user.email}"/>
2716 </java>
[30055]2717
2718 <!-- Need to stop networked derby again if we ran it for this target with the depends=start-derby call.
2719 The test here is for <not>derby.isstarted</not>, as the property would be the same as before
2720 derby was started, since properties are immutable within a single ant command. -->
[25338]2721 <if>
2722 <bool>
[30055]2723 <not><istrue value="${derby.isstarted}"/></not>
2724 </bool>
2725 <antcall target="force-stop-derby"/>
[25338]2726 </if>
[30055]2727
[25338]2728 </target>
2729
2730
[20079]2731 <!-- ======================= Axis Targets ============================ -->
2732
[15124]2733 <target name="prepare-axis" depends="init">
[16951]2734
2735 <if>
2736 <bool>
2737 <not><available file="${packages.home}/axis/.flagfile"/></not>
2738 </bool>
2739
2740 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
2741 dest="${packages.home}/${axis.zip.version}"
2742 usetimestamp="true"/>
2743 <unzip src="${packages.home}/${axis.zip.version}"
2744 dest="${packages.home}"/>
2745 <move todir="${packages.home}/axis">
2746 <fileset dir="${packages.home}/${axis.dir.version}"/>
2747 </move>
2748 <!-- install axis into greenstone web app -->
2749 <copy todir="${web.lib}">
2750 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
2751 <include name="*.jar"/>
2752 </fileset>
2753 </copy>
2754 <copy todir="${web.home}">
2755 <fileset dir="${packages.home}/axis/webapps/axis/">
2756 <include name="*.jsp"/>
2757 <include name="*.jws"/>
2758 </fileset>
2759 </copy>
2760 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
2761 <copy todir="${web.classes}">
2762 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
2763 <include name="*.properties"/>
2764 </fileset>
2765 </copy>
2766 <echo file="${packages.home}/axis/.flagfile">
2767 the timestamp of this file is the time that axis was extracted from the zip files.
2768 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
2769 </echo>
2770
2771 <else>
2772 <echo>Axis has been prepared, will not prepare</echo>
2773 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
2774 </else>
2775
2776 </if>
[15124]2777 </target>
2778
[32338]2779 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
[15124]2780 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
[15799]2781
2782 <target name="deploy-site">
[15124]2783 <java classname="org.apache.axis.client.AdminClient">
2784 <classpath refid="compile.classpath"/>
2785 <arg value="-l"/>
[32429]2786 <arg value="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]2787 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
2788 </java>
2789 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
[15124]2790 </target>
2791
[32338]2792 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
[15124]2793 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
[15229]2794 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
2795 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
2796 tofile="${basedir}/resources/soap/undeploy.wsdd"
2797 filtering="true"
2798 overwrite="true"/>
[15124]2799 <java classname="org.apache.axis.client.AdminClient">
2800 <classpath refid="compile.classpath"/>
2801 <arg value="-l"/>
[32429]2802 <arg value="${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]2803 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
[15124]2804 </java>
[15229]2805 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
[15799]2806 </target>
[15124]2807
[16936]2808 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
2809 with the default servicename of localsite-->
[32338]2810 <target name="deploy-localsite" depends="init"
[15124]2811 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
[30013]2812 <antcall target="force-start-tomcat"/>
[15235]2813 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
[15229]2814 <antcall target="create-deployment-files">
2815 <param name="axis.sitename" value="localsite"/>
[15235]2816 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]2817 <param name="axis.siteuri" value="localsite"/>
2818 </antcall>
[15124]2819 <antcall target="deploy-site">
2820 <param name="axis.sitename" value="localsite"/>
[15235]2821 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]2822 <param name="axis.siteuri" value="localsite"/>
[15124]2823 </antcall>
[15369]2824 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
[15124]2825 </target>
[15799]2826
[16936]2827 <target name="get-sitename" unless="axis.sitename">
[15229]2828 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
[15235]2829Press Enter for default:localsite</input>
[15124]2830 </target>
2831
[15229]2832 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
2833 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
[32429]2834To find out which web services you've got deployed, point your browser to ${default.server.protocol}://${tomcat.server}:${default.tomcat.port}/greenstone3/services
[20209]2835Or press Enter for undeploying the default:localsite /&gt;</input>
[15229]2836 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
[15124]2837 </target>
2838
[15229]2839 <target name="get-webservices" unless="axis.servicesname">
[15235]2840 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
[15229]2841Choose from: ${web.services.list}
[20209]2842Or press Enter for default:${base.webservice.name} /&gt;</input>
[15229]2843 <echo>${axis.servicesname}</echo>
2844 </target>
2845
2846 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
[15235]2847 <input addproperty="axis.siteuri" defaultvalue="${axis.servicesname}${axis.sitename}">What name do you want the service to have? (Press Enter for default:${axis.servicesname}${axis.sitename})</input>
[15229]2848 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
2849 </target>
2850
2851 <target name="set-soapmethod" description="Determines whether the service in the wsdd should have the style attribute set to message or the provider attribute set to java:RPC" if="axis.servicesname">
2852 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
[15235]2853 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15124]2854 </condition>
[15229]2855
2856 <!--everything else defaults to java:RPC at present-->
2857 <condition property="soap.method" value="provider='java:RPC'">
2858 <not>
[15235]2859 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15229]2860 </not>
2861 </condition>
[16936]2862 </target>
[15799]2863
[16936]2864 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
[15124]2865 <filter token="sitename" value="${axis.sitename}"/>
2866 <filter token="siteuri" value="${axis.siteuri}"/>
[15229]2867 <filter token="servicesname" value="${axis.servicesname}"/>
2868 <filter token="soapmethod" value="${soap.method}"/>
[15124]2869 <copy file="${basedir}/resources/soap/site.wsdd.template"
[15229]2870 tofile="${basedir}/resources/soap/deploy.wsdd"
2871 filtering="true"
2872 overwrite="true"/>
[15124]2873 <!-- create the java files and compile them -->
[15229]2874 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
2875 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
2876 filtering="true"
2877 overwrite="true"/>
[15124]2878 <mkdir dir="${build.home}"/>
2879 <javac srcdir="${src.home}"
2880 destdir="${build.home}"
[28137]2881 includeantruntime="${compile.includeantruntime}"
[15124]2882 debug="${compile.debug}"
2883 deprecation="${compile.deprecation}"
[29515]2884 optimize="${compile.optimize}"
2885 encoding="${compile.encoding}">
[15124]2886 <classpath refid="compile.classpath"/>
[15229]2887 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
[15124]2888 </javac>
2889 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
[15799]2890 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
2891 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
2892 overwrite="true" />
[15124]2893 </target>
[15799]2894
[15124]2895
[15799]2896 <!-- ====================== Core targets ============================== -->
2897 <!-- core targets refer to the core gsdl3 java src -->
[15124]2898
[19878]2899 <target name="prepare-core"/>
[15124]2900
2901 <target name="configure-core"/>
2902
2903 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
2904 description="Update only the Greenstone core" />
2905
[15799]2906 <target name="svnupdate-core" unless="nosvn.mode">
[20930]2907 <exec executable="svn">
2908 <arg value="update"/>
2909 <arg value="${basedir}"/>
2910 <arg value="-r"/><arg value="${branch.revision}"/>
2911 </exec>
[15124]2912 </target>
2913
2914 <target name="clean-core"
2915 description="Clean only the Greenstone core">
[19878]2916 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
[15124]2917 <delete dir="${build.home}"/>
2918 </target>
2919
[15799]2920 <target name="compile-core" depends="init"
[15124]2921 description="Compile only the Greenstone core">
2922 <mkdir dir="${build.home}"/>
[25131]2923
[23803]2924 <if><bool><isset property="with.jni"/></bool>
2925 <javac srcdir="${src.home}"
2926 destdir="${build.home}"
[28137]2927 includeantruntime="${compile.includeantruntime}"
[23803]2928 debug="${compile.debug}"
2929 deprecation="${compile.deprecation}"
[29515]2930 optimize="${compile.optimize}"
2931 encoding="${compile.encoding}">
[23803]2932 <classpath>
2933 <path refid="compile.classpath"/>
2934 </classpath>
2935 </javac>
2936 <else>
2937 <property name="gsprefix" value=""/>
2938 <javac srcdir="${src.home}"
[28137]2939 destdir="${build.home}"
2940 includeantruntime="${compile.includeantruntime}"
2941 debug="${compile.debug}"
2942 deprecation="${compile.deprecation}"
[29515]2943 optimize="${compile.optimize}"
2944 encoding="${compile.encoding}">
[23803]2945 <classpath>
2946 <path refid="compile.classpath"/>
2947 </classpath>
2948 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
2949 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
2950 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
2951 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
2952 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
2953 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
2954 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
2955 </javac>
2956 </else>
2957 </if>
[15124]2958 <jar destfile="${build.home}/gsdl3.jar">
2959 <fileset dir="${build.home}">
[16936]2960 <include name="org/greenstone/gsdl3/**"/>
[15124]2961 <include name="org/flax/**"/>
[16936]2962 <exclude name="**/Test.class"/>
[15124]2963 </fileset>
2964 <manifest>
[16936]2965 <attribute name="Built-By" value="${user.name}" />
[15124]2966 </manifest>
2967 </jar>
2968 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
[22101]2969
2970 <jar destfile="${build.home}/gutil.jar">
2971 <fileset dir="${build.home}">
2972 <include name="org/greenstone/util/**"/>
2973 </fileset>
2974 <manifest>
2975 <attribute name="Built-By" value="${user.name}" />
2976 </manifest>
2977 </jar>
2978 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
2979
[15124]2980 <!-- copy the localsite server in case we need it -->
[15235]2981 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
[15124]2982
[17918]2983 <!-- Greenstone Administrator Interface -->
[15124]2984 <jar destfile="${build.home}/GAI.jar">
2985 <fileset dir="${build.home}">
[16936]2986 <include name="org/greenstone/admin/**"/>
[15124]2987 </fileset>
2988 <manifest>
[16936]2989 <attribute name="Built-By" value="${user.name}" />
[15124]2990 </manifest>
2991 </jar>
[17917]2992 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
[18124]2993 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
[15124]2994 <jar destfile="${build.home}/phind.jar">
2995 <fileset dir="${build.home}">
[16936]2996 <include name="org/greenstone/applet/phind/**"/>
[15124]2997 </fileset>
2998 <manifest>
[16936]2999 <attribute name="Built-By" value="${user.name}" />
[15124]3000 </manifest>
3001 </jar>
3002 <mkdir dir="${web.applet}"/>
3003 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
3004 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
[18515]3005 <if>
3006 <bool><istrue value="${tomcat.islocal}"/></bool>
[29711]3007 <if><bool><available file="${catalina.home}/lib/xercesImpl.jar"/></bool><!-- moved for solr -->
3008 <copy file="${catalina.home}/lib/xercesImpl.jar" todir="${web.applet}"/>
3009 <copy file="${catalina.home}/lib/xml-apis.jar" todir="${web.applet}"/>
3010
3011 <else><!-- get from default GS3 web lib location-->
3012 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
3013 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
3014 </else>
3015 </if>
[18515]3016 </if>
3017
3018
[17116]3019 <!-- skip anttasks for now
[15124]3020 <jar destfile="${build.home}/anttasks.jar">
3021 <fileset dir="${build.home}">
[16936]3022 <include name="org/greenstone/anttasks/**"/>
[15124]3023 </fileset>
3024 <manifest>
[16936]3025 <attribute name="Built-By" value="${user.name}" />
[15124]3026 </manifest>
3027 </jar>
[17116]3028 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
[15124]3029 <jar destfile="${build.home}/gsdl3test.jar">
3030 <fileset dir="${build.home}">
[16936]3031 <include name="org/greenstone/gsdl3/**/*Test.class"/>
3032 <include name="org/greenstone/testing/**"/>
[15124]3033 </fileset>
3034 <manifest>
[16936]3035 <attribute name="Built-By" value="${user.name}" />
[15124]3036 </manifest>
3037 </jar>
3038 <jar destfile="${build.home}/server.jar">
3039 <fileset dir="${build.home}">
[16936]3040 <include name="org/greenstone/server/**"/>
[22634]3041 <include name="org/greenstone/util/**"/>
[15124]3042 </fileset>
3043 <fileset file="${basedir}/resources/java/server.properties"/>
3044 <manifest>
[16936]3045 <attribute name="Built-By" value="${user.name}"/>
[15124]3046 </manifest>
3047 </jar>
3048 <copy file="${build.home}/server.jar" todir="${basedir}"/>
3049 </target>
[27149]3050
3051 <!-- === Eclipse targets == -->
3052 <target name="setup-for-eclipse">
3053
3054 <filter token="gsdlhome" value="${gs2build.home}"/>
3055 <filter token="gsdl3srchome" value="${basedir}"/>
3056 <filter token="gsdl3home" value="${basedir}/web"/>
3057
3058 <if>
3059 <bool><not><available file="${basedir}/TransformingLibrary.launch"/></not></bool>
3060 <copy file="${basedir}/TransformingLibrary.launch.in" tofile="${basedir}/TransformingLibrary.launch" filtering="true" overwrite="true"/>
3061 </if>
3062<!--
3063 <if>
3064 <bool><not><available file="${basedir}/LibraryCommandline.launch"/></not></bool>
3065 <copy file="${basedir}/LibraryCommandline.launch.in" tofile="${basedir}/LibraryCommandline.launch" filtering="true" overwrite="true"/>
3066 </if>
3067-->
3068 </target>
[15799]3069
3070 <!-- ================== Packages targets ================================ -->
[15124]3071 <!-- these targets refer to the greenstone source packages - these need
3072 updating less often, so are in separate targets to the core -->
[19871]3073 <target name="prepare-packages" depends="init"/>
[15124]3074
3075 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
3076 description="Update only the source packages"/>
3077
[15799]3078 <target name="svnupdate-packages" unless="nosvn.mode">
[20930]3079 <exec executable="svn">
3080 <arg value="update"/>
3081 <arg value="${src.packages.home}"/>
3082 <arg value="-r"/><arg value="${branch.revision}"/>
3083 </exec>
[15124]3084 </target>
[19931]3085
[15124]3086
[19871]3087 <target name="configure-packages" depends="init,configure-javagdbm"
[15124]3088 description="Configure only the packages."/>
3089
[22184]3090 <target name="configure-javagdbm" if="with.jni">
[15124]3091 <echo>
3092 Configuring JavaGDBM
3093 </echo>
[18417]3094
[19904]3095 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15124]3096 <arg value="--prefix=${basedir}"/>
3097 <arg value="--libdir=${lib.jni}"/>
[19873]3098 <arg value="--with-gdbm=${gdbm.home}"/>
[26765]3099 <arg line="${cross.configure.args}"/>
[15124]3100 </exec>
3101 </target>
3102
[19871]3103 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
[15124]3104
3105 <target name="clean-javagdbm" depends="init">
[26082]3106 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
[15124]3107 <exec executable="make" os="${os.unix}"
[19904]3108 dir="${javagdbm.home}" failonerror="true">
[15124]3109 <arg value="clean"/>
3110 </exec>
[26082]3111 </if>
[15124]3112 </target>
3113
[19871]3114 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
[15185]3115
[15799]3116 <target name="distclean-javagdbm" depends="init">
[26079]3117 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
[15799]3118 <exec executable="make" os="${os.unix}"
[19904]3119 dir="${javagdbm.home}" failonerror="true">
[15799]3120 <arg value="distclean"/>
3121 </exec>
[26079]3122 </if>
[15799]3123 </target>
3124
3125 <target name="compile-packages" description="Compile only the source packages">
[22184]3126 <!-- javagdbm -->
3127 <antcall target="compile-javagdbm"/>
3128 <!-- Search4j -->
3129 <antcall target="compile-search4j"/>
3130 </target>
3131
3132 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
[15799]3133
[19878]3134 <!-- unix: -->
[15799]3135 <echo>compile javagdbm</echo>
[19904]3136 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[29518]3137 <arg value="JAVACOPTIONS=-encoding UTF8"/>
3138 </exec>
3139 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15799]3140 <arg value="install"/>
3141 </exec>
[15098]3142
[23852]3143 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
3144 "all" which will then perform both the compile AND link targets in jni/win32.mak
3145 (thereby also generating gdbmjava.dll). Then we run the same command with
3146 the "install" argument to copy the gdbmjava.dll into the correct location. -->
[23849]3147 <echo>Windows: compile javagdbm</echo>
[28044]3148 <exec executable="${javagdbm.home}/winMake.bat" osfamily="windows" dir="${javagdbm.home}" failonerror="true">
[24076]3149 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23852]3150 </exec>
[28044]3151 <exec executable="${javagdbm.home}/winMake.bat" osfamily="windows" dir="${javagdbm.home}" failonerror="true">
[24076]3152 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23847]3153 <arg value="install"/>
[15799]3154 </exec>
[15124]3155
[15799]3156 <!-- install the jar file -->
[23847]3157 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
[15799]3158 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
3159 </target>
3160
[17491]3161 <target name="compile-search4j">
[17509]3162
[19996]3163 <!-- windows -->
[19997]3164 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[19996]3165 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
3166 <arg value="/f"/>
3167 <arg value="win32.mak"/>
3168 <arg value='BINDIR="${basedir}\bin"'/>
3169 </exec>
3170 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
3171 <arg value="/f"/>
3172 <arg value="win32.mak"/>
3173 <arg value="install"/>
3174 <arg value='BINDIR="${basedir}\bin"'/>
3175 </exec>
[17509]3176
[19996]3177 <!-- unix -->
[19997]3178 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
[19996]3179 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
3180 <arg value="--bindir=${basedir}/bin"/>
3181 <arg value="${static.arg}"/>
[26765]3182 <arg line="${cross.configure.args}"/>
[19996]3183 </exec>
3184 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
3185 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
3186 <arg value="install"/>
3187 </exec>
[17509]3188
[19996]3189 <!-- else warn -->
3190 <else>
3191 <fail>this target does not support the current os</fail>
[17509]3192
[19996]3193 </else></if></else></if>
3194
[17491]3195 </target>
3196
[19871]3197 <target name="install-auxiliary-jar-files" depends="init">
[22184]3198
3199 <if>
3200 <bool><available file="${mg.home}/mg.jar"/></bool>
3201 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
3202 </if>
3203
3204 <if>
[22199]3205 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
[22184]3206 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
3207 </if>
3208
[29143]3209 <copy file="${lucene.home}/LuceneWrapper4.jar" todir="${web.lib}"/>
[19871]3210 </target>
3211
[22976]3212 <target name="install-jni-files" depends="init" if="with.jni">
3213 <antcall target="install-jni-files-linux"/>
3214 <antcall target="install-jni-files-windows"/>
3215 <antcall target="install-jni-files-macos"/>
3216 </target>
[15124]3217
[15799]3218 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
[26765]3219
3220 <if>
3221
3222 <bool><equals arg1="${os.bin.dir}" arg2="windows"/></bool>
3223 <!-- cross compiling to windows -->
3224 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
3225 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
3226 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
3227 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
3228 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
3229 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
3230
3231 <else>
3232 <!-- otherwise do the usual Unix copies -->
3233 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
3234 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
3235 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
3236 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
3237 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
3238 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
3239 </else>
3240 </if>
3241
3242
[15799]3243 </target>
3244 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
[15124]3245 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
3246 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
[15799]3247 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
[15124]3248 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
3249 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
[15799]3250 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
3251 </target>
3252 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
[15124]3253 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
3254 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
[15799]3255 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
[15124]3256 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
3257 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
[15799]3258 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
3259 </target>
3260
[19871]3261 <!-- ========common-src targets =================================-->
3262 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
3263 collection building is not enabled -->
3264
3265 <target name="update-common-src" depends="init" if="collection.building.disabled">
3266 </target>
[19931]3267
[19871]3268 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
[20930]3269 <exec executable="svn">
3270 <arg value="update"/>
3271 <arg value="${common.src.home}"/>
3272 <arg value="-r"/><arg value="${branch.revision}"/>
3273 </exec>
[19871]3274 </target>
3275
[19878]3276 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
[19871]3277 <antcall target="checkout-common-src"/>
3278 <antcall target="unzip-windows-packages"/>
3279 </target>
3280
3281 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
3282 <echo>checking out common-src</echo>
[20930]3283 <exec executable="svn">
3284 <arg value="checkout"/>
[21196]3285 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
[20930]3286 <arg value="common-src"/>
3287 <arg value="-r"/><arg value="${branch.revision}"/>
3288 </exec>
[19871]3289 </target>
3290
[19931]3291 <target name="configure-common-src" depends="init">
[26765]3292<!--
3293 <echo>cross configure args: ${cross.configure.args}</echo>
3294-->
[19871]3295 <exec executable="${common.src.home}/configure" os="${os.unix}"
[19904]3296 dir="${common.src.home}" failonerror="true">
[19931]3297 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
[19933]3298 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
[22184]3299 <arg line="${gs2.opt.args}"/>
[22854]3300 <arg line="${static.arg}"/>
[26765]3301 <arg line="${cross.configure.args}"/>
[23611]3302 <arg line="${allargs}"/>
[19871]3303 </exec>
3304 </target>
3305
[19931]3306 <target name="clean-common-src" depends="init">
[19871]3307 <!-- unix: -->
[26082]3308 <if><bool><available file="${common.src.home}/Makefile"/></bool>
[19904]3309 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]3310 <arg value="clean"/>
3311 </exec>
[26082]3312 </if>
[19871]3313 <!-- windows: -->
[28044]3314 <exec executable="nmake" dir="${common.src.home}" osfamily="windows" failonerror="true">
[19871]3315 <arg value="/f"/>
3316 <arg value="win32.mak"/>
3317 <arg value="clean"/>
[19960]3318 <arg value="GSDLHOME=${gs2build.home}"/>
[19871]3319 </exec>
3320 </target>
[19931]3321 <target name="distclean-common-src" depends="init">
[19960]3322 <!-- unix: -->
[26079]3323 <if><bool><available file="${common.src.home}/Makefile"/></bool>
[19904]3324 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]3325 <arg value="distclean"/>
3326 </exec>
[26079]3327 </if>
[19960]3328 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
[28044]3329 <exec executable="nmake" dir="${common.src.home}" osfamily="windows" failonerror="true">
[19960]3330 <arg value="/f"/>
3331 <arg value="win32.mak"/>
3332 <arg value="clean"/>
3333 <arg value="GSDLHOME=${gs2build.home}"/>
3334 </exec>
[19871]3335 </target>
[19931]3336 <target name="compile-common-src" depends="init">
[19871]3337 <!-- unix: -->
[19904]3338 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]3339 <arg value="${gs2.compile.target}"/>
[19871]3340 </exec>
3341 <!-- windows: -->
[28044]3342 <exec executable="nmake" dir="${common.src.home}" osfamily="windows" failonerror="true">
[19871]3343 <arg value="/f"/>
3344 <arg value="win32.mak"/>
[19934]3345 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]3346 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[22976]3347 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
3348 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
3349 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
3350 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
[19871]3351 </exec>
3352 </target>
3353
[19843]3354 <!-- ======= collection-building targets ===========================-->
[15124]3355
[19843]3356 <target name="update-collection-building" if="collection.building.enabled"
[19931]3357 depends="init,svnupdate-collection-building,gs2build-edit-setup-bat,configure-common-src,clean-common-src,compile-common-src,configure-collection-building,clean-collection-building,compile-collection-building"
[19843]3358 description="Update (SVN update, configure, compile etc) only the collection building components"/>
[15124]3359
[27135]3360 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-cgi,svnupdate-gli" unless="nosvn.mode"
[19843]3361 description="SVN update the collection building components">
3362 </target>
[15124]3363
[27135]3364 <target name="prepare-collection-building" depends="init,prepare-gs2build,svnupdate-cgi,prepare-gli" if="collection.building.enabled">
[15124]3365 </target>
3366
[19931]3367 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
3368 description="Configure the collection building components">
[19843]3369 </target>
[15098]3370
[19948]3371 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
[19843]3372 description="Clean only the collection building components"
3373 if="collection.building.enabled"/>
[18495]3374
[19948]3375 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
[19843]3376 description="Distclean only the collection building components"
3377 if="collection.building.enabled"/>
3378
[19931]3379 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
[19843]3380 description="Compile only the collection building components">
[19931]3381 <!-- make install for common-src -->
3382 <!-- unix: -->
3383 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]3384 <arg value="${gs2.install.target}"/>
[19931]3385 </exec>
3386
3387 <!-- windows: -->
[28044]3388 <exec executable="nmake" dir="${common.src.home}" osfamily="windows" failonerror="true">
[19931]3389 <arg value="/f"/>
3390 <arg value="win32.mak"/>
[21370]3391 <arg value="install"/>
[23837]3392 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]3393 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[23837]3394 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
3395 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
3396 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
3397 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
3398 <!--
3399 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
3400 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
[19931]3401 </exec>
3402
3403 <!-- install gs2build indexers for windows -->
3404 <if>
3405 <bool><istrue value="${current.os.iswindows}"/></bool>
3406 <copy todir="${gs2build.home}/bin/windows">
3407 <fileset dir="${gs2build.home}/common-src/indexers/bin">
3408 <include name="*.*"/>
3409 </fileset>
3410 </copy>
3411 </if>
3412
3413 <!-- LuceneWrapper jar file not installed by default -->
3414 <mkdir dir="${gs2build.home}/bin/java"/>
[29143]3415 <copy file="${lucene.home}/LuceneWrapper4.jar" todir="${gs2build.home}/bin/java"/>
[19931]3416
[15124]3417 </target>
[19843]3418
3419 <!-- ============== gli targets ================================= -->
[27135]3420
[27484]3421 <!-- gliserver.pl, gsdlCGI.pm, metadata-server.pl and checksum.pl are updated alongside
[27135]3422 this in target svnupdate-collection-building -->
[15799]3423 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
[19929]3424
[20930]3425 <exec executable="svn">
3426 <arg value="update"/>
3427 <arg value="${gli.home}"/>
3428 <arg value="-r"/><arg value="${branch.revision}"/>
3429 </exec>
3430
[15124]3431 </target>
3432
[27484]3433 <!-- gliserver.pl, gsdlCGI.pm, metadata-server.pl and checksum.pl are updated
[27135]3434 alongside this prepare-gli target in target prepare-collection-building -->
[19843]3435 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
[19911]3436 <!-- checkout -->
[23808]3437 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
[19929]3438
[20930]3439 <exec executable="svn">
3440 <arg value="checkout"/>
[21196]3441 <arg value="${svn.root}/main/${branch.path}/gli"/>
[20930]3442 <arg value="-r"/><arg value="${branch.revision}"/>
3443 </exec>
3444
[27135]3445 </if>
3446 </target>
3447
[27484]3448 <!-- svn checkout gliserver.pl, gsdlCGI.pm for gli applet, as well as gsdlCGI.pm-dependent metadata-server.pl
3449 (checksum.pl is used by GS2 for depositdspace.dm and may eventually be used by GS3 too) -->
[27135]3450 <target name="svnupdate-cgi">
3451
3452 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]3453 <arg value="export"/>
3454 <arg value="-r"/><arg value="${branch.revision}"/>
[25570]3455 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
[20930]3456 </exec>
[21196]3457 <exec executable="svn" dir="web/WEB-INF/cgi">
3458 <arg value="export"/>
3459 <arg value="-r"/><arg value="${branch.revision}"/>
[25570]3460 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
[21196]3461 </exec>
[27135]3462 <exec executable="svn" dir="web/WEB-INF/cgi">
3463 <arg value="export"/>
3464 <arg value="-r"/><arg value="${branch.revision}"/>
3465 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/metadata-server.pl"/>
3466 </exec>
[27484]3467 <exec executable="svn" dir="web/WEB-INF/cgi">
3468 <arg value="export"/>
3469 <arg value="-r"/><arg value="${branch.revision}"/>
3470 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/checksum.pl"/>
3471 </exec>
[27135]3472 </target>
[20930]3473
[19843]3474
3475 <target name="clean-gli" depends="init" if="collection.building.enabled">
3476 <!-- gli -->
3477 <property name="gli.home" value="${basedir}/gli"/>
3478 <!-- linux -->
3479 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
[20826]3480 resolveExecutable="true" failonerror="true"/>
[19843]3481 <!-- windows -->
[28044]3482 <exec executable="clean.bat" osfamily="windows" dir="${gli.home}"
[20826]3483 resolveExecutable="true" failonerror="true"/>
[19843]3484 </target>
3485
3486 <target name="compile-gli" depends="init" if="collection.building.enabled">
[23808]3487 <if><bool><isset property="with.gli.and.gems"/></bool>
[23807]3488 <!-- gli -->
3489 <property name="gli.home" value="${basedir}/gli"/>
[15098]3490
[23807]3491 <!-- linux -->
3492 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
3493 <!--remote gli-->
3494 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
3495 resolveExecutable="true" failonerror="true"/>
3496 <!-- windows -->
[28044]3497 <exec executable="makegli.bat" osfamily="windows" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
[23807]3498 <!--remote gli-->
[28044]3499 <exec executable="makejar.bat" osfamily="windows" dir="${gli.home}"
[23807]3500 resolveExecutable="true" failonerror="true"/>
3501 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
3502 </if>
[19843]3503 </target>
[15124]3504
[19843]3505 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
[21351]3506 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
[19843]3507 <env key="gsdl3path" path="${basedir}"/>
[19871]3508 <env key="gsdlpath" path="${gs2build.home}"/>
[19843]3509 </exec>
[21351]3510 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
[19843]3511 <env key="gsdl3path" path="${basedir}"/>
[19871]3512 <env key="gsdlpath" path="${gs2build.home}"/>
[19873]3513 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
[19843]3514 </exec>
[28044]3515 <exec executable="${basedir}/gli/gli.bat" osfamily="windows" dir="${basedir}/gli" spawn="true">
[19843]3516 <env key="GSDL3PATH" path="${basedir}"/>
[19871]3517 <env key="GSDLPATH" path="${gs2build.home}"/>
[19843]3518 </exec>
3519 <echo>Running GLI from Ant means that you don't get to see any of the terminal output. If you have problems with GLI and want to see the output, please run the script gli.sh/bat from the greenstone3/gli directory.
3520 </echo>
3521 </target>
3522
3523 <!-- ================ gs2build targets =========================== -->
3524
3525 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
3526 <echo>svn updating gs2build</echo>
[20930]3527 <exec executable="svn">
3528 <arg value="update"/>
3529 <arg value="${gs2build.home}"/>
3530 <arg value="-r"/><arg value="${branch.revision}"/>
3531 </exec>
[15799]3532 </target>
[19843]3533
[15124]3534 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
3535 <antcall target="checkout-gs2build"/>
[28259]3536 <antcall target="prepare-pdfbox"/>
[27199]3537 <antcall target="prepare-imagemagick"/> <!-- has to be done before calling prepare-gnome-lib -->
[26791]3538 <antcall target="prepare-gnome-lib"/>
[15124]3539 <antcall target="unzip-windows-packages"/>
3540 <antcall target="checkout-winbin"/>
3541 <antcall target="get-windows-binaries"/>
3542 <antcall target="delete-winbin"/>
3543 </target>
3544
[19843]3545 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
3546 <echo>checking out gs2build</echo>
[20930]3547 <exec executable="svn">
3548 <arg value="checkout"/>
[21196]3549 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
[20930]3550 <arg value="-r"/><arg value="${branch.revision}"/>
3551 </exec>
[26791]3552 </target>
[20930]3553
[28259]3554 <!-- Gets the PDFBox extension into gs2build/ext if checkout.pdfbox.ext is set to true in build.properties
3555 (which it is by default) -->
3556 <target name="prepare-pdfbox" depends="init" if="collection.building.enabled">
3557 <if>
3558 <bool>
3559 <istrue value="${checkout.pdfbox.ext}"/>
3560 </bool>
3561
3562 <property name="pdfbox.ext.dir" value="${gs2build.home}/ext/pdf-box"/>
3563 <condition property="pdfbox.ext.present">
3564 <available file="${pdfbox.ext.dir}" type="dir" />
3565 </condition>
3566
3567 <!-- get the pdfbox tar.gz file if we don't already have it and extract it if there's no pdf-box directory in gs2build/ext-->
3568 <if>
3569 <bool>
3570 <not><istrue value="${pdfbox.ext.present}"/></not>
3571 </bool>
[27034]3572
[28259]3573 <if>
3574 <bool>
3575 <not><istrue value="${gs2build.home}/ext/pdf-box-java.tar.gz"/></not>
3576 </bool>
3577
3578 <echo>Checking out the PDFBox extension into the GSDLHOME extension area</echo>
3579 <exec executable="svn">
3580 <arg value="export"/>
3581 <arg value="${svn.root}/gs2-extensions/pdf-box/trunk/pdf-box-java.tar.gz"/>
3582 <arg value="${gs2build.home}/ext/pdf-box-java.tar.gz"/>
3583 </exec>
3584 </if>
3585
3586 <echo>Extacting the PDFBox extension into the GSDLHOME extension area</echo>
3587 <untar compression="gzip"
3588 src="${gs2build.home}/ext/pdf-box-java.tar.gz"
[28610]3589 dest="${gs2build.home}/ext"/>
[28259]3590
3591 <delete file="${gs2build.home}/ext/pdf-box-java.tar.gz"/>
3592
3593 <else>
3594 <echo>The PDFBox extension already exists at ${pdfbox.ext.dir}</echo>
3595 </else>
3596 </if>
3597
3598 <else>
3599 <echo>**** Not preparing the PDFBox extension:</echo>
3600 <echo>The property checkout.pdfbox.ext in build.properties was not set or was set to false</echo>
3601 </else>
3602 </if>
3603 </target>
3604
[27199]3605 <target name="prepare-imagemagick" depends="init" if="collection.building.enabled">
3606 <if>
3607 <bool>
3608 <istrue value="${checkout.imagemagick.ext}"/>
3609 </bool>
3610
3611 <antcall target="checkout-imagemagick"/>
[28320]3612 <!--Compilation of imagemagick now happens during ant install, still before configuring the src code, as before -->
[27199]3613
3614 <else>
3615 <echo>**** Not preparing imagemagick:</echo>
3616 <echo>property checkout.imagemagick.ext in build.properties was not set or was set to false</echo>
3617 </else>
3618 </if>
3619 </target>
3620
3621 <target name="checkout-imagemagick" depends="init" if="collection.building.enabled" unless="nosvn.mode">
3622
3623 <property name="imagemagick.src.dir" value="${gs2build.home}/ext/imagemagick"/>
3624 <condition property="imagemagick.src.present">
3625 <available file="${imagemagick.src.dir}" type="dir" />
3626 </condition>
3627
3628 <if>
3629 <bool>
3630 <not><istrue value="${imagemagick.src.present}"/></not>
3631 </bool>
3632
3633 <echo>checking out imagemagick source into the extension area</echo>
3634
3635 <exec executable="svn">
3636 <arg value="checkout"/>
3637 <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/src"/>
3638 <arg value="${imagemagick.src.dir}"/>
3639 </exec>
3640
3641 <else>
3642 <echo>imagemagick source code already exists at ${imagemagick.src.dir}</echo>
3643 </else>
3644 </if>
3645 </target>
3646
3647 <!-- Compile up imagemagick src folder if: the checkout.imagemagick.ext flag is turned on, if the imagick source code exists and if hasn't already been compiled up, then compile it up. Later can check if a gs-specific binary version has been installed already, in which case compilation won't be necessary. -->
3648 <target name="compile-imagemagick" if="checkout.imagemagick.ext">
3649
3650 <property name="imagemagick.src.dir" value="${gs2build.home}/ext/imagemagick"/>
3651 <property name="imagemagick.compiled.dir" value="${gs2build.home}/ext/imagemagick/${os.bin.dir}"/>
3652
[28320]3653 <condition property="imagemagick.src.present.firstcheck">
[27199]3654 <available file="${imagemagick.src.dir}" type="dir" />
3655 </condition>
3656 <condition property="imagemagick.compiled.present">
3657 <available file="${imagemagick.compiled.dir}" type="dir"/>
3658 </condition>
3659 <!--<condition property="imagemagick.bin.present">
3660 <available file="${basedir}/wherever/the/imgmagick/binary/is/to/be/found" type="dir" />
3661 </condition>-->
3662
[28320]3663 <!-- imagemagick will only be checked out if the user set the checkout.imagemagick.ext in build.properties -->
[27199]3664 <if>
3665 <bool>
[28320]3666 <isfalse value="${imagemagick.src.present.firstcheck}"/>
3667 </bool>
3668 <antcall target="checkout-imagemagick"/>
3669 </if>
3670
3671 <!-- keep track of whether the imagemagick src is now indeed present. Need to know this for a subsequent test -->
3672 <condition property="imagemagick.src.present">
3673 <available file="${imagemagick.src.dir}" type="dir" />
3674 </condition>
3675
3676 <if>
3677 <bool>
[27199]3678 <and>
3679 <istrue value="${imagemagick.src.present}"/> <!-- imagemagick src code is present -->
[28320]3680 <isfalse value="${imagemagick.compiled.present}"/> <!-- imagemagick src not compiled yet, so no imagemagick/os subfolder yet -->
3681 </and>
[27199]3682 </bool>
3683 <!-- then compile it. Only necessary for mac/linux, since windows has a stable working binary of imagemagick -->
3684 <exec executable="/bin/bash" dir="${imagemagick.src.dir}" failonerror="true">
3685 <arg value="CASCADE-MAKE.sh"/>
3686 </exec>
3687 </if>
3688 </target>
3689
3690
[27185]3691 <!-- Compile up gnome-lib src folder if: checkout.gnomelib.ext is turned on, and if not using the binary
[27034]3692 version (gnome-lib-minimal), and if the gnome-lib src folder is not already compiled up. -->
[27185]3693 <target name="compile-gnome-lib" if="checkout.gnomelib.ext">
[27034]3694
3695 <!-- http://stackoverflow.com/questions/3290307/sourcing-a-shell-profile-in-an-ant-build-file
3696 TODO: CASCADE-MAKE already sources devel.bash, but we still want to source it more globally,
3697 so that the rest of the GS3 compilation process also has access to those env variables -->
3698
3699 <property name="gnome.lib.src.dir" value="${basedir}/gs2build/ext/gnome-lib"/>
3700 <property name="gnome.lib.compiled.dir" value="${basedir}/gs2build/ext/gnome-lib/${os.bin.dir}"/>
3701
[28320]3702 <condition property="gnome.src.lib.present.firstcheck" value="true" else="false">
3703 <available file="${gnome.lib.src.dir}" type="dir" />
3704 </condition>
[28311]3705 <condition property="gnome.compiled.lib.present" value="true" else="false">
[27034]3706 <available file="${gnome.lib.compiled.dir}" type="dir"/>
3707 </condition>
[28311]3708 <condition property="gnome.lib.min.present" value="true" else="false">
[27034]3709 <available file="${basedir}/gs2build/ext/gnome-lib-minimal" type="dir" />
3710 </condition>
3711
[28311]3712 <!-- Make sure to checkout gnome-lib if it was not checked out at this stage
3713 since we're instructed to do so in th pre-condition to this target -->
[27034]3714 <if>
3715 <bool>
3716 <and>
[28320]3717 <isfalse value="${gnome.lib.min.present}"/>
3718 <isfalse value="${gnome.src.lib.present.firstcheck}"/>
[28311]3719 </and>
3720 </bool>
3721 <antcall target="checkout-gnome-lib"/>
3722 </if>
3723
[28320]3724 <!-- Keep track of whether we have the gnome-lib src folder now. Need to know this for a subsequent test -->
[28311]3725 <condition property="gnome.src.lib.present" value="true" else="false">
3726 <available file="${gnome.lib.src.dir}" type="dir" />
3727 </condition>
3728
3729 <!--<echo>MIN: ${gnome.lib.min.present}
3730 SRC LIB: ${gnome.src.lib.present}
3731 COMPILED: ${gnome.compiled.lib.present}</echo>-->
3732
3733 <if>
3734 <bool>
3735 <and>
3736 <isfalse value="${gnome.lib.min.present}"/> <!-- no gnome-lib-minimal binary present -->
[27034]3737 <istrue value="${gnome.src.lib.present}"/> <!-- gnome-lib folder for compilation is present-->
[28311]3738 <isfalse value="${gnome.compiled.lib.present}"/> <!-- gnome-lib not yet compiled, so no gnome-lib/os subfolder yet -->
[27034]3739 </and>
3740 </bool>
3741
3742 <!-- then compile it. Only necessary for mac/linux, since windows doesn't need gnome lib -->
3743 <exec executable="/bin/bash" dir="${gnome.lib.src.dir}" failonerror="true">
3744 <arg value="CASCADE-MAKE.sh"/>
3745 </exec>
3746 </if>
3747 </target>
3748
3749
[26791]3750 <target name="prepare-gnome-lib" depends="init" if="collection.building.enabled" unless="gnome-lib.present">
[27139]3751 <if>
3752 <bool>
[28643]3753 <istrue value="${checkout.gnomelib.ext}"/>
[27139]3754 </bool>
3755
[28643]3756 <antcall target="checkout-gnome-lib"/>
3757 <!--Compilation of gnome-lib happens during ant install, just before configuring (common-src and) build-src-->
3758
[28636]3759 <else>
[28643]3760 <echo>**** Not preparing gnome-lib:</echo>
3761 <echo>property checkout.gnomelib.ext in build.properties was not set or was set to false</echo>
[28636]3762 </else>
3763 </if>
3764 </target>
3765
3766
[26791]3767 <target name="checkout-gnome-lib" depends="init" if="collection.building.enabled" unless="nosvn.mode">
[27199]3768
3769 <property name="gnomelib.src.dir" value="${basedir}/gs2build/ext/gnome-lib"/>
3770 <condition property="gnome.src.present">
3771 <available file="${gnomelib.src.dir}" type="dir" />
3772 </condition>
3773
3774 <if>
3775 <bool>
3776 <not><istrue value="${gnome.src.present}"/></not>
3777 </bool>
3778
3779 <echo>checking out gnome-lib extension</echo>
3780 <exec executable="svn">
3781 <arg value="checkout"/>
3782 <arg value="${svn.root}/gs2-extensions/gnome-lib/trunk/src"/>
3783 <arg value="${gs2build.home}/ext/gnome-lib"/>
3784 </exec>
3785
3786 <else>
3787 <echo>gnomelib source code already exists at ${gnomelib.src.dir}</echo>
3788 </else>
3789 </if>
3790
[19843]3791 </target>
3792
[15124]3793 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
[15799]3794 unless="nosvn.mode">
[20930]3795
3796 <exec executable="svn">
3797 <arg value="checkout"/>
[21196]3798 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
[20930]3799 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]3800 <arg value="winbin"/>
[20930]3801 </exec>
3802
[15124]3803 </target>
3804
[15799]3805 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
[20930]3806 <exec executable="svn">
3807 <arg value="update"/>
3808 <arg value="winbin"/>
3809 <arg value="-r"/><arg value="${branch.revision}"/>
3810 </exec>
3811
[15799]3812 </target>
[15124]3813
3814 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
3815 <move todir="${gs2build.home}/bin/windows" failonerror="false">
3816 <fileset dir="${basedir}/winbin/bin"/>
3817 </move>
3818 </target>
[19843]3819
[15124]3820 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
3821 <delete dir="${basedir}/winbin"/>
3822 </target>
3823
[19871]3824 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
3825 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
3826 dest="${common.src.home}/packages/windows/crypt"/>
[18179]3827 <untar compression="gzip"
[19871]3828 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
3829 dest="${common.src.home}/packages/sqlite"/>
3830 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
3831 dest="${common.src.home}/indexers/packages/windows/iconv"/>
[15799]3832 </target>
[19878]3833
[15124]3834 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
3835 <!-- we want a windows path in the setup.bat file -->
3836 <pathconvert targetos="windows" property="gs2build.home.windows">
3837 <path path="${gs2build.home}"/>
3838 </pathconvert>
3839 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
3840 <filterset>
[16620]3841 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
[15799]3842 </filterset>
[15124]3843 </move>
3844 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
3845 </target>
3846
[19843]3847
[19948]3848 <target name="clean-build-src" depends="init" if="collection.building.enabled">
[19871]3849 <!-- unix: -->
[26079]3850 <if><bool><available file="${build.src.home}/Makefile"/></bool>
[19948]3851 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]3852 <arg value="clean"/>
3853 </exec>
[26079]3854 </if>
[15124]3855 <!-- windows: -->
[28044]3856 <exec executable="nmake" dir="${build.src.home}" osfamily="windows" failonerror="true">
[15799]3857 <arg value="/f"/>
3858 <arg value="win32.mak"/>
3859 <arg value="clean"/>
[19960]3860 <arg value="GSDLHOME=${gs2build.home}"/>
[15124]3861 </exec>
3862 </target>
3863
[19948]3864
3865 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
[19960]3866 <!-- unix: -->
[26079]3867 <if><bool><available file="${build.src.home}/Makefile"/></bool>
[19948]3868 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]3869 <arg value="distclean"/>
3870 </exec>
[26079]3871 </if>
[19960]3872 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
[28044]3873 <exec executable="nmake" dir="${build.src.home}" osfamily="windows" failonerror="true">
[19960]3874 <arg value="/f"/>
3875 <arg value="win32.mak"/>
3876 <arg value="clean"/>
3877 <arg value="GSDLHOME=${gs2build.home}"/>
3878 </exec>
[15124]3879 </target>
[19843]3880
[28643]3881 <target name="configure-build-src" depends="init" if="collection.building.enabled"
[19931]3882 description="Configure the build-src component">
3883 <exec executable="${build.src.home}/configure" os="${os.unix}"
3884 dir="${build.src.home}" failonerror="true">
3885 <arg value="--prefix=${gs2build.home}"/>
[26765]3886 <arg line="${gs2.opt.args} ${static.arg} ${cross.configure.args} ${allargs}"/>
[19931]3887 </exec>
3888 </target>
[19910]3889
[19931]3890 <!-- common-src is done separately and needs to be compiled first -->
3891 <target name="compile-build-src" depends="init" if="collection.building.enabled">
3892
3893 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[23611]3894 <arg line="${ldlpath.arg}"/>
[22845]3895 </exec>
3896
3897 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[32496]3898 <env key="GSDLOS" value="${os.bin.dir}"/>
3899 <arg value="install"/>
[19931]3900 </exec>
[19910]3901
[19931]3902 <!-- run the setup script -->
[28044]3903 <!-- <exec executable="${compile.windows.c++.setup}" osfamily="windows" failonerror="true"/>-->
[19910]3904 <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant-->
[28044]3905 <exec executable="nmake" dir="${build.src.home}" osfamily="windows" failonerror="true">
[19910]3906 <arg value="/f"/>
3907 <arg value="win32.mak"/>
[19934]3908 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]3909 </exec>
[28044]3910 <exec executable="nmake" dir="${build.src.home}" osfamily="windows" failonerror="true">
[19910]3911 <arg value="/f"/>
3912 <arg value="win32.mak"/>
3913 <arg value="install"/>
[19934]3914 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]3915 </exec>
[15124]3916 </target>
3917
3918
[15799]3919 <!-- ======================== TESTING Targets ========================= -->
[15124]3920
3921 <target name="test" description="Run the (incomplete) JUnit test suite "
3922 depends="init">
3923 <mkdir dir="${basedir}/test"/>
3924 <junit printsummary="withOutAndErr"
3925 errorproperty="test.failed"
3926 failureproperty="test.failed"
3927 fork="${junit.fork}">
3928 <formatter type="plain"/>
3929 <classpath>
[16936]3930 <pathelement location="${build.home}/gsdl3test.jar"/>
3931 <path refid="compile.classpath"/>
[15124]3932 </classpath>
3933 <test name="${testcase}" if="testcase"/>
3934 <batchtest todir="${basedir}/test" unless="testcase">
[18505]3935 <fileset dir="${build.home}" includes="**/*Test.class" />
[15124]3936 </batchtest>
3937 </junit>
3938 <echo>
3939 *********************************************
[15799]3940 Test output can be found in directory 'test'
[15124]3941 *********************************************
3942 </echo>
3943 </target>
[15799]3944
[20950]3945 <!-- ======================== FLAX Targets ========================= -->
3946 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
3947 <echo>checking out flax ...</echo>
3948 <mkdir dir="${basedir}/src/java/org/flax"/>
3949 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
[22198]3950 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
[20950]3951 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
3952 <mkdir dir="${web.home}/interfaces/flax"/>
3953 <mkdir dir="${web.home}/sites/flax"/>
3954 <mkdir dir="${basedir}/flax-resources"/>
3955 <mkdir dir="${basedir}/flax-lib"/>
[21272]3956 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
3957 <arg value="src/java/org/flax"/></exec>
3958 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
3959 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
[22198]3960 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
3961 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
3962 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
[21272]3963 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
3964 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
3965 <arg value="${web.home}/interfaces/flax"/></exec>
3966 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
3967 <arg value="${web.home}/sites/flax"/></exec>
3968 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
3969 <arg value="flax-resources"/></exec>
3970 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
3971 <arg value="flax-lib"/></exec>
[25901]3972 <antcall target="flax-copy-del-files" />
[20950]3973 </target>
[23442]3974
[25901]3975 <target name="flax-copy-del-files" description="copy some flax files into the appropriate greenstone3 directories and delete some unwanted greenstone stuff">
[23442]3976 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
3977 <copy todir="${web.home}/WEB-INF/lib">
[25901]3978 <fileset dir="${basedir}/flax-lib">
3979 <include name="*.jar"/>
3980 </fileset>
[23442]3981 </copy>
[25904]3982 <!--<delete dir="${web.home}/sites/gateway"/>
3983 <delete dir="${web.home}/sites/localsite"/>-->
[23442]3984 </target>
[20950]3985
3986 <target name="update-flax" description="update flax from repository">
3987 <echo>updating flax ...</echo>
[21272]3988 <exec executable="svn"><arg value="update"/>
3989 <arg value="src/java/org/flax"/></exec>
3990 <exec executable="svn"><arg value="update"/>
[22198]3991 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
3992 <exec executable="svn"><arg value="update"/>
[21272]3993 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
3994 <exec executable="svn"><arg value="update"/>
3995 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
3996 <exec executable="svn"><arg value="update"/>
3997 <arg value="${web.home}/interfaces/flax"/></exec>
3998 <exec executable="svn"><arg value="update"/>
[24366]3999 <arg value="${web.home}/web/sites/flax"/></exec>
4000 <exec executable="svn"><arg value="update"/>
[21272]4001 <arg value="flax-resources"/></exec>
4002 <exec executable="svn"><arg value="update"/>
4003 <arg value="flax-lib"/></exec>
[24098]4004 <antcall target="compile-core" />
[20950]4005 </target>
4006
[25901]4007 <!-- ========================End of FLAX Targets ========================= -->
[20963]4008
[19354]4009 <target name="compile-javadocs">
4010 <javadoc packagenames="org.greenstone.*"
4011 sourcepath="src/java"
4012 defaultexcludes="yes"
4013 destdir="docs/javadoc"
4014 author="true"
4015 version="true"
4016 use="true"
4017 windowtitle="Greenstone3 API">
4018 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
4019 </javadoc>
4020 </target>
4021
[20089]4022<!-- ========== Some distribution targets ======================== -->
[19972]4023 <target name="remove-source">
[23809]4024 <if><bool><isset property="with.gli.and.gems"/></bool>
[19975]4025 <delete includeEmptyDirs="true">
4026 <fileset dir="." defaultexcludes="false">
4027 <patternset refid="greenstone3.source.component"/>
4028 </fileset>
4029 </delete>
[23809]4030
4031 <else>
4032 <delete includeEmptyDirs="true">
4033 <fileset dir="." defaultexcludes="false">
4034 <patternset refid="greenstone3.source.no.gli.component"/>
4035 </fileset>
4036 </delete>
4037 </else>
4038 </if>
[19972]4039 </target>
4040
[19903]4041 <target name="dist-tidy"
[29387]4042 description="'tidies-up' a greenstone3 installation for distribution."
4043 unless="${properties.keep.src}">
[19903]4044
4045 <!-- delete unneeded things -->
4046 <delete dir="${packages.home}/axis"/>
4047 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
4048 <delete file="README-SVN.txt"/>
[32333]4049 <delete file="build.properties.svn"/>
[19903]4050
[19961]4051 <!-- delete source files -->
[19972]4052 <antcall target="remove-source"/>
[19903]4053
4054 <!-- create empty directories -->
[27829]4055 <mkdir dir="${web.writablehome}/applet"/>
4056 <mkdir dir="${web.writablehome}/logs"/>
4057 <mkdir dir="${web.writablehome}/logs/tmp"/>
[19903]4058
[27902]4059 <!-- Lines with ***** are commented out because these files are useful if we want hybrid installations -->
4060
[19903]4061 <!-- os specific tidy-ups -->
[20051]4062 <!-- linux, mac -->
4063 <if><bool><istrue value="${current.os.isunix}"/></bool>
[27902]4064 <!--*****<delete><fileset dir="." includes="*.bat"/></delete>-->
[23809]4065 <if><bool><isset property="with.gli.and.gems"/></bool>
[27902]4066 <!--*****<delete><fileset dir="gli" includes="*.bat"/></delete>-->
[23809]4067 </if>
[27902]4068 <!--*****<delete><fileset dir="gs2build" includes="*.bat"/></delete>-->
4069 <!--*****<delete><fileset dir="bin/script" includes="*.bat"/></delete>-->
[19946]4070 <delete file="${basedir}/gs2build/win32cfg.h"/>
[19939]4071 <delete file="${basedir}/gs2build/win32.mak"/>
[20051]4072 <delete dir="${basedir}/winutil"/>
[19903]4073 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
4074
[20051]4075 <!-- windows -->
4076 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
[27902]4077 <!--*****<delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>-->
[23809]4078 <if><bool><isset property="with.gli.and.gems"/></bool>
[27902]4079 <!--*****<delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>-->
[23809]4080 </if>
[27902]4081 <!--*****<delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>-->
4082 <!--*****<delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>-->
[20051]4083 </if></else></if>
4084
[19903]4085 </target>
4086
[20089]4087 <!-- fix up executable permissions for binary release -->
4088 <target name="fix-execute-permissions">
4089 <echo>Setting binaries to executable</echo>
[20127]4090 <chmod perm="775">
4091 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
4092 </chmod>
[20089]4093 </target>
4094
4095 <!-- fix up executable permissions for source code release -->
4096 <target name="fix-execute-permissions-source">
[20127]4097 <chmod perm="775">
4098 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
4099 </chmod>
[20089]4100 </target>
4101
[27380]4102 <!-- for macs, set up the .app shortcuts to gsi, gli, client-gli and gems -->
4103 <target name="gen-mac-shortcuts">
4104 <if><bool><istrue value="${current.os.ismac}"/></bool>
4105 <filter token="gsdl3srchome" value="${basedir}"/>
4106 <copy file="${basedir}/gs3-server.app/Contents/document.wflow.in" tofile="${basedir}/gs3-server.app/Contents/document.wflow" filtering="true" overwrite="true"/>
4107 <copy file="${basedir}/gli.app/Contents/document.wflow.in" tofile="${basedir}/gli.app/Contents/document.wflow" filtering="true" overwrite="true"/>
4108 <copy file="${basedir}/client-gli.app/Contents/document.wflow.in" tofile="${basedir}/client-gli.app/Contents/document.wflow" filtering="true" overwrite="true"/>
4109 <copy file="${basedir}/gems.app/Contents/document.wflow.in" tofile="${basedir}/gems.app/Contents/document.wflow" filtering="true" overwrite="true"/>
4110 </if>
4111 </target>
[20089]4112
[19931]4113 <!-- ============= tweaks for making compilation static ========== -->
4114 <target name="tweak-makefiles" depends="init" if="compile.static">
4115 <antcall target="rtftohtml-add-static" />
4116 </target>
4117
4118 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
[28136]4119 <rsr verbosity="1" file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
[19931]4120 </target>
4121
[32338]4122 <target name="run-collection-tests">
[26115]4123 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
4124 <fail>The testing extension is not available. This is required to perform the tests. It can be acquired from SVN by running the command "svn co http://svn.greenstone.org/gs3-extensions/testing/trunk/src testing" in the ext directory of your Greenstone 3 installation. </fail>
4125 </if>
4126 <for param="testjar">
4127 <path>
4128 <fileset dir="${basedir}" includes="web/sites/*/collect/*/tests/tests.jar"/>
4129 </path>
4130 <sequential>
4131 <echo>Testing @{testjar}</echo>
4132 <java classname="org.junit.runner.JUnitCore" fork="true">
4133 <arg value="gstests.TestClass"/>
[32429]4134 <jvmarg value="-DSERVERURL=${default.server.protocol}://${tomcat.server}:${default.tomcat.port}${app.path}${server.default.servlet} "/>
[26115]4135 <classpath>
4136 <fileset dir="${basedir}/ext/testing/lib/java">
4137 <include name="*.jar"/>
4138 </fileset>
4139 <files includes="@{testjar}"/>
4140 </classpath>
4141 </java>
4142 </sequential>
4143 </for>
4144 </target>
4145
4146 <target name="build-collection-tests">
4147 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
4148 <fail>The testing extension is not available. This is required to perform the tests. It can be acquired from SVN by running the command "svn co http://svn.greenstone.org/gs3-extensions/testing/trunk/src testing" in the ext directory of your Greenstone 3 installation. </fail>
4149 </if>
4150 <for param="compiledir">
4151 <path>
4152 <dirset dir="${basedir}" includes="web/sites/*/collect/*/tests/src"/>
4153 </path>
4154 <sequential>
4155 <echo>Compiling @{compiledir}</echo>
4156 <if><bool><not><available file="@{compiledir}/../build" type="dir"/></not></bool>
4157 <mkdir dir="@{compiledir}/../build"/>
4158 </if>
4159 <javac
4160 srcdir="@{compiledir}"
4161 destdir="@{compiledir}/../build"
[28137]4162 includeantruntime="${compile.includeantruntime}"
[26115]4163 debug="${compile.debug}"
4164 deprecation="${compile.deprecation}"
[29515]4165 optimize="${compile.optimize}"
4166 encoding="${compile.encoding}">
[26115]4167 <classpath>
4168 <fileset dir="${basedir}/ext/testing/lib/java">
4169 <include name="*.jar"/>
4170 </fileset>
4171 </classpath>
4172 <include name="gstests/*.java"/>
4173 </javac>
4174 <jar destfile="@{compiledir}/../tests.jar">
4175 <fileset dir="@{compiledir}/../build">
4176 <include name="gstests/**"/>
4177 </fileset>
4178 <manifest>
4179 <attribute name="Built-By" value="${user.name}" />
4180 </manifest>
4181 </jar>
4182 </sequential>
4183 </for>
4184 </target>
[26002]4185</project>
Note: See TracBrowser for help on using the repository browser.