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

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

Changed to checkout gnomelib and imagemagic tests the value (true/false), rather then the existence of the property (set/unset)

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