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

Last change on this file since 36654 was 36654, checked in by davidb, 19 months ago

Working through a set of changes where config values need to be expressed in unix (URL, really) format to work with the Java programs that read in the config files

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