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

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

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

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