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

Last change on this file since 36573 was 36573, checked in by davidb, 20 months ago

Adjust linebreak in echo/print statement for https setup message

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