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

Last change on this file since 36534 was 36534, checked in by davidb, 3 months ago

Targets that need to depend on the new 'envbased-devel-props' so visualstudio.majorversion prop is set

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