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

Last change on this file since 32381 was 32381, checked in by ak19, 6 years ago

Correction to running ant exec when passing a variable that optionanally has no value but empty string. Need to use arg line instead of arg value to ant exec in that case. When in testing mode, https.testing used to have the value minus-minus-staging. Now, when not in testing mode, https.testing having no value but running ant remove-/setup-cert-https works again using arg line.

File size: 166.4 KB
RevLine 
[15124]1<?xml version="1.0"?>
2<!-- ======================================================================
3 March 2005
4
5 Greenstone3 build and install script
6
7 kjdon
8 ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
[20241]10 <echo>os.name: ${os.name}</echo>
[15124]11
[15799]12 <!-- ============ classpath =================== -->
13 <path id="project.classpath">
14 <fileset dir="lib/java">
15 <include name="**/*.jar"/>
16 </fileset>
17 </path>
18
19 <!-- ============ self defined tasks =================== -->
20 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
21 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
[19930]22 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
[21196]23 <!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>-->
[15799]24 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
[26115]25 <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" classpathref="project.classpath"/>
[23854]26 <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
27
[19930]28
[15799]29 <!-- ===================== Property Definitions =========================== -->
30
31 <!--
[15124]32
33 Each of the following properties are used in the build script.
34 Values for these properties are set by the first place they are
35 defined, from the following list:
36
37 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
38
39 * Definitions from a "build.properties" file in the top level
[15799]40 source directory of this application.
[15124]41
42 * Definitions from a "build.properties" file in the user's
[15799]43 home directory.
[15124]44
45 * Default definitions in this build.xml file.
46
47 You will note below that property values can be composed based on the
48 contents of previously defined properties. This is a powerful technique
49 that helps you minimize the number of changes required when your development
50 environment is modified. Note that property composition is allowed within
51 "build.properties" files as well as in the "build.xml" script.
52
[15799]53 -->
[32356]54
55 <!-- Developer property. Set value=true if you want test https certificates issued
56 (as there's a limit on how many real certificates you can be issued per week).
57 If not testing can either uncomment this property or set value=false.
58 -->
[32350]59 <property name="https.test.mode" value="false"/>
[18227]60
[27834]61 <property name="os.linux" value="Linux"/>
62 <property name="os.mac" value="Mac OS X"/>
63 <property name="os.solaris" value="SunOS"/>
64 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
[28042]65 <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"/> <!-- check this!!!-->
[27834]66
67 <!-- this is true for linux and macs -->
68 <condition property="current.os.isunix">
69 <os family="unix"/>
70 </condition>
71
72 <condition property="current.os.isunixnotmac">
73 <and>
74 <os family="unix"/>
75 <not>
76 <os family="mac"/>
77 </not>
78 </and>
79 </condition>
80
81 <condition property="current.os.ismac">
82 <os family="mac"/>
83 </condition>
84
85 <condition property="current.os.iswindows">
86 <os family="windows"/>
87 </condition>
88
[18227]89 <!-- create build.properties if it has not been created yet -->
90 <if>
91 <bool><not><available file="build.properties"/></not></bool>
[32310]92 <copy file="build.properties.svn" tofile="build.properties"/>
[32370]93 <property name="first.run" value="true"/>
[18227]94 </if>
95
[18515]96 <!-- create the packages dir if it has not been created yet -->
97 <mkdir dir="packages"/>
[15799]98
[15859]99 <!--the first three properties have to be put on the top to be used by build.properties-->
[19960]100 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
[15124]101 <property name="src.packages.home" value="${basedir}/src/packages"/>
[15859]102 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
[19878]103
[27860]104 <property name="solr-ext.home" value="${basedir}/ext/solr"/>
105
[15124]106 <property file="build.properties"/>
[16962]107 <if><bool><available file="${user.home}/build.properties"/></bool>
108 <property file="${user.home}/build.properties"/>
109 </if>
[15124]110
[32334]111
112 <!-- If internal.tomcat.port not yet set, work it out based on server.protocol
113 Would be great if we could just use nested variables in build.properties
114 https://grokbase.com/t/ant/user/04698xjbp3/nested-variables-in-ant
115 http://ant.apache.org/faq.html#propertyvalue-as-name-for-property
[32339]116 http://ant.1045680.n5.nabble.com/Property-expansion-in-macrodef-attributes-td5476406.html
[32334]117
118 https://marc.info/?l=ant-user&m=111231719328847
119 http://ant-contrib.sourceforge.net/tasks/tasks/propertycopy.html
120 http://www.jguru.com/faq/view.jsp?EID=1072238
121 * propfile:
122 https://ant.apache.org/manual/Tasks/propertyfile.html
[32355]123 * "valid ports range from 1024–49151" is probably about user assignable ports.
124 But 80 is a valid port for running web servers including GS
125 and in future the range may become greater, so don't restrict the port range to 1024-49151.
[32334]126 https://stackoverflow.com/questions/113224/what-is-the-largest-tcp-ip-network-port-number-allowable-for-ipv4
127 -->
128 <if>
129 <bool>
[32339]130 <and>
131 <isset property="tomcat.port.http"/>
[32355]132 <not><matches string="${tomcat.port.http}" pattern="^\d{2,}\s*$"/></not>
[32339]133 </and>
[32334]134 </bool>
[32339]135 <fail>...
136 ********* ERROR: tomcat.port.http in file build.properties is set to an invalid port number.
[32355]137 If port 80 is not possible, user assignable ports range from 1024–49151.
138 But don't choose any port already in use by another application.
[32339]139 Try setting to tomcat.port.http=8383
140 </fail>
[32334]141 </if>
142
[32339]143 <if>
144 <bool>
145 <and>
146 <isset property="tomcat.port.https"/>
[32355]147 <not><matches string="${tomcat.port.https}" pattern="^\d{2,}\s*$"/></not>
[32339]148 </and>
149 </bool>
150 <fail>...
151 ********* ERROR: tomcat.port.https in file build.properties is set to an invalid port number.
[32355]152 If port 80 is not possible, user assignable ports range from 1024–49151.
153 But don't choose any port already in use by another application.
[32339]154 Try setting tomcat.port.https=8443
155 </fail>
156 </if>
157
[32340]158 <!--
[32346]159 Bail if https is enabled but the keystore password (keystore.pass property) is not set.
[32349]160 However, keystore.pass has no default value and is therefore not set as a rule. So don't bail when 'ant' is run for the first time to create build.props from build.props.svn. But do bail if running ant.prepare and https enabled and password not set.
[32346]161 (Maybe put this entire section before the first target: so we only bail after all non-targets are executed so that any other first ever initialisation is completed?)
162 -->
163 <if>
164 <bool>
165 <and>
166 <isset property="tomcat.port.https"/>
167 <or>
168 <not><isset property="keystore.pass"/></not>
169 <matches string="${keystore.pass}" pattern="^\s*$"/>
170 </or>
171 </and>
172 </bool>
173 <if>
174 <bool><isset property="first.run"/></bool>
175 <echo>IMPORTANT: When tomcat.port.https is set in file build.properties, as now,
176 the keystore.pass property must be set to a non-empty value.
177 Either comment out tomcat.port.https if you don't want support for https,
178 or set keystore.pass.</echo>
179 <else>
180 <fail>...
181 ********* ERROR: tomcat.port.https in file build.properties is set, but its required keystore.pass property is not set or is set to the empty string. Choose a password for keystore.pass and set it in build.properties before proceeding.
182 </fail>
183 </else>
184 </if>
185 </if>
186
187 <!--
[32340]188 1. Using the macrodef task from ant 1.6+ (https://ant.apache.org/manual/Tasks/macrodef.html)
189 to define "propertycopy" macro that then allows us to use nested variables in build.xml
190 (Is there any way to use nested variables in build.properties?)
191 Defining the propertycopy macro:
192 http://ant.apache.org/faq.html#propertyvalue-as-name-for-property
193 -->
194 <macrodef name="propertycopy">
195 <attribute name="name"/>
196 <attribute name="from"/>
197 <sequential>
198 <property name="@{name}" value="${@{from}}"/>
199 </sequential>
200 </macrodef>
[32339]201 <!--
[32340]202 2. Now can use the 'propertycopy' macro defined above to allow us to use a property's value
203 (e.g. server.protocol's value) as a part of the name for a property.
[32339]204 So we want do something like ${tomcat.port.${server.protocol}}, which, if server.protocol=http,
[32340]205 we'd like it to turn into tomcat.port.http. Then we want to use the constructed variable name
206 to assign its value to a new variable. Use is as follows:
207 propertycopy name="tomcat.port.protocol" from="tomcat.port.${server.protocol}"
[32339]208 http://ant.1045680.n5.nabble.com/Property-expansion-in-macrodef-attributes-td5476406.html
209 -->
210 <propertycopy name="internal.tomcat.port" from="tomcat.port.${server.protocol}"/>
211 <if>
[32340]212 <bool><matches string="${internal.tomcat.port}" pattern="tomcat\.port"/></bool>
[32339]213 <fail>...
214 ********* ERROR: Unable to set tomcat.port:
215 In file build.properties server.protocol=${server.protocol} and requires at minimum that its
216 matching tomcat.port.${server.protocol} property line is enabled and set to a valid port number.</fail>
217 </if>
218
219 <!-- If we got here, we got a valid tomcat port. Set tomcat.port in build.properties
220 Set autogenerated properties (properties we calculate here in build.xml)
[32334]221 in build.properties. https://ant.apache.org/manual/Tasks/propertyfile.html
222 For now only internal.tomcat.port is determined by build.xml
223 and written out to build.properties as tomcat.port.
224 Internally, this file still uses internal.tomcat.port as any old value
225 read in from build.properties for tomcat.port can't be changed in memory
226 even though we can write it back out again to build.properties.
227 -->
[32340]228 <echo>Using tomcat port: ${internal.tomcat.port}</echo>
[32359]229
230 <!-- We're no longer writing out a tomcat.port property to build.properties based on what we've determined this should be:
231 - the perl code only cares about the final GS3 URL, which is determined by this ant build file and uses internal.tomcat.port
232 - and the GS3 Java src code has been updated to work without tomcat.port in build.properties -->
233 <!--
[32339]234 <propertyfile file="build.properties">
235 <entry key="tomcat.port" value="${internal.tomcat.port}"/>
236 </propertyfile>
[32359]237 -->
[32334]238
[32346]239 <!-- For setting filter tokens.
240 Used to set up server.xml when configuring tomcat -->
241 <property name="comment.start" value="&lt;!--" />
242 <property name="comment.end" value="--&gt;" />
243 <!-- originally, https redirectPort when using regular http port 8383
244 was always fixed at 8443. Now we use redirectPort=tomcat.port.https unless
245 it's not set, in which case we fall back to the original value of 8443. -->
246 <condition property="https.redirect.port" value="${tomcat.port.https}" else="8443">
247 <isset property="tomcat.port.https"/>
248 </condition>
[32339]249
[32346]250 <!-- if http is not enabled, comment out its Connecter element in server.xml -->
251 <condition property="http.comment.out.start" value="" else="${comment.start}">
252 <isset property="tomcat.port.http"/>
253 </condition>
254 <condition property="http.comment.out.end" value="" else="${comment.end}">
255 <isset property="tomcat.port.http"/>
256 </condition>
257 <!-- if https is not enabled, comment out its Connecter element in server.xml -->
258 <condition property="https.comment.out.start" value="" else="${comment.start}">
259 <isset property="tomcat.port.https"/>
260 </condition>
261 <condition property="https.comment.out.end" value="" else="${comment.end}">
262 <isset property="tomcat.port.https"/>
263 </condition>
264
[32350]265 <condition property="https.testing" value="" else="--staging">
[32351]266 <isfalse value="${https.test.mode}"/>
[32350]267 </condition>
268
[20464]269 <!-- now we've read in properties, apply defaults -->
270 <property name="disable.collection.building" value="false"/>
271
[15124]272 <!-- get properties from the environment -->
273 <property environment="env"/>
[15799]274
[20127]275 <!-- get the filesets defining components and executables -->
[19975]276 <import file="resources/xml/components.xml"/>
[20127]277 <import file="resources/xml/executables.xml"/>
[15799]278
279 <!-- version properties for external packages -->
[20079]280 <!-- for Java versions < 1.4, we print out the message that Java is too old.
[25131]281 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 7.0-->
[29578]282 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-7.0.57">
[20079]283 <equals arg1="1.4" arg2="${ant.java.version}"/>
284 </condition>
[25131]285 <condition property="tomcat.version.major" value="5" else="7">
[20079]286 <equals arg1="1.4" arg2="${ant.java.version}"/>
287 </condition>
[22320]288 <condition property="privileged.attribute" value="privileged='true'" else="">
[25384]289 <equals arg1="7" arg2="${tomcat.version.major}"/>
[22320]290 </condition>
[20233]291
[29845]292 <!-- external access to the GS3 pages or not
293 https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html -->
294 <condition property="allowed.IPs"
295 value=".*"
296 else="(127\.0\.0\.1|::1|0:0:0:0:0:0:0:1)">
297 <matches pattern="^(1|true|yes)$" string="${server.external.access}"/>
298 </condition>
299
[22405]300 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
301 <property name="axis.dir.version" value="axis-1_4"/>
[24077]302 <property name="sqlite.targz.version" value="sqlite-autoconf-3070602.tar.gz"/>
[15799]303
[15124]304 <property name="build.home" value="${basedir}/build"/>
305 <property name="src.home" value="${basedir}/src/java"/>
[27829]306
307 <if><bool><istrue value="${gsdl3home.isreadonly}"/></bool>
308 <property name="readonly-packages.home" value="${basedir}/packages"/>
309 <property name="packages.home" value="${gsdl3.writablehome}/packages"/>
[30303]310 <!--
[30304]311 To run solr from a read-only location (like a DVD-ROM), its locktype needs to be "single",
[30303]312 else solr tries to write out a lock file to the collection's index folder which is read-only.
313
314 https://cwiki.apache.org/confluence/display/solr/IndexConfig+in+SolrConfig
315 says that the "single" locktype is "for special situations of a read-only index directory, or ...."
316
317 See also http://wiki.apache.org/lucene-java/AvailableLockFactories
[30304]318 And look for the documentation on "locktype" in solr collection's etc/conf/solrconfig.xml
319 for further information on the different locktypes.
[30303]320
321 To set the locktype property from the commandline (it's a property to the server web), pass in
322 "-Dsolr.lock.type=..." to the web server, as explained in
323 http://lucene.472066.n3.nabble.com/Where-can-we-set-the-parameters-in-Solr-Config-td4183706.html
324 -->
325 <property name="readonly.catalina.opts" value="-Dsolr.lock.type=single"/>
[27829]326 <else>
327 <property name="packages.home" value="${basedir}/packages"/>
[30303]328 <property name="readonly.catalina.opts" value=""/>
[27829]329 </else>
330 </if>
331
332 <!-- this may be set in build.properties, e.g. if you move the web dir to
333 tomcats webapps directory -->
[15124]334 <property name="web.home" value="${basedir}/web"/>
[27829]335 <property name="web.writablehome" value="${gsdl3.writablehome}"/>
[30573]336 <!-- If using a dispersed GS3 web folder, then the user web would not contain everything in the
337 default GS3 web (it won't contain a CGI or lib folder inside WEB-INF, for instance) -->
[30568]338 <if>
339 <bool><available file="${web.home}/WEB-INF/cgi" type="dir"/></bool>
340 <property name="full.web.dir" value="${web.home}"/>
341 <else>
342 <property name="full.web.dir" value="${basedir}/web"/>
343 </else>
344 </if>
345
[15124]346 <!-- jar files needed by applets go here -->
347 <property name="web.applet" value="${web.home}/applet"/>
[30568]348
[15124]349 <!-- jar files needed by the servlet (and extra ones) go here -->
350 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
[27829]351 <property name="web.writablelib" value="${web.writablehome}/WEB-INF/lib"/>
[15124]352 <!-- other files needed by the servlet go here -->
353 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
[27829]354 <property name="web.writableclasses" value="${web.writablehome}/WEB-INF/classes"/>
355
356 <if>
357 <bool><istrue value="${gsdl3home.isreadonly}"/></bool>
358 <echo>Greenstone3 home directory is read-only</echo>
359 <echo> => Writable area is: ${gsdl3.writablehome}</echo>
360
361 <condition property="gsdl3.writablehome.already-exists">
362 <available file="${gsdl3.writablehome}" type="dir"/>
363 </condition>
364
365 <if>
366 <bool><not><istrue value="${gsdl3.writablehome.already-exists}"/></not></bool>
367
368 <!-- set up writable area -->
369 <echo>No previous Greenstone home writable area detected</echo>
370 <echo> => Setting up area</echo>
371 <mkdir dir="${gsdl3.writablehome}"/>
372 <mkdir dir="${gsdl3.writablehome}/packages"/>
373 <mkdir dir="${gsdl3.writablehome}/logs"/>
[27860]374 <mkdir dir="${gsdl3.writablehome}/ext/solr"/>
[27829]375
376 <chmod perm="a+rwx" dir="${gsdl3.writablehome}"/>
377 <chmod perm="a+rwx" dir="${gsdl3.writablehome}/packages"/>
378 <chmod perm="a+rwx" dir="${gsdl3.writablehome}/logs"/>
[27860]379 <chmod perm="a+rwx" dir="${gsdl3.writablehome}/ext/solr"/>
[27829]380
381 <!-- copy over packages tomcat folder -->
382
383 <if>
[27834]384 <bool><istrue value="${current.os.iswindows}"/></bool>
[27829]385 <copy todir="${gsdl3.writablehome}/packages/tomcat"
386 preservelastmodified="true"
387 failonerror="true" >
388 <fileset dir="${readonly-packages.home}/tomcat" includes="**"/>
389 </copy>
390
391 <else>
392 <!-- else assume Unix -->
[30279]393 <!-- Can't go through the OS-independent <copy> task as it fails to preserve exec permissions -->
[27829]394 <echo>Copying to ${gsdl3.writablehome}/packages/tomcat</echo>
395 <exec executable="cp" output="/dev/null" spawn="false">
396 <arg value="-r"/>
397 <arg value="${readonly-packages.home}/tomcat"/>
398 <arg value="${gsdl3.writablehome}/packages/."/>
399 </exec>
[30279]400
401 <!-- the packages folder in tmp only has read permissions at this stage, it needs more permissions to work when running GS3 off a disc -->
402 <chmod perm="a+rwx" file="${gsdl3.writablehome}/packages/**" />
403
[27829]404 </else>
405 </if>
406
407 <echo> => Copying Greenstone's web/WEB-INF to writable area</echo>
408 <copy todir="${gsdl3.writablehome}/WEB-INF"
409 preservelastmodified="true"
410 failonerror="true" >
[30568]411 <fileset dir="${full.web.dir}/WEB-INF" includes="**"/>
[27829]412 </copy>
413
414 <copy todir="${gsdl3.writablehome}"
415 preservelastmodified="true"
416 failonerror="true" >
417 <fileset dir="${web.home}" includes="index.html"/>
418 </copy>
419
420 </if>
421 </if>
422
423
[15124]424 <!--- flax: the WordNet home -->
425 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
426
427 <!-- jni libraries and java wrappers go here -->
428 <property name="lib.jni" value="${basedir}/lib/jni"/>
[19878]429
430 <!-- other jar files needed for installation (but not runtime) go here -->
[18110]431 <property name="lib.java" value="${basedir}/lib/java"/>
[15799]432
[15124]433 <property name="javadocs" value="${basedir}/docs/javadoc"/>
434
435 <property name="app.name" value="greenstone3"/>
[31508]436 <property name="app.path" value="/${greenstone.context}"/>
[15124]437
[18124]438 <property name="admin.dir" value="${basedir}/admin"/>
[15124]439
[27829]440 <!-- defaults - set these on the command line or in build.properties or
441 they will take these default values-->
[15124]442 <property name="app.version" value="trunk"/>
443 <property name="branch.path" value="trunk"/>
444 <property name="branch.revision" value="HEAD"/>
445
446 <!--constants -->
447 <property name="svn.root" value="http://svn.greenstone.org"/>
448
[19878]449 <!-- catalina home is set to tomcat basedir if already installed, otherwise
[27829]450 use greenstone's tomcat -->
[20085]451 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
[15124]452 <and>
453 <isset property="tomcat.installed.path"/>
454 <not>
[27829]455 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]456 </not>
457 </and>
458 </condition>
[25131]459
[15124]460
[19933]461 <!-- is there a better way to do this?? what about solaris?? -->
[26765]462 <condition property="os.bin.dir" value="${cross.os}">
463 <istrue value="${compile.cross}"/>
464 </condition>
[19933]465 <condition property="os.bin.dir" value="windows">
466 <os family="windows"/>
467 </condition>
468 <condition property="os.bin.dir" value="darwin">
469 <os family="mac"/>
470 </condition>
471 <condition property="os.bin.dir" value="linux">
472 <and>
473 <os family="unix"/>
474 <not>
475 <os family="mac"/>
476 </not>
477 </and>
478 </condition>
[26765]479
[19933]480
[19878]481 <condition property="collection.building.disabled">
[20464]482 <and>
483 <isset property="disable.collection.building"/>
484 <istrue value="${disable.collection.building}"/>
485 </and>
[19878]486 </condition>
487
[15124]488 <condition property="collection.building.enabled">
489 <not>
[20464]490 <istrue value="${disable.collection.building}"/>
[15124]491 </not>
492 </condition>
[19878]493
[15124]494 <condition property="collection.building.enabled.windows">
495 <and>
[20464]496 <istrue value="${collection.building.enabled}"/>
[15124]497 <isset property="current.os.iswindows"/>
498 </and>
499 </condition>
500
501 <condition property="collection.building.enabled.unix">
502 <and>
[20464]503 <istrue value="${collection.building.enabled}"/>
[15124]504 <isset property="current.os.isunix"/>
505 </and>
506 </condition>
[22847]507
[20085]508 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
[19931]509 <isset property="compile.static"/>
510 </condition>
[22184]511
[27199]512 <!-- If building a release then we want to adjust environment variables so that the support library can be seen during compilation -->
[27185]513 <if><bool><isset property="use.gnomelib.ext"/></bool>
[23599]514 <property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
[22845]515
[23599]516 <if><bool><isset property="env.CFLAGS"/></bool>
517 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CFLAGS}&quot;"/>
518 <else>
519 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
520 </else>
521 </if>
[22845]522
[23599]523 <if><bool><isset property="env.CPPFLAGS"/></bool>
524 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CPPFLAGS}&quot;"/>
525 <else>
526 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
527 </else>
528 </if>
[22847]529
[23599]530 <if><bool><isset property="env.CXXFLAGS"/></bool>
531 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CXXFLAGS}&quot;"/>
532 <else>
533 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
534 </else>
535 </if>
536
[30883]537 <!--https://groups.google.com/forum/#!topic/openkinect/m-hfXeYwKtU
538 compiling up libwv on ElCapitan needs -framework CoreFoundation -->
[23599]539 <if><bool><isset property="env.LDFLAGS"/></bool>
[30884]540 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib ${env.LDFLAGS}&quot;"/>
[23599]541 <else>
[30884]542 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib&quot;"/>
[23599]543 </else>
544 </if>
545
546 <if><bool><isset property="env.PATH"/></bool>
547 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin:${env.PATH}&quot;"/>
548 <else>
549 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin&quot;"/>
550 </else>
551 </if>
552
553 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
554 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig:${env.PKG_CONFIG_PATH}&quot;"/>
555 <else>
556 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig&quot;"/>
557 </else>
558 </if>
[30758]559
[23611]560 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
[30864]561 <!--<if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
[30786]562 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}&quot;"/>
563 <else>
564 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
[30864]565 </else>
566 </if>
567 -->
[30865]568 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
[23599]569 <else>
[30759]570 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
[23611]571 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
572 <else>
573 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
574 </else>
575 </if>
[23599]576 </else>
577 </if>
578
[30758]579
[23599]580 <else>
581 <if><bool><isset property="env.CFLAGS"/></bool>
582 <property name="cflags.arg" value="CFLAGS=&quot;${env.CFLAGS}&quot;"/>
583 <else>
584 <property name="cflags.arg" value=" "/>
585 </else>
586 </if>
587
588 <if><bool><isset property="env.CPPFLAGS"/></bool>
589 <property name="cppflags.arg" value="CPPFLAGS=&quot;${env.CPPFLAGS}&quot;"/>
590 <else>
591 <property name="cppflags.arg" value=" "/>
592 </else>
593 </if>
594
595 <if><bool><isset property="env.CXXFLAGS"/></bool>
596 <property name="cxxflags.arg" value="CXXFLAGS=&quot;${env.CXXFLAGS}&quot;"/>
597 <else>
598 <property name="cxxflags.arg" value=" "/>
599 </else>
600 </if>
601
602 <if><bool><isset property="env.LDFLAGS"/></bool>
[30884]603 <property name="ldflags.arg" value="LDFLAGS=&quot;${env.LDFLAGS}&quot;"/>
[23599]604 <else>
[30884]605 <property name="ldflags.arg" value=" "/>
[23599]606 </else>
607 </if>
608
609 <if><bool><isset property="env.PATH"/></bool>
610 <property name="path.arg" value="PATH=&quot;${env.PATH}&quot;"/>
611 <else>
612 <property name="path.arg" value=" "/>
613 </else>
614 </if>
615
616 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
617 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${env.PKG_CONFIG_PATH}&quot;"/>
618 <else>
619 <property name="pcpath.arg" value=" "/>
620 </else>
621 </if>
622
[23611]623 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
624 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
625 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
626 <else>
627 <property name="ldlpath.arg" value=" "/>
628 </else>
629 </if>
[23599]630 <else>
[23611]631 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
632 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
633 <else>
634 <property name="ldlpath.arg" value=" "/>
635 </else>
636 </if>
637 </else>
[23599]638 </if>
639 </else>
[22868]640 </if>
[23611]641 <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
[22868]642
[26765]643 <condition property="opt.cross.build"
644 value="--build=${cross.build}" else=" ">
645 <isset property="cross.build"/>
646 </condition>
647
648
649 <condition property="cross.configure.args"
[26806]650 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]651 <istrue value="${compile.cross}"/>
652 </condition>
653
[28311]654 <!-- if we're told to work with gnome-lib, or if there's a gnome-lib-minimal that the user
655 has placed in gs2build/ext, then compile gs2build after sourcing gnome-lib environment -->
656 <condition property="opt.gnomelibext.arg"
657 value="--enable-gnome-lib-ext" else=" ">
658 <or>
659 <available file="${gs2build.home}/ext/gnome-lib-minimal" type="dir"/>
660 <istrue value="${use.gnomelib.ext}"/>
661 <istrue value="${checkout.gnomelib.ext}"/>
662 </or>
663 </condition>
664
[27028]665<!-- if you want to disable wvware, do so here: set the value (not else) field to contain minus-minus-disable-wvware -->
[28311]666 <condition property="gs2.opt.args" value="${opt.gnomelibext.arg} " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
[22184]667 <istrue value="${with.jni}"/>
668 </condition>
669 <condition property="gs2.compile.target" value="with-jni" else="without-jni">
670 <istrue value="${with.jni}"/>
671 </condition>
672 <condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
673 <istrue value="${with.jni}"/>
674 </condition>
675 <condition property="gs2.windows.enablejni" value="1" else="0">
676 <istrue value="${with.jni}"/>
677 </condition>
[22976]678 <condition property="gs2.windows.enablemg" value="1" else="0">
679 <istrue value="${with.jni}"/>
680 </condition>
681 <condition property="gs2.windows.enablemgpp" value="1" else="0">
682 <istrue value="${with.jni}"/>
683 </condition>
684 <!-- Should accent folding not also be set here ?? -->
685 <condition property="gs2.windows.usegdbm" value="1" else="0">
686 <istrue value="${with.jni}"/>
687 </condition>
688 <condition property="gs2.windows.usesqlite" value="1" else="0">
689 <istrue value="${with.jni}"/>
690 </condition>
[19931]691
[15799]692 <!-- where is search4j tool -->
[20085]693 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
[15799]694 <isset property="current.os.iswindows"/>
[15136]695 </condition>
696
[15799]697
[15124]698 <!-- ============= Base dirs for each package and component ============ -->
699 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
700 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
701 <property name="gli.home" value="${basedir}/gli"/>
702 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
703
[21347]704 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
[20464]705 <istrue value="${disable.collection.building}"/>
[19871]706 </condition>
[19931]707
708 <property name="build.src.home" value="${gs2build.home}/build-src"/>
[19871]709 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
710 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
711 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
712 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
713
[15799]714 <!-- ==================== Compilation Control Options ==================== -->
[15124]715
[15799]716 <!--
[15124]717
718 These properties control option settings on the Javac compiler when it
719 is invoked using the <javac> task.
720
721 compile.debug Should compilation include the debug option?
722
723 compile.deprecation Should compilation include the deprecation option?
724
725 compile.optimize Should compilation include the optimize option?
726
[15799]727 -->
[15124]728
729 <property name="compile.debug" value="true"/>
730 <property name="compile.deprecation" value="true"/>
731 <property name="compile.optimize" value="true"/>
[29515]732 <property name="compile.encoding" value="UTF8"/>
[28137]733 <property name="compile.includeantruntime" value="false"/> <!-- to get rid of annoying 'ant' warning -->
[15124]734
[15799]735 <!--
[15124]736
737 Rather than relying on the CLASSPATH environment variable, Ant includes
738 features that makes it easy to dynamically construct the classpath you
739 need for each compilation. The example below constructs the compile
740 classpath to include the servlet.jar file, as well as the other components
741 that Tomcat makes available to web applications automatically, plus anything
742 that you explicitly added.
743
[15799]744 -->
[20079]745
746 <!-- All elements that Tomcat 5 exposes to applications -->
747 <path id="tomcat5">
[20085]748 <pathelement location="${catalina.home}/common/classes"/>
749 <fileset dir="${catalina.home}/common/endorsed">
750 <include name="*.jar"/>
751 </fileset>
752 <fileset dir="${catalina.home}/common/lib">
753 <include name="*.jar"/>
754 </fileset>
755 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
756 <pathelement location="${catalina.home}/shared/classes"/>
757 <fileset dir="${catalina.home}/shared/lib">
758 <include name="*.jar"/>
759 </fileset>
[20079]760 </path>
761
[25131]762 <!-- All elements that Tomcat 7 exposes to applications -->
763 <path id="tomcat7">
[20085]764 <fileset dir="${catalina.home}/lib">
765 <include name="*.jar"/>
766 </fileset>
[20079]767 </path>
768
[15124]769 <path id="compile.classpath">
770 <!-- Include all jar files and libraries in our jni lib directory -->
771 <pathelement location="${lib.jni}"/>
772 <fileset dir="${lib.jni}">
773 <include name="*.jar"/>
774 </fileset>
775 <!-- Include all jar files in our web lib directory -->
776 <pathelement location="${web.lib}"/>
777 <fileset dir="${web.lib}">
778 <include name="*.jar"/>
779 </fileset>
780
[18110]781 <pathelement location="${lib.java}"/>
782 <fileset dir="${lib.java}">
783 <include name="*.jar"/>
784 </fileset>
[15124]785
786 <!-- include the jar files from the source packages -->
787 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
788 so we add them in by name -->
[22184]789 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
[15124]790 <pathelement location="${lib.jni}/mg.jar"/>
791 <pathelement location="${lib.jni}/mgpp.jar"/>
792
[20085]793 <!-- Include all elements that Tomcat exposes to applications -->
794 <path refid="tomcat${tomcat.version.major}"/>
795
[15124]796 </path>
797
798 <path id="local.tomcat.classpath">
799 <!-- explicitly include the jni java wrappers in the classpath -->
800 <pathelement location="${lib.jni}"/>
801 <fileset dir="${lib.jni}">
802 <include name="*.jar"/>
803 </fileset>
[25095]804
[27829]805 <pathelement location="${web.writablelib}"/>
806 <fileset dir="${web.writablelib}">
[29903]807 <include name="derbyclient.jar"/> <!--<include name="derby.jar"/>-->
[25095]808 </fileset>
[15124]809 </path>
810
[29903]811 <path id="derby.server.classpath">
[30568]812 <pathelement location="${web.writablelib}/derbynet.jar"/>
813 <pathelement location="${web.writablelib}/derby.jar"/>
[29903]814 </path>
815
[32153]816
817 <if><bool><isset property="env.PATH"/></bool>
818 <path id="local.tomcat.path">
819 <pathelement location="${basedir}/bin/script"/>
820 <pathelement location="${basedir}/bin"/>
821 <pathelement location="${lib.jni}"/>
822 <pathelement path="${env.PATH}"/>
823 <pathelement path="${wn.home}/bin"/>
824 </path>
825 <!-- Windows can be case sensitive about env.PATH, preferring env.Path. See https://ant.apache.org/manual/Tasks/property.html -->
826 <else><if><bool><isset property="env.Path"/></bool>
827 <path id="local.tomcat.path">
828 <pathelement location="${basedir}/bin/script"/>
829 <pathelement location="${basedir}/bin"/>
830 <pathelement location="${lib.jni}"/>
831 <pathelement path="${env.Path}"/>
832 <pathelement path="${wn.home}/bin"/>
833 </path>
834 <!-- else print error about no path set -->
835 <else>
836 <echo>No env.PATH (or env.Path) set. Unable to set local.tomcat.path property</echo>
837 </else></if></else>
838 </if>
[29903]839
[15124]840 <target name="test-setup">
841 <echo>ant java version=${ant.java.version}</echo>
842 <echo>is unix : ${current.os.isunix}</echo>
843 <echo>is mac : ${current.os.ismac}</echo>
844 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
845 <echo>is windows : ${current.os.iswindows}</echo>
846 <echo>os.unix: ${os.unix}</echo>
[32153]847 <echo>env.PATH: ${env.PATH}</echo>
848 <echo>env.Path: ${env.Path}</echo>
[15124]849 </target>
[27369]850
[31121]851 <target name="needs-gs3-setup">
852 <!-- has the gs3-setup script been run?? -->
853 <condition property="gs3-setup-not-done">
854 <not>
855 <isset property="env.GSDL3HOME"/>
856 </not>
857 </condition>
858
859 <fail if="gs3-setup-not-done" message="Please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before starting the Greenstone server."/>
860 </target>
861
[27369]862 <!-- Appends the current env to the file environment.txt. For debugging env vars used by the release-kit. -->
[29341]863 <target name="write-env" description="Writes out the environment that this build.xml is executed in to file environment.txt. For debugging.">
[27369]864 <echo message="*****************ENVIRONMENT OUTPUT:****************${line.separator}" file="environment.txt" append="true" />
865
866 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[32152]867 <exec executable="cmd" dir="${basedir}" failonerror="false" output="environment.txt" append="true">
[29343]868 <arg value="/c" />
869 <arg value="set" />
870 </exec>
[27369]871 <else>
872 <exec executable="env" dir="${basedir}" failonerror="false" output="environment.txt" append="true" />
873 </else>
874 </if>
875
876 <echo message="${line.separator}" file="environment.txt" append="true" />
877 </target>
878
[20085]879
[15799]880 <!-- ==================== Primary and Global Targets ============================= -->
[15124]881
[32310]882 <target name="prepare" depends="accept-properties,init,copy-dot-svn-files,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
[15124]883 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.">
884
885 <!-- make sure .sh files are executable -->
886 <chmod dir="${basedir}" perm="ugo+rx"
887 includes="*.sh"/>
888 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
889 includes="*.sh,*.pl"/>
890 </target>
[16936]891
[19871]892 <!-- 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]893 <!--before configuring build-src, make sure that gnome-lib is compiled up-->
[28611]894 <target name="install" depends="init,compile-imagemagick,compile-gnome-lib,install-common-src,install-collection-building,install-runtime,install-solr-ext,setup-for-eclipse,get-isisgdl"
[19843]895 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
896
[19931]897 <target name="install-common-src" depends="init"
898 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
[30788]899 <antcall target="configure-common-src">
900 <param name="set.ld.path" value="true"/>
901 </antcall>
902 <antcall target="compile-common-src">
903 <param name="set.ld.path" value="true"/>
904 </antcall>
[19894]905 <antcall target="install-auxiliary-jar-files"/>
906 <antcall target="install-jni-files"/>
907 </target>
[19878]908
[19894]909 <target name="install-collection-building" depends="init" if="collection.building.enabled"
910 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
911 <antcall target="configure-collection-building"/>
[19931]912 <antcall target="tweak-makefiles" />
[19894]913 <antcall target="compile-collection-building"/>
914 </target>
915
[19878]916
[20209]917 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
[19878]918 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
919
920 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
[15124]921 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
922
923 <target name="configure" depends="init,configure-tomcat,configure-web"
[23855]924 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]925
[20209]926 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
[19878]927 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
[15124]928
[20209]929 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
[19878]930 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
[15799]931
[19878]932 <target name="update" depends="init,svnupdate,clean,install"
933 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]934
[23854]935
936 <target name="perl-for-building" depends="init">
937 <!-- uses perl.path if set in build.properties, otherwise try for
938 environment variable PERLPATH, and failing that assumes 'perl'
939 is on environment PATH -->
[23856]940 <!-- 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]941 <if><bool><available file="${gs2build.home}"/></bool>
[23854]942
943 <if><bool><not><isset property="perl.path"/></not></bool>
944
945 <if>
946 <bool>
947 <and>
948 <isset property="env.PERLPATH"/>
949 <not><equals arg1="${env.PERLPATH}" arg2=""/></not>
950 </and>
951 </bool>
[27859]952 <!-- set perlpath to env.PERLPATH.
953 This is the path to perl\bin that's found by findperl.bat when the server is launched
954 through GLI instead of the console.
955 For windows, this env.PERLPATH is the bin folder and needs a backslash at end, since it
956 will appear suffixed with "perl.exe" in the perl setting in packages\tomcat\config\web.xml.
957 This web.xml's path to perl is then used to find perl when running the perl scripts in the
958 cgi folder, so without a slash appended at this point it becomes "binperl" in web.xml, and
959 things will break when GLI launches the server on Windows and the online GS3 metadata editor
960 is used to save user-edited metadata. -->
961 <if><bool><istrue value="${current.os.iswindows}"/></bool>
962 <property name="perl.path" value="${env.PERLPATH}\"/>
963 <else>
964 <property name="perl.path" value="${env.PERLPATH}"/>
965 </else>
966 </if>
967
[23854]968 <else>
969 <echo>
[23896]970 Using PATH environment variable to locate Perl.
[23854]971 </echo>
972 <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
973 <arg value="perl" />
974 </exec>
975
[28044]976 <exec executable="${gs2build.home}/bin/windows/which" osfamily="windows" spawn="false" outputproperty="full.perl.path">
[23941]977 <arg value="perl" />
978 </exec>
[23896]979
[25640]980 <stringutil string="${full.perl.path}" property="partial.perl.path">
981 <replace regex="\/[^\/]*$" replacement="/" />
[23854]982 </stringutil>
[27484]983 <stringutil string="${partial.perl.path}" property="perl.path">
[25640]984 <replace regex="\\[^\\]*$" replacement="\\" />
985 </stringutil>
[23896]986 <if><bool><istrue value="${current.os.isunix}"/></bool>
987 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
988 <echo>
[23854]989 Non-standard location of Perl found: ${full.perl.path}
990 Set the environment variable PERLPATH or the perl.path property in
[27484]991 build.properties to explicitly control the version of Perl used.
[23896]992 </echo>
993 </if>
[23854]994 </if>
995 </else>
996 </if>
997 </if>
998
999 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
1000 <if><bool><isset property="perl.path"/></bool>
1001 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
1002 <else>
1003 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
1004 </else>
1005 </if>
[23857]1006
1007 <!-- gs2build not available, perl.path -->
1008 <else>
1009 <property name="perl.path" value=""/>
1010 </else>
1011 </if>
[27484]1012 <stringutil string="${perl.path}" property="escaped.perl.path">
1013 <replace regex="\\" replacement="\\\\" />
1014 </stringutil>
[23854]1015 </target>
1016
[25549]1017 <target name="get-default-servlet-url">
[32334]1018 <echo>${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}${server.default.servlet}</echo>
[31489]1019 </target>
[29988]1020
[31489]1021 <target name="get-solr-servlet-url">
[32334]1022 <echo>${server.protocol}://${tomcat.server}:${internal.tomcat.port}/${solr.context}</echo>
[31489]1023 </target>
1024
[29988]1025 <target name="check-derbyserver-running">
1026 <condition property="derby.isrunning" value="true" else="false">
1027 <!--<socket server="jdbc:derby://${derby.server}" port="${derby.server.port}"/>-->
1028 <socket server="${derby.server}" port="${derby.server.port}"/><!-- like telnet machine port -->
1029 </condition>
1030 <echo>Derby is running: ${derby.isrunning}</echo>
[29903]1031 </target>
[29988]1032
[30013]1033 <!-- Need a copy of the check-derby-running target with a distinct property, because ant restart runs
1034 both stop and start, which stop and start derby respectively. Both need check the derby socket.
1035 Because each property can be set only once during an invocation with ant, ant restart will need
1036 two check-derbyserver properties, one for each derby check. -->
1037 <target name="check-derbyserver-started">
1038 <condition property="derby.isstarted" value="true" else="false">
1039 <socket server="${derby.server}" port="${derby.server.port}"/>
1040 </condition>
1041 <echo>Derby is running: ${derby.isstarted}</echo>
1042 </target>
1043
1044
1045 <!-- Unused -->
[29988]1046 <target name="start-derby-java" depends="check-derbyserver-running">
1047 <if><bool><not><istrue value="${derby.isrunning}"/></not></bool>
1048 <echo>Launching derby on ${derby.server}:${derby.server.port}...</echo>
1049 <java classname="org.apache.derby.drda.NetworkServerControl" fork="true" spawn="true" clonevm="true">
1050 <arg value="start"/>
1051 <classpath refid="derby.server.classpath"/>
1052 </java>
1053 <else>
1054 <echo>Derby server ALREADY RUNNING on ${derby.server}:${derby.server.port}</echo>
1055 </else>
1056 </if>
1057 </target>
[29903]1058
[30013]1059 <target name="start-derby" depends="check-derbyserver-started">
1060 <if><bool><not><istrue value="${derby.isstarted}"/></not></bool>
1061 <echo>About to launch derby on ${derby.server}:${derby.server.port}</echo>
1062 <antcall target="force-start-derby"/>
1063 <else>
1064 <echo>Derby networked server ALREADY RUNNING on ${derby.server}:${derby.server.port}</echo>
1065 </else>
1066 </if>
1067 </target>
1068
[29903]1069 <!-- Using derby 10.1.2.1
1070 See db-derby-10.1.2.1-bin/docs/html/adminguide/index.html -->
[30013]1071 <target name="force-start-derby">
[29988]1072 <property name="derby.server.classpath.prop" refid="derby.server.classpath" />
1073
1074 <exec executable="java" spawn="true"><!-- failonerror="true"-->
1075 <env key="CLASSPATH" path="${derby.server.classpath.prop}"/>
1076 <arg value="org.apache.derby.drda.NetworkServerControl"/>
1077 <arg value="start"/>
1078 <arg value="-p"/>
1079 <arg value="${derby.server.port}"/>
1080 </exec>
[30013]1081
[29903]1082 </target>
1083
[29988]1084 <target name="force-stop-derby">
[29903]1085 <java classname="org.apache.derby.drda.NetworkServerControl">
1086 <arg value="shutdown"/>
[30170]1087 <arg value="-p"/>
1088 <arg value="${derby.server.port}"/>
[29903]1089 <classpath refid="derby.server.classpath"/>
1090 </java>
1091 </target>
1092
[29988]1093 <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 -->
1094 <if><bool><istrue value="${derby.isrunning}"/></bool>
1095 <!--<echo>Derby is |${derby.isrunning}| running</echo>-->
1096 <antcall target="force-stop-derby"/>
1097 <else>
1098 <echo>Derby is not running</echo>
1099 </else>
1100 </if>
1101 </target>
1102
[31121]1103 <target name="start" depends="needs-gs3-setup,init,configure-tomcat,configure-web,configure-solr-ext,start-derby,start-tomcat"
[15124]1104 description="Startup the Tomcat server." >
[15799]1105 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
[16936]1106 <echo>Tomcat: ${catalina.home}</echo>
1107 <echo>Java : ${java.home}</echo>
[23849]1108 <if><bool><available file="${build.src.home}"/></bool>
1109 <echo>Perl : ${full.perl.path}</echo>
1110 </if>
[23936]1111 <if><bool><isset property="install.flax"/></bool>
[32334]1112 <property name="url" value="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}/flax"/>
[23936]1113 <else>
[32334]1114 <property name="url" value="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}/"/>
[23936]1115 </else>
1116 </if>
1117 <echo>URL : ${url}</echo>
[15799]1118 <!-- assuming that index.html is not needed here -->
[26033]1119
1120 <!--Now write out the url with oaiserver suffix as the baseURL property in OAIConfig.xml-->
[32310]1121 <available file="${basedir}/resources/oai/OAIConfig.xml.in" property="oaiconfig.present"/>
[26033]1122 <antcall target="init-oaiconfig">
1123 <param name="url" value="${url}"/>
1124 </antcall>
[15124]1125 </target>
1126
[26033]1127 <target name="init-oaiconfig" if="oaiconfig.present">
[27829]1128 <echo>Writing out baseURL ${url}oaiserver to ${web.writableclasses}/OAIConfig.xml</echo>
[32310]1129 <copy file="${basedir}/resources/oai/OAIConfig.xml.in" tofile="${web.writableclasses}/OAIConfig.xml"/>
[28136]1130 <rsr verbosity="1" file="${web.writableclasses}/OAIConfig.xml" pattern="&lt;baseURL&gt;.*&lt;/baseURL&gt;" replacement="&lt;baseURL&gt;${url}oaiserver&lt;/baseURL&gt;" />
[26033]1131 </target>
1132
[29903]1133 <target name="stop" depends="init,stop-tomcat,stop-derby"
[15124]1134 description="Shutdown the Tomcat server."/>
1135
1136 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
1137
[15799]1138 <!-- =========== Help targets =================================== -->
[15124]1139
1140 <property name="install-command" value="ant [options] prepare install"/>
1141
1142 <target name="usage" description="Print a help message">
1143 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
1144 <echo message=" Execute 'ant -help' for Ant help."/>
[23849]1145 <echo>
1146 To install Greenstone3, run '${install-command}'.
1147 There are properties defined in build.properties. The install
1148 process will ask you if these properties are set correctly.
1149 To avoid this prompt, use the '-Dproperties.accepted=yes'
1150 option.
1151 To log the output, use the '-logfile build.log' option.
1152 The README.txt file has more information about the ant targets
1153 and install process.
[15124]1154 </echo>
1155 </target>
1156
1157 <target name="help" depends="usage" description="Print a help message"/>
1158
1159 <target name="debug" depends="init" description="Display all the currently used properties">
1160 <echoproperties/>
1161 </target>
1162
[15799]1163 <!-- ====== initialization and setup targets ================== -->
[15124]1164
1165 <target name="accept-properties" unless="properties.accepted">
1166 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
[32334]1167 server.protocol=${server.protocol}
[15799]1168 tomcat.server=${tomcat.server}
[32334]1169 <!--tomcat.port=${internal.tomcat.port}-->
[32337]1170 tomcat.port.http=${tomcat.port.http}
1171 tomcat.port.https=${tomcat.port.https}
[15799]1172 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
1173 proxy.host=${proxy.host}
1174 proxy.port=${proxy.port}
[19878]1175 disable.collection.building=${disable.collection.building}
[19910]1176 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
[15124]1177 </input>
1178 <condition property="do.abort">
1179 <equals arg1="n" arg2="${properties.ok}"/>
1180 </condition>
1181 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
1182 </target>
[32334]1183
[15124]1184 <!-- this sets up some initial properties -->
1185 <target name="init">
[20085]1186
[15124]1187 <condition property="java.too.old">
1188 <or>
[16936]1189 <equals arg1="1.1" arg2="${ant.java.version}"/>
1190 <equals arg1="1.2" arg2="${ant.java.version}"/>
1191 <equals arg1="1.3" arg2="${ant.java.version}"/>
[15124]1192 </or>
1193 </condition>
[20208]1194 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
[15124]1195
1196 <available file="${basedir}/gli" property="gli.present"/>
[19878]1197 <available file="${basedir}/common-src" property="common.src.present"/>
[15124]1198 <available file="${basedir}/gs2build" property="gs2build.present"/>
[28643]1199 <available file="${gnome-lib-dir}" property="gnome-lib.present"/>
[15124]1200
1201 <condition property="tomcat.islocal">
1202 <or>
[16936]1203 <not><isset property="tomcat.installed.path"/></not>
1204 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]1205 </or>
1206 </condition>
1207
[32334]1208 <echo>internal.tomcat.port = ${internal.tomcat.port}</echo>
[15124]1209
1210 <condition property="proxy.present">
1211 <and>
[16936]1212 <isset property="proxy.host"/>
1213 <not><equals arg1="" arg2="${proxy.host}"/></not>
[15124]1214 </and>
1215 </condition>
1216
[20235]1217 <!--
[20290]1218 the next block checks if the bundled tomcat is present in the 'packages' directory,
[25131]1219 and checks for the lethal combination of tomcat 7 and java 1.4. Test for
[20290]1220 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
1221 download, as there is no other surefire way to check tomcat version under java 1.4
[20235]1222 -->
1223 <condition property="packages.tomcat.ispresent" value="true" else="false">
1224 <available file="packages/tomcat"/>
1225 </condition>
[25131]1226 <condition property="packages.tomcat.istomcat7" value="true" else="false">
1227 <available file="packages/tomcat/tomcat7.txt"/>
[20290]1228 </condition>
[20235]1229 <if>
1230 <bool>
[20290]1231 <and>
1232 <istrue value="${packages.tomcat.ispresent}"/>
[25131]1233 <istrue value="${packages.tomcat.istomcat7}"/>
[20290]1234 <equals arg1="1.4" arg2="${ant.java.version}"/>
1235 </and>
[20235]1236 </bool>
[20290]1237 <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]1238 </if>
1239
[15124]1240 </target>
1241
1242 <target name="setup-proxy" depends="init" if="proxy.present">
1243 <condition property="ask.user">
1244 <or>
[16936]1245 <equals arg1="" arg2="${proxy.user}"/>
1246 <equals arg1="" arg2="${proxy.password}"/>
[15124]1247 </or>
1248 </condition>
[19878]1249
[15124]1250 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
1251 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
1252 </target>
[32310]1253
1254 <target name="copy-dot-svn-files" depends="init"
[32312]1255 description="Copies all resources .svn files to .in versions - which are used during configure to generate the runtime versions." >
[32310]1256 <if><bool><available file="${basedir}/resources/tomcat/greenstone3.xml.in"/></bool>
1257 <copy file="${basedir}/resources/tomcat/greenstone3.xml.in" tofile="${basedir}/resources/tomcat/greenstone3.xml.in.backup" overwrite="true"/>
[28904]1258 </if>
1259
[32310]1260 <copy file="${basedir}/resources/tomcat/greenstone3.xml.svn" tofile="${basedir}/resources/tomcat/greenstone3.xml.in" overwrite="true"/>
1261 <if><bool><available file="${basedir}/resources/tomcat/server_tomcat5.xml.in"/></bool>
1262 <copy file="${basedir}/resources/tomcat/server_tomcat5.xml.in" tofile="${basedir}/resources/tomcat/server_tomcat5.xml.in.backup" overwrite="true"/>
[28904]1263 </if>
[32310]1264 <copy file="${basedir}/resources/tomcat/server_tomcat5.xml.svn" tofile="${basedir}/resources/tomcat/server_tomcat5.xml.in" overwrite="true"/>
1265 <if><bool><available file="${basedir}/resources/tomcat/server_tomcat7.xml.in"/></bool>
1266 <copy file="${basedir}/resources/tomcat/server_tomcat7.xml.in" tofile="${basedir}/resources/tomcat/server_tomcat7.xml.in.backup" overwrite="true"/>
[28904]1267 </if>
[32310]1268 <copy file="${basedir}/resources/tomcat/server_tomcat7.xml.svn" tofile="${basedir}/resources/tomcat/server_tomcat7.xml.in" overwrite="true"/>
1269 <if><bool><available file="${basedir}/resources/tomcat/web.xml.in"/></bool>
1270 <copy file="${basedir}/resources/tomcat/web.xml.in" tofile="${basedir}/resources/tomcat/web.xml.in.backup" overwrite="true"/>
[28904]1271 </if>
[32310]1272 <copy file="${basedir}/resources/tomcat/web.xml.svn" tofile="${basedir}/resources/tomcat/web.xml.in" overwrite="true"/>
1273 <if><bool><available file="${basedir}/resources/oai/OAIConfig.xml.in"/></bool>
1274 <copy file="${basedir}/resources/oai/OAIConfig.xml.in" tofile="${basedir}/resources/oai/OAIConfig.xml.in.backup" overwrite="true"/>
[28904]1275 </if>
[32310]1276 <copy file="${basedir}/resources/oai/OAIConfig.xml.svn" tofile="${basedir}/resources/oai/OAIConfig.xml.in" overwrite="true"/>
1277 <if><bool><available file="${basedir}/resources/cgi/gsdl3site.cfg.in"/></bool>
1278 <copy file="${basedir}/resources/cgi/gsdl3site.cfg.in" tofile="${basedir}/resources/cgi/gsdl3site.cfg.in.backup" overwrite="true"/>
[28907]1279 </if>
[32310]1280 <copy file="${basedir}/resources/cgi/gsdl3site.cfg.svn" tofile="${basedir}/resources/cgi/gsdl3site.cfg.in" overwrite="true"/>
1281 <if><bool><available file="${basedir}/resources/web/global.properties.in"/></bool>
1282 <copy file="${basedir}/resources/web/global.properties.in" tofile="${basedir}/resources/web/global.properties.in.backup" overwrite="true"/>
[28908]1283 </if>
[32310]1284 <copy file="${basedir}/resources/web/global.properties.svn" tofile="${basedir}/resources/web/global.properties.in" overwrite="true"/>
1285 <if><bool><available file="${basedir}/resources/web/log4j.properties.in"/></bool>
1286 <copy file="${basedir}/resources/web/log4j.properties.in" tofile="${basedir}/resources/web/log4j.properties.in.backup" overwrite="true"/>
[28908]1287 </if>
[32310]1288 <copy file="${basedir}/resources/web/log4j.properties.svn" tofile="${basedir}/resources/web/log4j.properties.in" overwrite="true"/>
[28904]1289 </target>
[32310]1290
[15799]1291 <!-- ========== Web app Targets ================================ -->
1292
[20089]1293 <target name="prepare-web" depends="init">
[27829]1294 <mkdir dir="${web.writablehome}/applet"/>
1295 <mkdir dir="${web.writablehome}/logs"/>
1296 <mkdir dir="${web.writablehome}/logs/tmp"/>
[15124]1297 </target>
1298
[24607]1299 <!-- 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.
1300 The test for whether we need it assumes we won't be trying to compile GS3 against Java versions less than 1.4. -->
[15124]1301 <target name="configure-java-version" depends="init"
[15139]1302 description="Activates or deactivates some jar libraries as needed depending on your java version">
[15136]1303
[15799]1304 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
[15124]1305 <condition property="need.xalan.jar">
[15799]1306 <or>
[24607]1307 <not><equals arg1="1.4" arg2="${ant.java.version}"/></not>
[15799]1308 </or>
1309 </condition>
[15136]1310
[15799]1311 <!-- if they have xalan.jar but dont need it -->
1312 <if>
1313 <bool>
[16936]1314 <and>
1315 <isset property="have.xalan.jar"/>
1316 <not><isset property="need.xalan.jar"/></not>
1317 </and>
[15799]1318 </bool>
1319 <antcall target="deactivate-xalan-jar"/>
1320 </if>
[15136]1321
[15799]1322 <!-- if they need xalan.jar but dont have it -->
1323 <if>
1324 <bool>
[16936]1325 <and>
1326 <not><isset property="have.xalan.jar"/></not>
1327 <isset property="need.xalan.jar"/>
1328 </and>
[15799]1329 </bool>
1330 <antcall target="activate-xalan-jar"/>
1331 </if>
[15136]1332
[15124]1333 </target>
1334
[15139]1335 <target name="activate-xalan-jar">
[15799]1336 <echo>activating xalan.jar</echo>
[15124]1337 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
[20085]1338 <if>
1339 <bool>
1340 <and>
1341 <isset property="current.os.ismac"/>
1342 <available file="${catalina.home}/common/endorsed" type="dir"/>
1343 </and>
1344 </bool>
1345 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
[15799]1346 </if>
[15124]1347 </target>
[15035]1348
[15139]1349 <target name="deactivate-xalan-jar">
[15799]1350 <echo>deactivating xalan.jar</echo>
[15124]1351 <delete file="${web.lib}/xalan.jar"/>
[20089]1352 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
[15124]1353 </target>
1354
[15837]1355
[25491]1356 <target name="prepare-collections" depends="init"
1357 description="Unpack all the collections from their svn zipped versions">
[16936]1358 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
[17008]1359 <property name="index.zip" value="index.zip"/>
[15799]1360
[16936]1361 <echo message="installing collections..."/>
1362 <antcall target="gs2mgdemo-install"/>
1363 <antcall target="gs2mgppdemo-install"/>
1364 <antcall target="gberg-install"/>
[25214]1365 <antcall target="lucene-jdbm-demo-install"/>
[16936]1366 </target>
[15837]1367
[16936]1368 <target name="gs2mgdemo-prepare" if="collect.dir">
1369 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
[15799]1370
[16936]1371 <condition property="gs2mgdemo.present">
1372 <and>
[15837]1373 <available file="${gs2mgdemo.dir}/${index.zip}"/>
[16936]1374 </and>
1375 </condition>
1376 </target>
[15799]1377
[17008]1378 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
1379 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
[16936]1380 <echo>collection gs2mgdemo installed</echo>
1381 </target>
[15799]1382
[16936]1383 <target name="gs2mgppdemo-prepare" if="collect.dir">
1384 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
[15837]1385
[16936]1386 <condition property="gs2mgppdemo.present">
1387 <and>
[15837]1388 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
[16936]1389 </and>
1390 </condition>
1391 </target>
[15799]1392
[16936]1393 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
[17008]1394 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
[16936]1395 <echo>collection gs2mgppdemo installed</echo>
1396 </target>
[15799]1397
[16936]1398 <target name="gberg-prepare" if="collect.dir">
1399 <property name="gberg.dir" value="${collect.dir}/gberg"/>
[17008]1400 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
[16936]1401 </target>
[15799]1402
[16936]1403 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
[19878]1404 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
[16936]1405 <echo>collection gberg installed</echo>
1406 </target>
[15799]1407
[25214]1408 <target name="lucene-jdbm-demo-prepare" if="collect.dir">
1409 <property name="lucene-jdbm-demo.dir" value="${collect.dir}/lucene-jdbm-demo"/>
[25491]1410 <available file="${lucene-jdbm-demo.dir}/${index.zip}" property="lucene-jdbm-demo.present"/>
[25214]1411 </target>
1412
1413 <target name="lucene-jdbm-demo-install" if="lucene-jdbm-demo.present" depends="lucene-jdbm-demo-prepare">
[25491]1414 <unzip dest="${lucene-jdbm-demo.dir}" src="${lucene-jdbm-demo.dir}/${index.zip}"/>
[25214]1415 <echo>collection lucene-jdbm-demo installed</echo>
1416 </target>
1417
[27846]1418
[28115]1419 <target name="install-solr-ext" depends="init" >
[28044]1420 <exec executable="ant.bat" osfamily="windows" dir="${solr-ext.home}" spawn="false">
[27846]1421 <arg value="add-service"/>
1422 </exec>
[27849]1423 <exec executable="ant" os="${os.unix}" dir="${solr-ext.home}" spawn="false">
1424 <arg value="add-service"/>
1425 </exec>
[27846]1426 <antcall target="solr-jdbm-demo-install"/>
1427 </target>
1428
1429 <target name="solr-jdbm-demo-prepare" if="collect.dir">
1430 <property name="solr-jdbm-demo.dir" value="${collect.dir}/solr-jdbm-demo"/>
1431 <available file="${solr-jdbm-demo.dir}/${index.zip}" property="solr-jdbm-demo.present"/>
1432 </target>
1433
1434 <target name="solr-jdbm-demo-install" if="solr-jdbm-demo.present" depends="solr-jdbm-demo-prepare">
1435 <unzip dest="${solr-jdbm-demo.dir}" src="${solr-jdbm-demo.dir}/${index.zip}"/>
1436 <echo>collection solr-jdbm-demo installed</echo>
1437 </target>
1438
[28612]1439 <!-- Until 64 bit Linux and Mac (Lion) machines can generate a working IsisGdl,
1440 use the ones generated on a 32 bit Linux and Mac (Leopard), respectively -->
[28952]1441 <target name="get-isisgdl" if="${current.os.isunix}">
[28613]1442 <exec executable="uname" dir="${basedir}" failonerror="false"
[28612]1443 outputproperty="uname.val">
1444 <arg value="-m"/>
1445 </exec>
1446
1447 <if><bool><equals arg1="${uname.val}" arg2="x86_64"/></bool>
1448 <echo>Bitness: ${uname.val}</echo>
1449 <if><bool><contains string="${os.bin.dir}" substring="darwin" casesensitive="false"/></bool>
1450 <get src="http://www.greenstone.org/caveat-emptor/IsisGdl.macleopard"
1451 dest="${basedir}/gs2build/bin/${os.bin.dir}/IsisGdl"/>
1452 </if>
1453 <if><bool><contains string="${os.bin.dir}" substring="linux" casesensitive="false"/></bool>
1454 <get src="http://www.greenstone.org/caveat-emptor/IsisGdl.bin32"
1455 dest="${basedir}/gs2build/bin/${os.bin.dir}/IsisGdl"/>
1456 </if>
[28611]1457 <chmod file="${basedir}/gs2build/bin/${os.bin.dir}/IsisGdl" perm="755"/>
1458 </if>
1459 </target>
[27846]1460
[27484]1461 <target name="set-perl-shebangs" depends="perl-for-building">
1462 <if>
1463 <bool>
1464 <and><isset property="perl.path"/>
1465 <not><equals arg1="${perl.path}" arg2=""/></not>
1466 </and>
1467 </bool>
1468
1469 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[27486]1470 <property name="perl.exec" value="${perl.path}perl.exe"/>
[27484]1471 <else>
[27486]1472 <property name="perl.exec" value="${perl.path}perl"/>
[27484]1473 </else>
1474 </if>
1475
1476 <!--<echo>**** PERLPATH: ${perl.path}</echo>-->
[28158]1477 <echo>Setting perl shebangs to Perl Exec: ${perl.exec}</echo>
[27484]1478
1479 <!-- set the shebangs in the cgi files to point to the correct perlpath -->
[27829]1480 <if>
1481 <bool><not><equals arg1="${web.home}" arg2="${web.writablehome}"></equals></not></bool>
1482 <mkdir dir="${web.writablehome}"/>
[30568]1483 <copy file="${full.web.dir}/WEB-INF/cgi/gliserver.pl" tofile="${web.writablehome}/WEB-INF/cgi/gliserver.pl" overwrite="true"/>
1484 <copy file="${full.web.dir}/WEB-INF/cgi/metadata-server.pl" tofile="${web.writablehome}/WEB-INF/cgi/metadata-server.pl" overwrite="true"/>
1485 <copy file="${full.web.dir}/WEB-INF/cgi/checksum.pl" tofile="${web.writablehome}/WEB-INF/cgi/checksum.pl" overwrite="true"/>
[27829]1486 </if>
1487
[28136]1488 <rsr verbosity="1" file="${web.writablehome}/WEB-INF/cgi/gliserver.pl" pattern="^#!.*" replacement="#!${perl.exec} -w" lines="1"/>
1489 <rsr verbosity="1" file="${web.writablehome}/WEB-INF/cgi/metadata-server.pl" pattern="^#!.*" replacement="#!${perl.exec} -w" lines="1"/>
1490 <rsr verbosity="1" file="${web.writablehome}/WEB-INF/cgi/checksum.pl" pattern="^#!.*" replacement="#!${perl.exec} -w" lines="1"/>
[27484]1491 <else>
[27829]1492 <echo>WARNING: perl.path is empty. Unable to set the shebangs in the perl files in ${web.writablehome}/WEB-INF/cgi</echo>
[27484]1493 </else>
1494 </if>
1495 </target>
1496
[32338]1497 <target name="configure-web" depends="init,perl-for-building"
[15124]1498 description="Configure only the web app config files">
1499 <!-- we want a unix path in the global.properties file -->
1500 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
1501 <path path="${web.home}"/>
1502 </pathconvert>
[27829]1503 <pathconvert targetos="unix" property="src.gsdl3.writablehome.unix">
1504 <path path="${web.writablehome}"/>
1505 </pathconvert>
[27484]1506
1507 <antcall target="set-perl-shebangs" inheritAll="true" />
[32344]1508
[25830]1509 <filter token="gsdlhome" value="${gs2build.home}"/>
[30614]1510 <filter token="gsdlhomequoted" value="&quot;${gs2build.home}&quot;"/>
[25830]1511 <filter token="gsdl3srchome" value="${basedir}"/>
[30614]1512 <filter token="gsdl3srchomequoted" value="&quot;${basedir}&quot;"/>
[15124]1513 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
[30614]1514 <filter token="gsdl3homequoted" value="&quot;${src.gsdl3.home.unix}&quot;"/>
[27829]1515 <filter token="gsdl3writablehome" value="${src.gsdl3.writablehome.unix}"/>
[15124]1516 <filter token="gsdl3version" value="${app.version}"/>
[32334]1517 <filter token="server.protocol" value="${server.protocol}"/>
[15124]1518 <filter token="tomcat.server" value="${tomcat.server}"/>
[32334]1519 <filter token="tomcat.port" value="${internal.tomcat.port}"/>
[32344]1520 <!-- add filters for tomcat.port.http and tomcat.port.https depending on if
1521 these are set. If any is not set, set its filter to the empty string -->
1522 <if>
1523 <bool><isset property="tomcat.port.http"/></bool>
1524 <filter token="tomcat.port.http" value="${tomcat.port.http}"/>
1525 <else><filter token="tomcat.port.http" value=""/></else>
1526 </if>
1527 <if>
1528 <bool><isset property="tomcat.port.https"/></bool>
1529 <filter token="tomcat.port.https" value="${tomcat.port.https}"/>
1530 <else><filter token="tomcat.port.https" value=""/></else>
1531 </if>
[30673]1532 <filter token="greenstone.context" value="${greenstone.context}"/>
[32379]1533 <filter token="solr.context" value="${solr.context}"/>
[29977]1534 <filter token="derbyserver" value="${derby.server}"/>
[29903]1535 <filter token="derbyserver.port" value="${derby.server.port}"/>
[24868]1536 <filter token="perlpath" value="${escaped.perl.path}"/>
[27484]1537 <filter token="disable.collection.building" value="${disable.collection.building}"/>
[32310]1538 <copy file="${basedir}/resources/cgi/gsdl3site.cfg.in" tofile="${web.writablehome}/WEB-INF/cgi/gsdl3site.cfg" filtering="true" overwrite="true"/>
1539 <copy file="${basedir}/resources/web/global.properties.in" tofile="${web.writableclasses}/global.properties" filtering="true" overwrite="true"/>
1540 <copy file="${basedir}/resources/web/log4j.properties.in" tofile="${web.writableclasses}/log4j.properties" filtering="true" overwrite="true"/>
[27829]1541 <if><bool><istrue value="${gsdl3home.isreadonly}"/></bool>
1542 <!-- uncomment the writablehome properties -->
[28136]1543 <rsr verbosity="1" file="${web.writableclasses}/global.properties" pattern="^#gsdl3\.(writable{1})?home" replacement="gsdl3.$1home" />
[27829]1544 </if>
1545 <chmod file="${web.writableclasses}/global.properties" perm="644"/>
1546 <chmod file="${web.writableclasses}/log4j.properties" perm="644"/>
[15124]1547 </target>
1548
1549 <target name="compile-web" depends="init">
1550 <javac srcdir="${web.classes}"
1551 destdir="${web.classes}"
[28137]1552 includeantruntime="${compile.includeantruntime}"
[15124]1553 debug="${compile.debug}"
1554 deprecation="${compile.deprecation}"
[29515]1555 optimize="${compile.optimize}"
1556 encoding="${compile.encoding}">
[16936]1557 <classpath><path refid="compile.classpath"/></classpath>
[15124]1558 </javac>
1559 </target>
1560
[20209]1561 <target name="compile-classpath-jars" depends="init">
1562 <if><bool><available file="admin/cp.mf"/></bool>
1563 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
1564 </if>
1565 <if><bool><available file="${lib.java}/cp.mf"/></bool>
1566 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
1567 </if>
1568 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
1569 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
1570 </if>
1571 <if><bool><available file="${web.lib}/cp.mf"/></bool>
1572 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
1573 </if>
1574 <jar destfile="cp.jar">
1575 <manifest>
[20211]1576 <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]1577 </manifest>
1578 </jar>
1579 </target>
1580
1581 <target name="clean-classpath-jars" depends="init">
1582 <delete file="admin/cp.jar"/>
1583 <delete file="${lib.java}/cp.jar"/>
1584 <delete file="${lib.jni}/cp.jar"/>
1585 <delete file="${web.lib}/cp.jar"/>
1586 <delete file="cp.jar"/>
1587 </target>
1588
1589
[15799]1590 <target name="svnupdate-web" unless="nosvn.mode">
[20930]1591 <exec executable="svn">
1592 <arg value="update"/>
[27829]1593 <arg value="${web.writablehome}"/>
[20930]1594 <arg value="-r"/><arg value="${branch.revision}"/>
1595 </exec>
[15799]1596 </target>
[15124]1597
1598 <target name="update-web" depends="init,svnupdate-web,configure-web"
1599 description="update only the web stuff (config files)"/>
1600
[32349]1601 <!-- ============ Targets concerned with https certification ================ -->
[32350]1602 <!-- Revoke the certificate and remove it, including folders.
1603 See https://certbot.eff.org/docs/using.html#revoking-certificates
1604 which also states "if a certificate is a test certificate obtained via the
1605 ==staging or ==test-cert flag, that flag must be passed to the revoke subcommand."
1606 -->
[32349]1607 <target name="remove-cert-https">
1608 <echo>
1609 NOTE: You need to have sudo permissions to execute this target.
1610 Enter the sudo password if prompted.
1611 </echo>
[32350]1612 <!--
1613 It says at https://github.com/certbot/certbot/issues/1741
1614 "you shouldn't run letsencrypt-auto [now called certbot-auto] as superuser,
1615 because the program will invoke sudo when it needs to automatically."
1616 We need to send Y(es) as inputstring to confirm that the
1617 /etc/letsencrypt/live/${tomcat.server} folder can be deleted
[32349]1618 -->
1619 <exec executable="./certbot-auto" dir="${basedir}/bin/${os.bin.dir}" failonerror="true" inputstring="Y">
[32350]1620 <arg value="revoke"/>
[32381]1621 <arg line="${https.testing}"/>
[32350]1622 <arg value="--cert-path"/><arg value="/etc/letsencrypt/live/${tomcat.server}/cert.pem"/>
[32349]1623 </exec>
[32350]1624 <!-- The above command already deletes the folder when Y(es) was passed in. Explicitly deleting:
1625 <exec executable="./certbot-auto" dir="${basedir}/bin/${os.bin.dir}" failonerror="true">
1626 <arg value="delete"/>
1627 <arg value="==cert-name"/><arg value="${tomcat.server}"/>
1628 </exec>
1629 -->
1630 <!-- And remove the https_cert folder -->
[32349]1631 <delete dir="${packages.home}/tomcat/conf/https_cert"/>
1632 </target>
1633
1634 <target name="setup-cert-https-info">
1635 <echo>
1636 *********************************************************************
1637 NOTE TO OBTAINING A TLS (SSL) CERTIFICATE FOR HTTPS
1638 *********************************************************************
1639 A certificate is needed for your GS server to serve pages over https.
1640 This target will attempt to obtain a certificate for you from the official and free Certificate Authority Let's Encrypt.
1641 However, a certificate can only be obtained if you have sudo permissions on this machine that you're installing Greenstone on.
1642
1643 Note that:
1644 * if you already have a certificate, then you probably don't want to be running this target but the 'ant renew-cert-https' target instead, to renew your existing certificate.
1645 * 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.
1646 </echo>
1647 </target>
1648
1649 <target name="https-conditions-set">
1650 <input addproperty="https.conditions.ok" validargs="y,n">
1651 To run this target, ensure you have:
1652 * sudo permissions
1653 * nothing running on port 80 when you run this target
1654 * edited the build.properties file with
1655 - tomcat.server set to the/a domain name of your server
1656 - server.protocol set to "https"
1657 - tomcat.port.https set to a valid port number
1658 - keystore.pass set to a password for the certification process
1659 * read the Let's Encrypt Subscriber Agreement at https://letsencrypt.org/repository/
1660 If any of the above is not possible, quit this target. Continue [y/n]?
1661 </input>
1662
1663 <condition property="quit.https.setup">
1664 <equals arg1="n" arg2="${https.conditions.ok}"/>
1665 </condition>
1666
1667 <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>
1668 </target>
1669
1670 <target name="setup-cert-https" depends="setup-cert-https-info,https-conditions-set">
1671 <input addproperty="https.cert.email">Enter an email that Let's Encrypt, the certification authority, can send any important notifications to</input>
1672 <input addproperty="https.other.domains">Besides tomcat.server=${tomcat.server}, you may enter a comma separated list of additional domains to support if any</input>
1673 <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>
1674 <if>
1675 <bool><equals arg1="y" arg2="${https.cert.agree}"/></bool>
1676
1677 <condition property="https.cert.domains" value="${tomcat.server},${https.other.domains}" else="${tomcat.server}">
1678 <and>
1679 <isset property="https.other.domains" />
1680 <not><matches string="${https.other.domains}" pattern="^\s*$"/></not>
1681 </and>
1682 </condition>
1683
1684 <input addproperty="https.do.cert" validargs="y,n">
1685 You've agreed to the Let's Encrypt TOS with
1686 - email: ${https.cert.email}
1687 - domains: ${https.cert.domains}
1688 Looks okay? [y/n]
1689 </input>
1690 </if>
1691
1692 <if><bool><equals arg1="n" arg2="${https.do.cert}"/></bool>
1693 <echo>Not proceeding with https certification for the Greenstone 3 web server</echo>
1694 <else>
1695 <echo>Proceeding...</echo>
[32350]1696 <!-- Running as
1697 ./certbot-auto certonly ==standalone ==preferred-challenges http ==email EMAIL -d DOMAINS
1698 expects input from stdin to accept (A) ToS and say Yes (Y) to sharing email.
1699 We can run in non-interactive mode as the user has at this stage already agreed
1700 to LetsEncrypt's Terms of Service and provided an email address.
1701 -->
[32349]1702 <exec executable="/bin/bash" dir="${basedir}/bin/${os.bin.dir}" failonerror="true">
1703 <arg value="./certbot-auto"/>
1704 <arg value="certonly"/>
[32381]1705 <arg line="${https.testing}"/><!-- https://stackoverflow.com/questions/11840284/pass-arguments-to-apache-ant-exec-task-based-on-the-variables-value -->
[32349]1706 <arg value="--standalone"/>
1707 <arg value="--non-interactive"/>
1708 <arg value="--agree-tos"/>
1709 <arg value="--preferred-challenges"/><arg value="http"/>
1710 <arg value="--email"/><arg value="${https.cert.email}"/>
1711 <arg value="--domains"/><arg value="${https.cert.domains}"/>
1712 </exec>
1713
1714 <!-- sudo openssl pkcs12 -export -out /tmp/DOMAIN_fullchain_and_key.p12 \
1715 -in /etc/letsencrypt/live/DOMAIN/fullchain.pem \
1716 -inkey /etc/letsencrypt/live/DOMAIN/privkey.pem \
1717 -name tomcat
[32350]1718 Must run as sudo because only admin has access to the pem files that admin
1719 generated in /etc/letsencrypt
[32349]1720 See https://computingforgeeks.com/tomcat-7-with-letsencrypt-ssl-certificate/
1721 but also https://community.letsencrypt.org/t/using-lets-encrypt-with-tomcat/41082
1722 which bypasses the step to generate the java keystore jks file
1723 and uses openssl to generate a pfx file instead of a p12 file
1724 -->
1725
1726 <exec executable="sudo" dir="/tmp" failonerror="true">
[32350]1727 <arg value="${basedir}/bin/${os.bin.dir}/openssl/bin/openssl"/>
1728 <arg value="pkcs12"/>
1729 <arg value="-export"/>
1730 <arg value="-out"/><arg value="/tmp/${tomcat.server}_fullchain_and_key.p12"/>
1731 <arg value="-in"/><arg value="/etc/letsencrypt/live/${tomcat.server}/fullchain.pem"/>
1732 <arg value="-inkey"/><arg value="/etc/letsencrypt/live/${tomcat.server}/privkey.pem"/>
1733 <arg value="-name"/><arg value="tomcat"/>
1734 <arg value="-password"/><arg value="pass:${keystore.pass}"/>
[32349]1735 </exec>
1736
1737 <!-- Finally, mkdir ${packages.home}/tomcat/conf/https_cert
1738 and copy the file /tmp/${tomcat.server}_fullchain_and_key.p12 into it
1739 and rename to a slightly shorter and simpler name.
1740 The file in tmp has root permissions. But copying it from tmp into
1741 the local account will give the copy local account permissions.
1742 Then sudo to remove the original copy in /tmp
1743 -->
1744 <mkdir dir="${packages.home}/tomcat/conf/https_cert"/>
1745 <!--<copy file="/tmp/${tomcat.server}_fullchain_and_key.p12" todir="${packages.home}/tomcat/conf/https_cert"/>-->
1746 <copy todir="${packages.home}/tomcat/conf/https_cert">
1747 <fileset file="/tmp/${tomcat.server}_fullchain_and_key.p12"/>
1748 <globmapper from="${tomcat.server}_fullchain_and_key.p12" to="fullchain_and_prvtkey.p12"/>
1749 </copy>
1750
1751 <exec executable="sudo" dir="/tmp" failonerror="true">
1752 <arg line="rm -f /tmp/${tomcat.server}_fullchain_and_key.p12" />
1753 </exec>
1754
1755 </else>
1756 </if>
1757
1758 </target>
1759
[15799]1760 <!-- ======================= Tomcat Targets ========================== -->
[15124]1761
1762 <!-- this target downloads and installs Tomcat -->
[25131]1763 <!-- we download tomcat (version 7 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
[20089]1764 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
[25131]1765 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">
1766 <if>
[16951]1767 <bool>
1768 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
1769 </bool>
1770
1771 <!-- check that packages dir is there -->
1772 <mkdir dir="${packages.home}"/>
1773 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
1774 dest="${packages.home}/${tomcat.version}.zip"
1775 usetimestamp="true"/>
1776 <unzip src="${packages.home}/${tomcat.version}.zip"
1777 dest="${packages.home}"/>
[30723]1778
[20085]1779 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
1780 we would need to have the tomcat compat package to work with Java 1.4-->
1781 <if>
1782 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
1783 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
1784 dest="${packages.home}/${tomcat.version}-compat.zip"
1785 usetimestamp="true"/>
1786 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
1787 dest="${packages.home}"/>
1788 </if>
1789
[16951]1790 <!-- delete any existing tomcat -->
1791 <delete dir="${packages.home}/tomcat"/>
1792 <move todir="${packages.home}/tomcat">
1793 <fileset dir="${packages.home}/${tomcat.version}"/>
1794 </move>
[30723]1795
1796 <!-- To avoid the CGI permissions error appearing continuously in the (localhost) log,
[30725]1797 need privileged=true set in the root context.xml file too, not just greenstone context file.
1798 See http://stackoverflow.com/questions/9845936/tomcat-v7-0-load-exception-marking-servlet-ssi-as-unavailable/10305471#10305471
1799 For usage of IfTask IsLessThan: http://antelope.stage.tigris.org/nonav/docs/manual/bk03ch05s02.html -->
[30723]1800 <if><bool><not><islessthan arg1="${tomcat.version.major}" arg2="7"/></not></bool>
[32315]1801 <copy file="${basedir}/resources/tomcat/root_context.xml.in" tofile="${packages.home}/tomcat/conf/context.xml" overwrite="true" />
[30723]1802 </if>
1803
1804
[25133]1805 <!--
[16951]1806 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
1807 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
1808 overwrite="true"/>
1809 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
1810 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
1811 overwrite="true"/>
[25133]1812 -->
[16951]1813 <!-- make sure we have execute permission for the .sh files -->
1814 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
1815 includes="*.sh"/>
1816
1817 <echo file="${packages.home}/tomcat/.flagfile">
1818 the timestamp of this file is the time that tomcat was extracted from the zip files.
1819 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
1820 </echo>
1821
[20089]1822 <!-- this is not strictly a prepare tomcat thing, but if one changes
1823 Java, then they need to change tomcat as well, so might as well call
1824 it here -->
1825 <antcall target="configure-java-version"/>
[16951]1826 <else>
1827 <echo>Tomcat has been prepared, will not prepare</echo>
1828 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
1829 </else>
1830
1831 </if>
1832
[30037]1833 </target>
[15124]1834
1835 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1836
[32338]1837 <target name="configure-tomcat-local" depends="init,perl-for-building" if="tomcat.islocal">
[15124]1838 <!-- re-setup the server.xml file -->
[32310]1839 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml.in"
[20079]1840 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
[15124]1841 <filterset>
[16936]1842 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
[32346]1843 <filter token="https.redirect.port" value="${https.redirect.port}"/>
1844 <filter token="tomcat.port.http" value="${tomcat.port.http}"/>
1845 <filter token="tomcat.port.https" value="${tomcat.port.https}"/>
[32349]1846 <!--<filter token="keystore.file" value="${packages.home}/tomcat/conf/https_cert/${tomcat.server}.jks" />-->
1847 <filter token="keystore.file" value="${packages.home}/tomcat/conf/https_cert/fullchain_and_prvtkey.p12" />
1848 <!-- tomcat Connector's keystoreType param defaults to JKS (Java keystore), see https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
1849 We'll follow the instructions at https://community.letsencrypt.org/t/using-lets-encrypt-with-tomcat/41082,
1850 https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/
1851 and https://computingforgeeks.com/tomcat-7-with-letsencrypt-ssl-certificate/
1852 (minus the keytool step) and use the PKCS12 file generated by openssl directly,
1853 instead of an additional step to generate the java keystore file from that -->
1854 <filter token="keystore.type" value="PKCS12"/>
[32346]1855 <filter token="keystore.pass" value="${keystore.pass}"/>
1856 <filter token="http.comment.out.start" value="${http.comment.out.start}"/>
1857 <filter token="http.comment.out.end" value="${http.comment.out.end}"/>
1858 <filter token="https.comment.out.start" value="${https.comment.out.start}"/>
1859 <filter token="https.comment.out.end" value="${https.comment.out.end}"/>
[15124]1860 </filterset>
1861 </copy>
[30035]1862
1863 <!-- set up the solr context -->
[30036]1864
[30038]1865 <!-- First work out the IPv4 address for this machine -->
1866 <exec executable="${basedir}/bin/script/IPv4.sh" os="${os.unix}" failonerror="false" outputproperty="ipv4.val">
1867 <arg value="-format-for-tomcat-context"/>
1868 </exec>
1869 <exec executable="${basedir}/bin/script/IPv4.bat" osfamily="windows" failonerror="false" outputproperty="ipv4.val">
1870 <arg value="-format-for-tomcat-context"/>
1871 </exec>
[30036]1872
[30035]1873 <copy file="${basedir}/ext/solr/solr-tomcat-context.xml.in" tofile="${packages.home}/tomcat/conf/Catalina/localhost/solr.xml" overwrite="true">
1874 <filterset>
1875 <filter token="gsdl3webhome" value="${web.writablehome}"/>
1876 <filter token="tomcathome" value="${basedir}/packages/tomcat"/>
[30036]1877 <filter token="IPv4" value="${ipv4.val}"/>
[30035]1878 </filterset>
1879 </copy>
1880
[28297]1881 <!-- set up the greenstone3 context, it may have a custom name specified in build.properties -->
[30673]1882 <if><bool><not><equals arg1="greenstone3" arg2="${greenstone.context}"></equals></not></bool>
[32310]1883 <copy file="${basedir}/resources/tomcat/greenstone3.xml.in" tofile="${basedir}/resources/tomcat/${greenstone.context}.xml.in" overwrite="true"/>
[28297]1884 </if>
[32310]1885 <copy file="${basedir}/resources/tomcat/${greenstone.context}.xml.in" tofile="${packages.home}/tomcat/conf/Catalina/localhost/${greenstone.context}.xml" overwrite="true">
[15124]1886 <filterset>
[16936]1887 <filter token="gsdl3webhome" value="${web.home}"/>
[27829]1888 <filter token="gsdl3webwritablehome" value="${web.writablehome}"/>
[29845]1889 <filter token="privilegedattribute" value="${privileged.attribute}"/>
1890 <filter token="allowedIPs" value="${allowed.IPs}"/>
[29977]1891 <filter token="derbyserver" value="${derby.server}"/>
[29903]1892 <filter token="derbyserverport" value="${derby.server.port}"/>
[15124]1893 </filterset>
1894 </copy>
[28297]1895 <if>
1896 <bool>
1897 <and>
1898 <available file="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml"/>
[30673]1899 <not><equals arg1="greenstone3" arg2="${greenstone.context}"></equals></not>
[28297]1900 </and>
1901 </bool>
1902 <delete file="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml"/>
1903 </if>
[25570]1904
[27860]1905 <!-- set up the greenstone3 web.xml file -->
[32310]1906 <copy file="${basedir}/resources/tomcat/web.xml.in" tofile="${packages.home}/tomcat/conf/web.xml" overwrite="true">
[27860]1907 <filterset>
1908 <filter token="perlpath" value="${perl.path}"/>
1909 </filterset>
1910 </copy>
[15124]1911 </target>
[28297]1912
[15124]1913 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
1914 <!-- re-setup the server.xml file -->
1915 <!-- need to edit the config file, or do we get the user to do this???-->
1916 </target>
[26495]1917
[27860]1918 <target name="configure-solr-ext" depends="init" >
1919 <!-- re-setup the web/ext/solr/solr.xml file -->
[28178]1920 <copy file="${web.home}/ext/solr/solr.xml.in"
[27866]1921 tofile="${gsdl3.writablehome}/ext/solr/solr.xml" filtering="true" overwrite="true">
[27860]1922 <filterset>
1923 <filter token="gsdl3.home" value="${src.gsdl3.home.unix}"/>
1924 <filter token="gsdl3.writablehome" value="${src.gsdl3.writablehome.unix}"/>
1925 </filterset>
1926 </copy>
1927 </target>
[22551]1928
[26495]1929 <!-- This target runs tomcat's "bin/catalina.bat(.sh) jpda start"
1930 to allow debugging the running GS3 server in Eclipse. See the instructions at
1931 http://www.wikijava.org/wiki/Debugging_a_servlet_with_tomcat_and_Eclipse_tutorial
1932 on how to use this with eclipse
1933 -->
[32338]1934 <target name="debug-start-tomcat" description="Startup Tomcat for debugger" depends="init" if="tomcat.islocal">
[26495]1935 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
1936 <property name="tomcat.path" refid="local.tomcat.path"/>
1937
1938 <if><bool>
1939 <isset property="fedora.maxpermsize"/></bool>
[30303]1940 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts} ${fedora.maxpermsize}"/>
[26495]1941 <else>
[30303]1942 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts}"/>
[26495]1943 </else>
1944 </if>
1945
[27829]1946 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
1947 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
[26495]1948
1949 <exec executable="${catalina.home}/bin/catalina.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1950 <arg value="jpda" />
1951 <arg value="start" />
1952 <env key="JPDA_ADDRESS" value="8000"/> <!-- for debugging Tomcat in Eclipse -->
1953 <env key="JPDA_TRANSPORT" value="dt_socket"/> <!-- for debugging Tomcat in Eclipse -->
1954 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1955 <env key="PATH" path="${tomcat.path}"/>
1956 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1957 <env key="CATALINA_HOME" value="${catalina.home}"/>
1958 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1959 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
1960 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
1961 <env key="WNHOME" path="${wn.home}"/>
1962 <env key="FEDORA_HOME" path="${fedora.home}"/>
1963 </exec>
[28044]1964 <exec executable="${catalina.home}/bin/catalina.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="true">
[26495]1965 <arg value="jpda" />
1966 <arg value="start" />
1967 <env key="JPDA_ADDRESS" value="8000"/> <!-- for debugging Tomcat in Eclipse -->
1968 <env key="JPDA_TRANSPORT" value="dt_socket"/> <!-- for debugging Tomcat in Eclipse -->
1969 <env key="GSDLOS" value="windows"/>
1970 <env key="GSDL3HOME" value="${basedir}"/>
1971 <env key="Path" path="${tomcat.path}"/>
1972 <env key="PATH" path="${tomcat.path}"/>
1973 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1974 <env key="CATALINA_HOME" value="${catalina.home}"/>
1975 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1976 <env key="FEDORA_HOME" path="${fedora.home}"/>
1977 </exec>
1978 <!-- wait for the server to startup in case other targets need it running -->
1979 <waitfor maxwait="5" maxwaitunit="second">
1980 <and>
[32334]1981 <socket server="${tomcat.server}" port="${internal.tomcat.port}"/>
1982 <http url="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}/index.html"/>
[26495]1983 </and>
1984 </waitfor>
1985 </target>
[23854]1986
[30013]1987 <target name="start-tomcat" description="Startup only Tomcat" depends="check-tomcat-started">
[23854]1988
[30013]1989 <if><bool><istrue value="${tomcat.isstarted}"/></bool>
[29988]1990 <echo>**************************************</echo>
[32334]1991 <echo>A WEB SERVER IS ALREADY RUNNING ON ${server.protocol}://${tomcat.server}:${internal.tomcat.port}. NOT STARTING.</echo>
[29988]1992 <echo>**************************************</echo>
1993 <else>
[30013]1994 <antcall target="force-start-tomcat"/>
1995 </else>
1996 </if>
1997 </target>
1998
1999 <!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
[32338]2000 <target name="force-start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
[30013]2001
[15799]2002 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
[15124]2003 <property name="tomcat.path" refid="local.tomcat.path"/>
[25095]2004
[26359]2005 <if><bool>
2006 <isset property="fedora.maxpermsize"/></bool>
[30303]2007 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts} ${fedora.maxpermsize}"/>
[26359]2008 <else>
[30303]2009 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx800M ${readonly.catalina.opts}"/>
[26359]2010 </else>
2011 </if>
2012
[27829]2013 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
2014 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
[28043]2015
2016 <!-- using osfamily instead of testing os against os.windows list of recognised windows versions
[28044]2017 so that future windows versions are included. See http://simonharrer.wordpress.com/tag/osfamily/
2018 Can't use the osfamily test for linux-type machines as a group since osfamily=unix is separate from osfamily=mac,
2019 see http://ant-contrib.sourceforge.net/tasks/tasks/osfamily.html -->
[28043]2020
[21351]2021 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]2022 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
2023 <env key="GSDL3HOME" value="${basedir}"/>
2024 <env key="PATH" path="${tomcat.path}"/>
2025 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
2026 <env key="CATALINA_HOME" value="${catalina.home}"/>
2027 <env key="CLASSPATH" path="${tomcat.classpath}"/>
2028 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
[22184]2029 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
[15124]2030 <env key="WNHOME" path="${wn.home}"/>
[26433]2031 <env key="FEDORA_HOME" path="${fedora.home}"/>
[15124]2032 </exec>
[28043]2033 <exec executable="${catalina.home}/bin/startup.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="true">
[15124]2034 <env key="GSDLOS" value="windows"/>
2035 <env key="GSDL3HOME" value="${basedir}"/>
2036 <env key="Path" path="${tomcat.path}"/>
2037 <env key="PATH" path="${tomcat.path}"/>
2038 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
[16628]2039 <env key="CATALINA_HOME" value="${catalina.home}"/>
[15124]2040 <env key="CLASSPATH" path="${tomcat.classpath}"/>
[26433]2041 <env key="FEDORA_HOME" path="${fedora.home}"/>
[15124]2042 </exec>
2043 <!-- wait for the server to startup in case other targets need it running -->
2044 <waitfor maxwait="5" maxwaitunit="second">
2045 <and>
[32334]2046 <socket server="${tomcat.server}" port="${internal.tomcat.port}"/>
2047 <http url="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}/index.html"/>
[15124]2048 </and>
2049 </waitfor>
[29988]2050
[15124]2051 </target>
2052
[22551]2053 <!--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]2054 <target name="reconfigure" description="Reconfigure the message router">
[22551]2055 <waitfor maxwait="5" maxwaitunit="second">
[32334]2056 <http url="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
[22551]2057 </waitfor>
2058 </target>
2059
2060 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
[32338]2061 <target name="reconfigure-collection" description="Reconfigure the collection">
[22551]2062 <waitfor maxwait="5" maxwaitunit="second">
[32334]2063 <http url="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
[22551]2064 </waitfor>
2065 </target>
2066
[15124]2067 <!-- windows: do we want to launch a webrowser?? -->
[25418]2068 <!-- shouldn't this test whether anything is running first?
2069 It's safer to always attempt to stop tomcat: that way we won't be dependent on the right time
2070 to check whether the server is stopped or still running before attempting to start again.
2071 This target, which was recently called force-stop-tomcat for a while but is back to being
2072 called stop-tomcat, now hides the Java exception output that appears whenever tomcat is already
2073 stopped as happens when stop-tomcat is called consecutively. -->
[25420]2074 <target name="force-stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
[21351]2075 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[26433]2076 <env key="FEDORA_HOME" path="${fedora.home}"/>
[15124]2077 <env key="CATALINA_HOME" value="${catalina.home}"/>
[25418]2078 <arg line=">/dev/null 2>&amp;1"/>
[15124]2079 </exec>
[28043]2080 <exec executable="${catalina.home}/bin/shutdown.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="false">
[26433]2081 <env key="FEDORA_HOME" path="${fedora.home}"/>
[16628]2082 <env key="CATALINA_HOME" value="${catalina.home}"/>
[25418]2083 <arg line=">nul 2>&amp;1"/>
[25443]2084 </exec>
[15124]2085 </target>
2086
[25418]2087 <!-- Can also try the "socket" condition in place of the "http" condition
2088 And also use a <waitfor> in place of <condition>, such as:
2089 <waitfor maxwait="5" maxwaitunit="second" timeoutproperty="tomcat.isstopped"><http url="..."/></waitfor>
[25420]2090 The http URL resolves to host:port/greenstone3
2091 Condition uses <http/> rather than <socket/> for testing, since if the server was stopped, the socket
2092 might still be in use for some moments. We test the URL with the http condition since it's likelier to
2093 fail sooner if the server has indeed been stopped. -->
[32338]2094 <target name="check-tomcat-running">
[25418]2095 <condition property="tomcat.isrunning">
[32334]2096 <!--<http url="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}"/>-->
2097 <http url="${server.protocol}://${tomcat.server}:${internal.tomcat.port}"/>
[25418]2098 </condition>
[25321]2099 </target>
[30013]2100
[32049]2101 <!--
2102 <target name="verbose-check-tomcat-running">
2103 <condition property="tomcat.isrunning" value="true" else="false">
[32334]2104 <http url="${server.protocol}://${tomcat.server}:${internal.tomcat.port}"/>
[32049]2105 </condition>
2106 <echo>Tomcat is running: ${tomcat.isrunning}</echo>
2107 </target>
2108 -->
2109 <target name="verbose-check-tomcat-running" depends="check-tomcat-running">
2110 <if>
2111 <bool>
2112 <istrue value="${tomcat.isrunning}"/>
2113 </bool>
2114 <echo>Tomcat is running: ${tomcat.isrunning}</echo>
2115 <else><echo>Tomcat is running: false</echo></else><!-- tomcat.isrunning not set -->
2116 </if>
2117 </target>
2118
[30013]2119 <!-- Need a copy of the check-tomcat-running target with a distinct property, because ant restart runs
2120 both stop and start, both of which need to do tomcat checks. Each property can be set only once during
2121 an invocation with ant. So ant restart will need two properties to store each of the tomcat checks -->
[32338]2122 <target name="check-tomcat-started">
[30013]2123 <condition property="tomcat.isstarted">
[32334]2124 <http url="${server.protocol}://${tomcat.server}:${internal.tomcat.port}"/>
[30013]2125 </condition>
2126 </target>
[25321]2127
[30013]2128
2129
[25443]2130 <!-- stop-tomcat checks if the tomcat server is already running. If it appears to be running
2131 (regardless of whether tomcat was just starting to shut down), this target calls force-stop-tomcat
2132 to issue the shutdown command to tomcat. Then it waits for at most 15 seconds for the server to
2133 actually stop by checking the socket at which tomcat listens every second, printing a warning
2134 at the end of the max wait time of 15 seconds if tomcat was still running. -->
2135 <target name="stop-tomcat" description="Shutdown only Tomcat if running" depends="check-tomcat-running" if="tomcat.isrunning">
[25321]2136 <antcall target="force-stop-tomcat"/>
[25443]2137
2138 <property name="wait.numchecks" value="15"/>
2139 <echo>Waiting for the server to shutdown... (${wait.numchecks} seconds max)</echo>
2140 <waitfor maxwait="${wait.numchecks}" maxwaitunit="second" checkevery="1" checkeveryunit="second" timeoutproperty="tomcat.timedout">
[32334]2141 <not><socket server="${tomcat.server}" port="${internal.tomcat.port}"/></not>
[25443]2142 </waitfor>
2143
2144 <if>
2145 <bool>
2146 <isset property="${tomcat.timedout}"/>
2147 </bool>
2148 <property name="tomcat.isrunning" value="true"/>
[32334]2149 <echo>WARNING: Checked the socket ${wait.numchecks} times, but port ${internal.tomcat.port} is still busy.</echo>
[25443]2150 <else>
2151 <echo>Tomcat is stopped.</echo>
2152 <property name="tomcat.isrunning" value="false"/>
2153 </else>
2154 </if>
[25420]2155 </target>
[25321]2156
[30013]2157 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,force-start-tomcat"/>
[15124]2158
2159 <target name="setup-catalina-ant-tasks">
2160 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
2161 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
2162 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2163 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
2164 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2165 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
2166 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2167 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
2168 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2169 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
2170 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2171 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
2172 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2173 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
2174 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2175 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
2176 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
2177 </target>
2178
[25449]2179 <!-- http://blog.andrewbeacock.com/2007/11/how-to-truncate-log-file-using-ubuntu.html
2180 Doing "cat </dev/null > packages/tomcat/logs/catalina.out" doesn't work as an ant target.
2181 It seems to have a problem with cat or </dev/null, with or without the < sign. -->
[26776]2182 <target name="reset-logs" description="Empties catalina.out, greenstone.log and contents of web/logs/tmp">
[29156]2183 <echo>Truncating catalina.out, solr.log, greenstone.log and server.log, and emptying ${web.writablehome}/logs/tmp</echo>
[26185]2184 <exec executable="rm" os="${os.unix}" dir="${catalina.home}/logs" spawn="false">
2185 <arg value="-f"/>
[25449]2186 <arg value="catalina.out"/>
2187 </exec>
[27829]2188 <exec executable="rm" os="${os.unix}" dir="${web.writablehome}/logs" spawn="false">
[26185]2189 <arg value="-f"/>
[25449]2190 <arg value="greenstone.log"/>
2191 </exec>
[27829]2192 <exec executable="rm" os="${os.unix}" dir="${web.writablehome}/logs" spawn="false">
[26185]2193 <arg value="-f"/>
[26002]2194 <arg value="server.log"/>
2195 </exec>
[15124]2196
[26185]2197 <exec executable="touch" os="${os.unix}" dir="${catalina.home}/logs"
2198 spawn="false">
2199 <arg value="catalina.out"/>
2200 </exec>
[27829]2201 <exec executable="touch" os="${os.unix}" dir="${web.writablehome}/logs"
[26185]2202 spawn="false">
2203 <arg value="greenstone.log"/>
2204 </exec>
[27829]2205 <exec executable="touch" os="${os.unix}" dir="${web.writablehome}/logs"
[26185]2206 spawn="false">
2207 <arg value="server.log"/>
2208 </exec>
2209
[28044]2210 <exec executable="cmd" osfamily="windows" dir="${catalina.home}/logs" spawn="false">
[25449]2211 <arg line="/c echo. > catalina.out"/>
2212 </exec>
[28044]2213 <exec executable="cmd" osfamily="windows" dir="${web.writablehome}/logs" spawn="false">
[25449]2214 <arg line="/c echo. > greenstone.log"/>
2215 </exec>
[28044]2216 <exec executable="cmd" osfamily="windows" dir="${web.writablehome}/logs" spawn="false">
[26002]2217 <arg line="/c echo. > server.log"/>
2218 </exec>
[25449]2219
[29156]2220 <!-- if ext/solr/logs/solr.log exists, truncate it -->
2221 <if><bool><available file="${solr-ext.home}/logs/solr.log" type="file"/></bool>
2222 <exec executable="rm" os="${os.unix}" dir="${solr-ext.home}/logs" spawn="false">
2223 <arg value="-f"/>
2224 <arg value="solr.log"/>
2225 </exec>
2226 <exec executable="touch" os="${os.unix}" dir="${solr-ext.home}/logs" spawn="false">
2227 <arg value="solr.log"/>
2228 </exec>
2229 <exec executable="cmd" osfamily="windows" dir="${solr-ext.home}/logs" spawn="false">
2230 <arg line="/c echo. > solr.log"/>
2231 </exec>
2232 </if>
2233
[25501]2234 <if>
[27829]2235 <bool><available file="${web.writablehome}/logs/tmp" type="dir"/></bool>
[25501]2236 <delete>
[27829]2237 <fileset dir="${web.writablehome}/logs/tmp" includes="**/*"/>
[25501]2238 </delete>
2239 </if>
[25449]2240 </target>
2241
[29438]2242 <target name="clear-tomcat-sessions" description="Clear the Tomcat Session info." depends="init">
2243 <exec executable="cmd" osfamily="windows" dir="${catalina.home}/work/Catalina/localhost/greenstone3" spawn="false">
2244 <arg line="/c echo. > SESSIONS.ser"/>
2245 </exec>
2246 <exec executable="rm" os="${os.unix}" dir="${catalina.home}/work/Catalina/localhost/greenstone3" spawn="false">
2247 <arg value="-f"/>
2248 <arg value="SESSIONS.ser"/>
2249 </exec>
2250
2251 </target>
[15799]2252 <!-- ======================= ant Targets ============================ -->
[15124]2253 <target name="prepare-ant" depends="init">
[16951]2254 <if>
2255 <bool>
2256 <not><available file="${packages.home}/ant/.flagfile"/></not>
2257 </bool>
[32367]2258 <property name="ant.download.version" value="apache-ant-1.9.13" />
[32365]2259 <get src="http://www.greenstone.org/gs3files/${ant.download.version}-bin.zip"
2260 dest="${packages.home}/${ant.download.version}-bin.zip"
[16951]2261 usetimestamp="true"/>
[32365]2262 <unzip src="${packages.home}/${ant.download.version}-bin.zip"
[16951]2263 dest="${packages.home}"/>
2264 <move todir="${packages.home}/ant">
[32365]2265 <fileset dir="${packages.home}/${ant.download.version}"/>
[16951]2266 </move>
2267 <echo file="${packages.home}/ant/.flagfile">
2268 the timestamp of this file is the time that ant was extracted from the zip files.
2269 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
2270 </echo>
2271
2272 <else>
2273 <echo>Ant has been prepared, will not prepare</echo>
2274 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
2275 </else>
2276
2277 </if>
[15124]2278 </target>
2279
[25338]2280 <!-- ======================= Admin Targets ============================ -->
2281
2282 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
2283 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
2284 But you can do: echo mypassword | ant config-admin -->
2285 <target name="config-admin" description="Reset admin password">
[30055]2286 <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-20 characters):&gt;">
[25338]2287 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
2288 </input>
[25343]2289 <!--<echo>PWD: ${admin.password}</echo>-->
[25338]2290 <antcall target="update-userdb">
2291 <param name="user.username" value="admin"/>
2292 <param name="user.password" value="${admin.password}"/>
2293 <param name="user.groups" value=""/>
2294 <param name="user.status" value=""/>
2295 <param name="user.comment" value="Password updated."/>
2296 <param name="user.email" value=""/>
2297 </antcall>
2298 </target>
2299
2300 <target name="config-user" description="Add or modify users" depends="get-user-data,update-userdb"/>
2301
2302 <target name="get-user-data" description="Get user details">
2303 <input addproperty="user.username" message="Username:&gt;"/>
[30055]2304 <input addproperty="user.password" defaultvalue="" message="Password (3-20 characters):&gt;">
[25338]2305 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
2306 </input>
[30196]2307 <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list, e.g. personal-collections-editor):&gt;"/>
[25338]2308 <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
2309 <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
2310 <input addproperty="user.email" defaultvalue="" message="Email:&gt;"/>
2311 </target>
2312
[30055]2313 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
2314 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
2315 But you can do: echo mypassword | ant config-admin -->
2316 <target name="update-userdb" description="Add or modify users" depends="start-derby">
[25418]2317
[29903]2318 <!--
2319 We're now using derby networked server, so stopping and starting tomcat is not necessary.
2320 For embedded derby: stop tomcat if running, since derby db is embedded
2321 and only allows connections from one jvm instance at a time
[25418]2322 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
2323 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
[30055]2324
2325 <!-- Need the derby networked server to be running in order to modify the usersDB.
2326 The start-derby task will check if derby is already running (if not, ${derby.isstarted} will
2327 be false) and will only start up networked derby if it is not already running.
2328 The ${derby.isstarted} property is set by the depends-target "start-derby", since it won't
2329 set the property if called with antcall (like launching in a subshell). Have to use 'depends'.
2330 We'll check ${derby.isstarted} at the end to stop derby again if we had to start it up now.-->
2331 <!--<antcall target="start-derby"/>-->
[25338]2332
[30055]2333 <!-- wait a max of 5 seconds for the derbyserver to have started up -->
[31142]2334 <waitfor maxwait="5" maxwaitunit="second">
[30055]2335 <socket server="${derby.server}" port="${derby.server.port}"/>
2336 </waitfor>
2337
[25338]2338 <!--<echo>${admin.password}</echo>--> <!-- for testing -->
[30235]2339 <echo>gsdl3.writablehome: ${gsdl3.writablehome}</echo> <!-- for testing -->
[30236]2340 <echo>web.home: ${web.home}</echo> <!-- for testing -->
[25338]2341 <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
2342 <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
[30196]2343 <sysproperty key="gsdl3.writablehome" value="${gsdl3.writablehome}" /> <!-- passes -D<syspropKey=syspropVal> to java class ModifyUsersDB. Available in java code as System.getProperty("syspropKey") -->
[27921]2344 <arg file="${web.home}/etc/usersDB"/>
[25338]2345 <arg value="${user.username}"/>
2346 <arg value="password=${user.password}"/>
2347 <arg value="groups=${user.groups}"/>
2348 <arg value="status=${user.status}"/>
2349 <arg value="comment=${user.comment}"/>
2350 <arg value="email=${user.email}"/>
2351 </java>
[30055]2352
2353 <!-- Need to stop networked derby again if we ran it for this target with the depends=start-derby call.
2354 The test here is for <not>derby.isstarted</not>, as the property would be the same as before
2355 derby was started, since properties are immutable within a single ant command. -->
[25338]2356 <if>
2357 <bool>
[30055]2358 <not><istrue value="${derby.isstarted}"/></not>
2359 </bool>
2360 <antcall target="force-stop-derby"/>
[25338]2361 </if>
[30055]2362
[25338]2363 </target>
2364
2365
[20079]2366 <!-- ======================= Axis Targets ============================ -->
2367
[15124]2368 <target name="prepare-axis" depends="init">
[16951]2369
2370 <if>
2371 <bool>
2372 <not><available file="${packages.home}/axis/.flagfile"/></not>
2373 </bool>
2374
2375 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
2376 dest="${packages.home}/${axis.zip.version}"
2377 usetimestamp="true"/>
2378 <unzip src="${packages.home}/${axis.zip.version}"
2379 dest="${packages.home}"/>
2380 <move todir="${packages.home}/axis">
2381 <fileset dir="${packages.home}/${axis.dir.version}"/>
2382 </move>
2383 <!-- install axis into greenstone web app -->
2384 <copy todir="${web.lib}">
2385 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
2386 <include name="*.jar"/>
2387 </fileset>
2388 </copy>
2389 <copy todir="${web.home}">
2390 <fileset dir="${packages.home}/axis/webapps/axis/">
2391 <include name="*.jsp"/>
2392 <include name="*.jws"/>
2393 </fileset>
2394 </copy>
2395 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
2396 <copy todir="${web.classes}">
2397 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
2398 <include name="*.properties"/>
2399 </fileset>
2400 </copy>
2401 <echo file="${packages.home}/axis/.flagfile">
2402 the timestamp of this file is the time that axis was extracted from the zip files.
2403 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
2404 </echo>
2405
2406 <else>
2407 <echo>Axis has been prepared, will not prepare</echo>
2408 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
2409 </else>
2410
2411 </if>
[15124]2412 </target>
2413
[32338]2414 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
[15124]2415 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
[15799]2416
2417 <target name="deploy-site">
[15124]2418 <java classname="org.apache.axis.client.AdminClient">
2419 <classpath refid="compile.classpath"/>
2420 <arg value="-l"/>
[32334]2421 <arg value="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]2422 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
2423 </java>
2424 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
[15124]2425 </target>
2426
[32338]2427 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
[15124]2428 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
[15229]2429 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
2430 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
2431 tofile="${basedir}/resources/soap/undeploy.wsdd"
2432 filtering="true"
2433 overwrite="true"/>
[15124]2434 <java classname="org.apache.axis.client.AdminClient">
2435 <classpath refid="compile.classpath"/>
2436 <arg value="-l"/>
[32334]2437 <arg value="${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]2438 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
[15124]2439 </java>
[15229]2440 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
[15799]2441 </target>
[15124]2442
[16936]2443 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
2444 with the default servicename of localsite-->
[32338]2445 <target name="deploy-localsite" depends="init"
[15124]2446 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
[30013]2447 <antcall target="force-start-tomcat"/>
[15235]2448 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
[15229]2449 <antcall target="create-deployment-files">
2450 <param name="axis.sitename" value="localsite"/>
[15235]2451 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]2452 <param name="axis.siteuri" value="localsite"/>
2453 </antcall>
[15124]2454 <antcall target="deploy-site">
2455 <param name="axis.sitename" value="localsite"/>
[15235]2456 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]2457 <param name="axis.siteuri" value="localsite"/>
[15124]2458 </antcall>
[15369]2459 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
[15124]2460 </target>
[15799]2461
[16936]2462 <target name="get-sitename" unless="axis.sitename">
[15229]2463 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
[15235]2464Press Enter for default:localsite</input>
[15124]2465 </target>
2466
[15229]2467 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
2468 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
[32334]2469To find out which web services you've got deployed, point your browser to ${server.protocol}://${tomcat.server}:${internal.tomcat.port}/greenstone3/services
[20209]2470Or press Enter for undeploying the default:localsite /&gt;</input>
[15229]2471 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
[15124]2472 </target>
2473
[15229]2474 <target name="get-webservices" unless="axis.servicesname">
[15235]2475 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
[15229]2476Choose from: ${web.services.list}
[20209]2477Or press Enter for default:${base.webservice.name} /&gt;</input>
[15229]2478 <echo>${axis.servicesname}</echo>
2479 </target>
2480
2481 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
[15235]2482 <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]2483 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
2484 </target>
2485
2486 <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">
2487 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
[15235]2488 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15124]2489 </condition>
[15229]2490
2491 <!--everything else defaults to java:RPC at present-->
2492 <condition property="soap.method" value="provider='java:RPC'">
2493 <not>
[15235]2494 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15229]2495 </not>
2496 </condition>
[16936]2497 </target>
[15799]2498
[16936]2499 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
[15124]2500 <filter token="sitename" value="${axis.sitename}"/>
2501 <filter token="siteuri" value="${axis.siteuri}"/>
[15229]2502 <filter token="servicesname" value="${axis.servicesname}"/>
2503 <filter token="soapmethod" value="${soap.method}"/>
[15124]2504 <copy file="${basedir}/resources/soap/site.wsdd.template"
[15229]2505 tofile="${basedir}/resources/soap/deploy.wsdd"
2506 filtering="true"
2507 overwrite="true"/>
[15124]2508 <!-- create the java files and compile them -->
[15229]2509 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
2510 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
2511 filtering="true"
2512 overwrite="true"/>
[15124]2513 <mkdir dir="${build.home}"/>
2514 <javac srcdir="${src.home}"
2515 destdir="${build.home}"
[28137]2516 includeantruntime="${compile.includeantruntime}"
[15124]2517 debug="${compile.debug}"
2518 deprecation="${compile.deprecation}"
[29515]2519 optimize="${compile.optimize}"
2520 encoding="${compile.encoding}">
[15124]2521 <classpath refid="compile.classpath"/>
[15229]2522 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
[15124]2523 </javac>
2524 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
[15799]2525 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
2526 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
2527 overwrite="true" />
[15124]2528 </target>
[15799]2529
[15124]2530
[15799]2531 <!-- ====================== Core targets ============================== -->
2532 <!-- core targets refer to the core gsdl3 java src -->
[15124]2533
[19878]2534 <target name="prepare-core"/>
[15124]2535
2536 <target name="configure-core"/>
2537
2538 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
2539 description="Update only the Greenstone core" />
2540
[15799]2541 <target name="svnupdate-core" unless="nosvn.mode">
[20930]2542 <exec executable="svn">
2543 <arg value="update"/>
2544 <arg value="${basedir}"/>
2545 <arg value="-r"/><arg value="${branch.revision}"/>
2546 </exec>
[15124]2547 </target>
2548
2549 <target name="clean-core"
2550 description="Clean only the Greenstone core">
[19878]2551 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
[15124]2552 <delete dir="${build.home}"/>
2553 </target>
2554
[15799]2555 <target name="compile-core" depends="init"
[15124]2556 description="Compile only the Greenstone core">
2557 <mkdir dir="${build.home}"/>
[25131]2558
[23803]2559 <if><bool><isset property="with.jni"/></bool>
2560 <javac srcdir="${src.home}"
2561 destdir="${build.home}"
[28137]2562 includeantruntime="${compile.includeantruntime}"
[23803]2563 debug="${compile.debug}"
2564 deprecation="${compile.deprecation}"
[29515]2565 optimize="${compile.optimize}"
2566 encoding="${compile.encoding}">
[23803]2567 <classpath>
2568 <path refid="compile.classpath"/>
2569 </classpath>
2570 </javac>
2571 <else>
2572 <property name="gsprefix" value=""/>
2573 <javac srcdir="${src.home}"
[28137]2574 destdir="${build.home}"
2575 includeantruntime="${compile.includeantruntime}"
2576 debug="${compile.debug}"
2577 deprecation="${compile.deprecation}"
[29515]2578 optimize="${compile.optimize}"
2579 encoding="${compile.encoding}">
[23803]2580 <classpath>
2581 <path refid="compile.classpath"/>
2582 </classpath>
2583 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
2584 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
2585 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
2586 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
2587 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
2588 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
2589 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
2590 </javac>
2591 </else>
2592 </if>
[15124]2593 <jar destfile="${build.home}/gsdl3.jar">
2594 <fileset dir="${build.home}">
[16936]2595 <include name="org/greenstone/gsdl3/**"/>
[15124]2596 <include name="org/flax/**"/>
[16936]2597 <exclude name="**/Test.class"/>
[15124]2598 </fileset>
2599 <manifest>
[16936]2600 <attribute name="Built-By" value="${user.name}" />
[15124]2601 </manifest>
2602 </jar>
2603 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
[22101]2604
2605 <jar destfile="${build.home}/gutil.jar">
2606 <fileset dir="${build.home}">
2607 <include name="org/greenstone/util/**"/>
2608 </fileset>
2609 <manifest>
2610 <attribute name="Built-By" value="${user.name}" />
2611 </manifest>
2612 </jar>
2613 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
2614
[15124]2615 <!-- copy the localsite server in case we need it -->
[15235]2616 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
[15124]2617
[17918]2618 <!-- Greenstone Administrator Interface -->
[15124]2619 <jar destfile="${build.home}/GAI.jar">
2620 <fileset dir="${build.home}">
[16936]2621 <include name="org/greenstone/admin/**"/>
[15124]2622 </fileset>
2623 <manifest>
[16936]2624 <attribute name="Built-By" value="${user.name}" />
[15124]2625 </manifest>
2626 </jar>
[17917]2627 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
[18124]2628 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
[15124]2629 <jar destfile="${build.home}/phind.jar">
2630 <fileset dir="${build.home}">
[16936]2631 <include name="org/greenstone/applet/phind/**"/>
[15124]2632 </fileset>
2633 <manifest>
[16936]2634 <attribute name="Built-By" value="${user.name}" />
[15124]2635 </manifest>
2636 </jar>
2637 <mkdir dir="${web.applet}"/>
2638 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
2639 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
[18515]2640 <if>
2641 <bool><istrue value="${tomcat.islocal}"/></bool>
[29711]2642 <if><bool><available file="${catalina.home}/lib/xercesImpl.jar"/></bool><!-- moved for solr -->
2643 <copy file="${catalina.home}/lib/xercesImpl.jar" todir="${web.applet}"/>
2644 <copy file="${catalina.home}/lib/xml-apis.jar" todir="${web.applet}"/>
2645
2646 <else><!-- get from default GS3 web lib location-->
2647 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
2648 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
2649 </else>
2650 </if>
[18515]2651 </if>
2652
2653
[17116]2654 <!-- skip anttasks for now
[15124]2655 <jar destfile="${build.home}/anttasks.jar">
2656 <fileset dir="${build.home}">
[16936]2657 <include name="org/greenstone/anttasks/**"/>
[15124]2658 </fileset>
2659 <manifest>
[16936]2660 <attribute name="Built-By" value="${user.name}" />
[15124]2661 </manifest>
2662 </jar>
[17116]2663 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
[15124]2664 <jar destfile="${build.home}/gsdl3test.jar">
2665 <fileset dir="${build.home}">
[16936]2666 <include name="org/greenstone/gsdl3/**/*Test.class"/>
2667 <include name="org/greenstone/testing/**"/>
[15124]2668 </fileset>
2669 <manifest>
[16936]2670 <attribute name="Built-By" value="${user.name}" />
[15124]2671 </manifest>
2672 </jar>
2673 <jar destfile="${build.home}/server.jar">
2674 <fileset dir="${build.home}">
[16936]2675 <include name="org/greenstone/server/**"/>
[22634]2676 <include name="org/greenstone/util/**"/>
[15124]2677 </fileset>
2678 <fileset file="${basedir}/resources/java/server.properties"/>
2679 <manifest>
[16936]2680 <attribute name="Built-By" value="${user.name}"/>
[15124]2681 </manifest>
2682 </jar>
2683 <copy file="${build.home}/server.jar" todir="${basedir}"/>
2684 </target>
[27149]2685
2686 <!-- === Eclipse targets == -->
2687 <target name="setup-for-eclipse">
2688
2689 <filter token="gsdlhome" value="${gs2build.home}"/>
2690 <filter token="gsdl3srchome" value="${basedir}"/>
2691 <filter token="gsdl3home" value="${basedir}/web"/>
2692
2693 <if>
2694 <bool><not><available file="${basedir}/TransformingLibrary.launch"/></not></bool>
2695 <copy file="${basedir}/TransformingLibrary.launch.in" tofile="${basedir}/TransformingLibrary.launch" filtering="true" overwrite="true"/>
2696 </if>
2697<!--
2698 <if>
2699 <bool><not><available file="${basedir}/LibraryCommandline.launch"/></not></bool>
2700 <copy file="${basedir}/LibraryCommandline.launch.in" tofile="${basedir}/LibraryCommandline.launch" filtering="true" overwrite="true"/>
2701 </if>
2702-->
2703 </target>
[15799]2704
2705 <!-- ================== Packages targets ================================ -->
[15124]2706 <!-- these targets refer to the greenstone source packages - these need
2707 updating less often, so are in separate targets to the core -->
[19871]2708 <target name="prepare-packages" depends="init"/>
[15124]2709
2710 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
2711 description="Update only the source packages"/>
2712
[15799]2713 <target name="svnupdate-packages" unless="nosvn.mode">
[20930]2714 <exec executable="svn">
2715 <arg value="update"/>
2716 <arg value="${src.packages.home}"/>
2717 <arg value="-r"/><arg value="${branch.revision}"/>
2718 </exec>
[15124]2719 </target>
[19931]2720
[15124]2721
[19871]2722 <target name="configure-packages" depends="init,configure-javagdbm"
[15124]2723 description="Configure only the packages."/>
2724
[22184]2725 <target name="configure-javagdbm" if="with.jni">
[15124]2726 <echo>
2727 Configuring JavaGDBM
2728 </echo>
[18417]2729
[19904]2730 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15124]2731 <arg value="--prefix=${basedir}"/>
2732 <arg value="--libdir=${lib.jni}"/>
[19873]2733 <arg value="--with-gdbm=${gdbm.home}"/>
[26765]2734 <arg line="${cross.configure.args}"/>
[15124]2735 </exec>
2736 </target>
2737
[19871]2738 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
[15124]2739
2740 <target name="clean-javagdbm" depends="init">
[26082]2741 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
[15124]2742 <exec executable="make" os="${os.unix}"
[19904]2743 dir="${javagdbm.home}" failonerror="true">
[15124]2744 <arg value="clean"/>
2745 </exec>
[26082]2746 </if>
[15124]2747 </target>
2748
[19871]2749 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
[15185]2750
[15799]2751 <target name="distclean-javagdbm" depends="init">
[26079]2752 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
[15799]2753 <exec executable="make" os="${os.unix}"
[19904]2754 dir="${javagdbm.home}" failonerror="true">
[15799]2755 <arg value="distclean"/>
2756 </exec>
[26079]2757 </if>
[15799]2758 </target>
2759
2760 <target name="compile-packages" description="Compile only the source packages">
[22184]2761 <!-- javagdbm -->
2762 <antcall target="compile-javagdbm"/>
2763 <!-- Search4j -->
2764 <antcall target="compile-search4j"/>
2765 </target>
2766
2767 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
[15799]2768
[19878]2769 <!-- unix: -->
[15799]2770 <echo>compile javagdbm</echo>
[19904]2771 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[29518]2772 <arg value="JAVACOPTIONS=-encoding UTF8"/>
2773 </exec>
2774 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15799]2775 <arg value="install"/>
2776 </exec>
[15098]2777
[23852]2778 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
2779 "all" which will then perform both the compile AND link targets in jni/win32.mak
2780 (thereby also generating gdbmjava.dll). Then we run the same command with
2781 the "install" argument to copy the gdbmjava.dll into the correct location. -->
[23849]2782 <echo>Windows: compile javagdbm</echo>
[28044]2783 <exec executable="${javagdbm.home}/winMake.bat" osfamily="windows" dir="${javagdbm.home}" failonerror="true">
[24076]2784 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23852]2785 </exec>
[28044]2786 <exec executable="${javagdbm.home}/winMake.bat" osfamily="windows" dir="${javagdbm.home}" failonerror="true">
[24076]2787 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23847]2788 <arg value="install"/>
[15799]2789 </exec>
[15124]2790
[15799]2791 <!-- install the jar file -->
[23847]2792 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
[15799]2793 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
2794 </target>
2795
[17491]2796 <target name="compile-search4j">
[17509]2797
[19996]2798 <!-- windows -->
[19997]2799 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[19996]2800 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
2801 <arg value="/f"/>
2802 <arg value="win32.mak"/>
2803 <arg value='BINDIR="${basedir}\bin"'/>
2804 </exec>
2805 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
2806 <arg value="/f"/>
2807 <arg value="win32.mak"/>
2808 <arg value="install"/>
2809 <arg value='BINDIR="${basedir}\bin"'/>
2810 </exec>
[17509]2811
[19996]2812 <!-- unix -->
[19997]2813 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
[19996]2814 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
2815 <arg value="--bindir=${basedir}/bin"/>
2816 <arg value="${static.arg}"/>
[26765]2817 <arg line="${cross.configure.args}"/>
[19996]2818 </exec>
2819 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
2820 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
2821 <arg value="install"/>
2822 </exec>
[17509]2823
[19996]2824 <!-- else warn -->
2825 <else>
2826 <fail>this target does not support the current os</fail>
[17509]2827
[19996]2828 </else></if></else></if>
2829
[17491]2830 </target>
2831
[19871]2832 <target name="install-auxiliary-jar-files" depends="init">
[22184]2833
2834 <if>
2835 <bool><available file="${mg.home}/mg.jar"/></bool>
2836 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
2837 </if>
2838
2839 <if>
[22199]2840 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
[22184]2841 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
2842 </if>
2843
[29143]2844 <copy file="${lucene.home}/LuceneWrapper4.jar" todir="${web.lib}"/>
[19871]2845 </target>
2846
[22976]2847 <target name="install-jni-files" depends="init" if="with.jni">
2848 <antcall target="install-jni-files-linux"/>
2849 <antcall target="install-jni-files-windows"/>
2850 <antcall target="install-jni-files-macos"/>
2851 </target>
[15124]2852
[15799]2853 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
[26765]2854
2855 <if>
2856
2857 <bool><equals arg1="${os.bin.dir}" arg2="windows"/></bool>
2858 <!-- cross compiling to windows -->
2859 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
2860 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
2861 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
2862 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
2863 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
2864 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
2865
2866 <else>
2867 <!-- otherwise do the usual Unix copies -->
2868 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
2869 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
2870 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
2871 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
2872 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
2873 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
2874 </else>
2875 </if>
2876
2877
[15799]2878 </target>
2879 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
[15124]2880 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
2881 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
[15799]2882 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
[15124]2883 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
2884 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
[15799]2885 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
2886 </target>
2887 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
[15124]2888 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
2889 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
[15799]2890 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
[15124]2891 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
2892 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
[15799]2893 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
2894 </target>
2895
[19871]2896 <!-- ========common-src targets =================================-->
2897 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
2898 collection building is not enabled -->
2899
2900 <target name="update-common-src" depends="init" if="collection.building.disabled">
2901 </target>
[19931]2902
[19871]2903 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
[20930]2904 <exec executable="svn">
2905 <arg value="update"/>
2906 <arg value="${common.src.home}"/>
2907 <arg value="-r"/><arg value="${branch.revision}"/>
2908 </exec>
[19871]2909 </target>
2910
[19878]2911 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
[19871]2912 <antcall target="checkout-common-src"/>
2913 <antcall target="unzip-windows-packages"/>
2914 </target>
2915
2916 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
2917 <echo>checking out common-src</echo>
[20930]2918 <exec executable="svn">
2919 <arg value="checkout"/>
[21196]2920 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
[20930]2921 <arg value="common-src"/>
2922 <arg value="-r"/><arg value="${branch.revision}"/>
2923 </exec>
[19871]2924 </target>
2925
[19931]2926 <target name="configure-common-src" depends="init">
[26765]2927<!--
2928 <echo>cross configure args: ${cross.configure.args}</echo>
2929-->
[19871]2930 <exec executable="${common.src.home}/configure" os="${os.unix}"
[19904]2931 dir="${common.src.home}" failonerror="true">
[19931]2932 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
[19933]2933 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
[22184]2934 <arg line="${gs2.opt.args}"/>
[22854]2935 <arg line="${static.arg}"/>
[26765]2936 <arg line="${cross.configure.args}"/>
[23611]2937 <arg line="${allargs}"/>
[19871]2938 </exec>
2939 </target>
2940
[19931]2941 <target name="clean-common-src" depends="init">
[19871]2942 <!-- unix: -->
[26082]2943 <if><bool><available file="${common.src.home}/Makefile"/></bool>
[19904]2944 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]2945 <arg value="clean"/>
2946 </exec>
[26082]2947 </if>
[19871]2948 <!-- windows: -->
[28044]2949 <exec executable="nmake" dir="${common.src.home}" osfamily="windows" failonerror="true">
[19871]2950 <arg value="/f"/>
2951 <arg value="win32.mak"/>
2952 <arg value="clean"/>
[19960]2953 <arg value="GSDLHOME=${gs2build.home}"/>
[19871]2954 </exec>
2955 </target>
[19931]2956 <target name="distclean-common-src" depends="init">
[19960]2957 <!-- unix: -->
[26079]2958 <if><bool><available file="${common.src.home}/Makefile"/></bool>
[19904]2959 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]2960 <arg value="distclean"/>
2961 </exec>
[26079]2962 </if>
[19960]2963 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
[28044]2964 <exec executable="nmake" dir="${common.src.home}" osfamily="windows" failonerror="true">
[19960]2965 <arg value="/f"/>
2966 <arg value="win32.mak"/>
2967 <arg value="clean"/>
2968 <arg value="GSDLHOME=${gs2build.home}"/>
2969 </exec>
[19871]2970 </target>
[19931]2971 <target name="compile-common-src" depends="init">
[19871]2972 <!-- unix: -->
[19904]2973 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]2974 <arg value="${gs2.compile.target}"/>
[19871]2975 </exec>
2976 <!-- windows: -->
[28044]2977 <exec executable="nmake" dir="${common.src.home}" osfamily="windows" failonerror="true">
[19871]2978 <arg value="/f"/>
2979 <arg value="win32.mak"/>
[19934]2980 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]2981 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[22976]2982 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
2983 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
2984 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
2985 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
[19871]2986 </exec>
2987 </target>
2988
[19843]2989 <!-- ======= collection-building targets ===========================-->
[15124]2990
[19843]2991 <target name="update-collection-building" if="collection.building.enabled"
[19931]2992 depends="init,svnupdate-collection-building,gs2build-edit-setup-bat,configure-common-src,clean-common-src,compile-common-src,configure-collection-building,clean-collection-building,compile-collection-building"
[19843]2993 description="Update (SVN update, configure, compile etc) only the collection building components"/>
[15124]2994
[27135]2995 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-cgi,svnupdate-gli" unless="nosvn.mode"
[19843]2996 description="SVN update the collection building components">
2997 </target>
[15124]2998
[27135]2999 <target name="prepare-collection-building" depends="init,prepare-gs2build,svnupdate-cgi,prepare-gli" if="collection.building.enabled">
[15124]3000 </target>
3001
[19931]3002 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
3003 description="Configure the collection building components">
[19843]3004 </target>
[15098]3005
[19948]3006 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
[19843]3007 description="Clean only the collection building components"
3008 if="collection.building.enabled"/>
[18495]3009
[19948]3010 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
[19843]3011 description="Distclean only the collection building components"
3012 if="collection.building.enabled"/>
3013
[19931]3014 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
[19843]3015 description="Compile only the collection building components">
[19931]3016 <!-- make install for common-src -->
3017 <!-- unix: -->
3018 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]3019 <arg value="${gs2.install.target}"/>
[19931]3020 </exec>
3021
3022 <!-- windows: -->
[28044]3023 <exec executable="nmake" dir="${common.src.home}" osfamily="windows" failonerror="true">
[19931]3024 <arg value="/f"/>
3025 <arg value="win32.mak"/>
[21370]3026 <arg value="install"/>
[23837]3027 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]3028 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[23837]3029 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
3030 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
3031 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
3032 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
3033 <!--
3034 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
3035 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
[19931]3036 </exec>
3037
3038 <!-- install gs2build indexers for windows -->
3039 <if>
3040 <bool><istrue value="${current.os.iswindows}"/></bool>
3041 <copy todir="${gs2build.home}/bin/windows">
3042 <fileset dir="${gs2build.home}/common-src/indexers/bin">
3043 <include name="*.*"/>
3044 </fileset>
3045 </copy>
3046 </if>
3047
3048 <!-- LuceneWrapper jar file not installed by default -->
3049 <mkdir dir="${gs2build.home}/bin/java"/>
[29143]3050 <copy file="${lucene.home}/LuceneWrapper4.jar" todir="${gs2build.home}/bin/java"/>
[19931]3051
[15124]3052 </target>
[19843]3053
3054 <!-- ============== gli targets ================================= -->
[27135]3055
[27484]3056 <!-- gliserver.pl, gsdlCGI.pm, metadata-server.pl and checksum.pl are updated alongside
[27135]3057 this in target svnupdate-collection-building -->
[15799]3058 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
[19929]3059
[20930]3060 <exec executable="svn">
3061 <arg value="update"/>
3062 <arg value="${gli.home}"/>
3063 <arg value="-r"/><arg value="${branch.revision}"/>
3064 </exec>
3065
[15124]3066 </target>
3067
[27484]3068 <!-- gliserver.pl, gsdlCGI.pm, metadata-server.pl and checksum.pl are updated
[27135]3069 alongside this prepare-gli target in target prepare-collection-building -->
[19843]3070 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
[19911]3071 <!-- checkout -->
[23808]3072 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
[19929]3073
[20930]3074 <exec executable="svn">
3075 <arg value="checkout"/>
[21196]3076 <arg value="${svn.root}/main/${branch.path}/gli"/>
[20930]3077 <arg value="-r"/><arg value="${branch.revision}"/>
3078 </exec>
3079
[27135]3080 </if>
3081 </target>
3082
[27484]3083 <!-- svn checkout gliserver.pl, gsdlCGI.pm for gli applet, as well as gsdlCGI.pm-dependent metadata-server.pl
3084 (checksum.pl is used by GS2 for depositdspace.dm and may eventually be used by GS3 too) -->
[27135]3085 <target name="svnupdate-cgi">
3086
3087 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]3088 <arg value="export"/>
3089 <arg value="-r"/><arg value="${branch.revision}"/>
[25570]3090 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
[20930]3091 </exec>
[21196]3092 <exec executable="svn" dir="web/WEB-INF/cgi">
3093 <arg value="export"/>
3094 <arg value="-r"/><arg value="${branch.revision}"/>
[25570]3095 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
[21196]3096 </exec>
[27135]3097 <exec executable="svn" dir="web/WEB-INF/cgi">
3098 <arg value="export"/>
3099 <arg value="-r"/><arg value="${branch.revision}"/>
3100 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/metadata-server.pl"/>
3101 </exec>
[27484]3102 <exec executable="svn" dir="web/WEB-INF/cgi">
3103 <arg value="export"/>
3104 <arg value="-r"/><arg value="${branch.revision}"/>
3105 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/checksum.pl"/>
3106 </exec>
[27135]3107 </target>
[20930]3108
[19843]3109
3110 <target name="clean-gli" depends="init" if="collection.building.enabled">
3111 <!-- gli -->
3112 <property name="gli.home" value="${basedir}/gli"/>
3113 <!-- linux -->
3114 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
[20826]3115 resolveExecutable="true" failonerror="true"/>
[19843]3116 <!-- windows -->
[28044]3117 <exec executable="clean.bat" osfamily="windows" dir="${gli.home}"
[20826]3118 resolveExecutable="true" failonerror="true"/>
[19843]3119 </target>
3120
3121 <target name="compile-gli" depends="init" if="collection.building.enabled">
[23808]3122 <if><bool><isset property="with.gli.and.gems"/></bool>
[23807]3123 <!-- gli -->
3124 <property name="gli.home" value="${basedir}/gli"/>
[15098]3125
[23807]3126 <!-- linux -->
3127 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
3128 <!--remote gli-->
3129 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
3130 resolveExecutable="true" failonerror="true"/>
3131 <!-- windows -->
[28044]3132 <exec executable="makegli.bat" osfamily="windows" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
[23807]3133 <!--remote gli-->
[28044]3134 <exec executable="makejar.bat" osfamily="windows" dir="${gli.home}"
[23807]3135 resolveExecutable="true" failonerror="true"/>
3136 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
3137 </if>
[19843]3138 </target>
[15124]3139
[19843]3140 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
[21351]3141 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
[19843]3142 <env key="gsdl3path" path="${basedir}"/>
[19871]3143 <env key="gsdlpath" path="${gs2build.home}"/>
[19843]3144 </exec>
[21351]3145 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
[19843]3146 <env key="gsdl3path" path="${basedir}"/>
[19871]3147 <env key="gsdlpath" path="${gs2build.home}"/>
[19873]3148 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
[19843]3149 </exec>
[28044]3150 <exec executable="${basedir}/gli/gli.bat" osfamily="windows" dir="${basedir}/gli" spawn="true">
[19843]3151 <env key="GSDL3PATH" path="${basedir}"/>
[19871]3152 <env key="GSDLPATH" path="${gs2build.home}"/>
[19843]3153 </exec>
3154 <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.
3155 </echo>
3156 </target>
3157
3158 <!-- ================ gs2build targets =========================== -->
3159
3160 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
3161 <echo>svn updating gs2build</echo>
[20930]3162 <exec executable="svn">
3163 <arg value="update"/>
3164 <arg value="${gs2build.home}"/>
3165 <arg value="-r"/><arg value="${branch.revision}"/>
3166 </exec>
[15799]3167 </target>
[19843]3168
[15124]3169 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
3170 <antcall target="checkout-gs2build"/>
[28259]3171 <antcall target="prepare-pdfbox"/>
[27199]3172 <antcall target="prepare-imagemagick"/> <!-- has to be done before calling prepare-gnome-lib -->
[26791]3173 <antcall target="prepare-gnome-lib"/>
[15124]3174 <antcall target="unzip-windows-packages"/>
3175 <antcall target="checkout-winbin"/>
3176 <antcall target="get-windows-binaries"/>
3177 <antcall target="delete-winbin"/>
3178 </target>
3179
[19843]3180 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
3181 <echo>checking out gs2build</echo>
[20930]3182 <exec executable="svn">
3183 <arg value="checkout"/>
[21196]3184 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
[20930]3185 <arg value="-r"/><arg value="${branch.revision}"/>
3186 </exec>
[26791]3187 </target>
[20930]3188
[28259]3189 <!-- Gets the PDFBox extension into gs2build/ext if checkout.pdfbox.ext is set to true in build.properties
3190 (which it is by default) -->
3191 <target name="prepare-pdfbox" depends="init" if="collection.building.enabled">
3192 <if>
3193 <bool>
3194 <istrue value="${checkout.pdfbox.ext}"/>
3195 </bool>
3196
3197 <property name="pdfbox.ext.dir" value="${gs2build.home}/ext/pdf-box"/>
3198 <condition property="pdfbox.ext.present">
3199 <available file="${pdfbox.ext.dir}" type="dir" />
3200 </condition>
3201
3202 <!-- 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-->
3203 <if>
3204 <bool>
3205 <not><istrue value="${pdfbox.ext.present}"/></not>
3206 </bool>
[27034]3207
[28259]3208 <if>
3209 <bool>
3210 <not><istrue value="${gs2build.home}/ext/pdf-box-java.tar.gz"/></not>
3211 </bool>
3212
3213 <echo>Checking out the PDFBox extension into the GSDLHOME extension area</echo>
3214 <exec executable="svn">
3215 <arg value="export"/>
3216 <arg value="${svn.root}/gs2-extensions/pdf-box/trunk/pdf-box-java.tar.gz"/>
3217 <arg value="${gs2build.home}/ext/pdf-box-java.tar.gz"/>
3218 </exec>
3219 </if>
3220
3221 <echo>Extacting the PDFBox extension into the GSDLHOME extension area</echo>
3222 <untar compression="gzip"
3223 src="${gs2build.home}/ext/pdf-box-java.tar.gz"
[28610]3224 dest="${gs2build.home}/ext"/>
[28259]3225
3226 <delete file="${gs2build.home}/ext/pdf-box-java.tar.gz"/>
3227
3228 <else>
3229 <echo>The PDFBox extension already exists at ${pdfbox.ext.dir}</echo>
3230 </else>
3231 </if>
3232
3233 <else>
3234 <echo>**** Not preparing the PDFBox extension:</echo>
3235 <echo>The property checkout.pdfbox.ext in build.properties was not set or was set to false</echo>
3236 </else>
3237 </if>
3238 </target>
3239
[27199]3240 <target name="prepare-imagemagick" depends="init" if="collection.building.enabled">
3241 <if>
3242 <bool>
3243 <istrue value="${checkout.imagemagick.ext}"/>
3244 </bool>
3245
3246 <antcall target="checkout-imagemagick"/>
[28320]3247 <!--Compilation of imagemagick now happens during ant install, still before configuring the src code, as before -->
[27199]3248
3249 <else>
3250 <echo>**** Not preparing imagemagick:</echo>
3251 <echo>property checkout.imagemagick.ext in build.properties was not set or was set to false</echo>
3252 </else>
3253 </if>
3254 </target>
3255
3256 <target name="checkout-imagemagick" depends="init" if="collection.building.enabled" unless="nosvn.mode">
3257
3258 <property name="imagemagick.src.dir" value="${gs2build.home}/ext/imagemagick"/>
3259 <condition property="imagemagick.src.present">
3260 <available file="${imagemagick.src.dir}" type="dir" />
3261 </condition>
3262
3263 <if>
3264 <bool>
3265 <not><istrue value="${imagemagick.src.present}"/></not>
3266 </bool>
3267
3268 <echo>checking out imagemagick source into the extension area</echo>
3269
3270 <exec executable="svn">
3271 <arg value="checkout"/>
3272 <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/src"/>
3273 <arg value="${imagemagick.src.dir}"/>
3274 </exec>
3275
3276 <else>
3277 <echo>imagemagick source code already exists at ${imagemagick.src.dir}</echo>
3278 </else>
3279 </if>
3280 </target>
3281
3282 <!-- 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. -->
3283 <target name="compile-imagemagick" if="checkout.imagemagick.ext">
3284
3285 <property name="imagemagick.src.dir" value="${gs2build.home}/ext/imagemagick"/>
3286 <property name="imagemagick.compiled.dir" value="${gs2build.home}/ext/imagemagick/${os.bin.dir}"/>
3287
[28320]3288 <condition property="imagemagick.src.present.firstcheck">
[27199]3289 <available file="${imagemagick.src.dir}" type="dir" />
3290 </condition>
3291 <condition property="imagemagick.compiled.present">
3292 <available file="${imagemagick.compiled.dir}" type="dir"/>
3293 </condition>
3294 <!--<condition property="imagemagick.bin.present">
3295 <available file="${basedir}/wherever/the/imgmagick/binary/is/to/be/found" type="dir" />
3296 </condition>-->
3297
[28320]3298 <!-- imagemagick will only be checked out if the user set the checkout.imagemagick.ext in build.properties -->
[27199]3299 <if>
3300 <bool>
[28320]3301 <isfalse value="${imagemagick.src.present.firstcheck}"/>
3302 </bool>
3303 <antcall target="checkout-imagemagick"/>
3304 </if>
3305
3306 <!-- keep track of whether the imagemagick src is now indeed present. Need to know this for a subsequent test -->
3307 <condition property="imagemagick.src.present">
3308 <available file="${imagemagick.src.dir}" type="dir" />
3309 </condition>
3310
3311 <if>
3312 <bool>
[27199]3313 <and>
3314 <istrue value="${imagemagick.src.present}"/> <!-- imagemagick src code is present -->
[28320]3315 <isfalse value="${imagemagick.compiled.present}"/> <!-- imagemagick src not compiled yet, so no imagemagick/os subfolder yet -->
3316 </and>
[27199]3317 </bool>
3318 <!-- then compile it. Only necessary for mac/linux, since windows has a stable working binary of imagemagick -->
3319 <exec executable="/bin/bash" dir="${imagemagick.src.dir}" failonerror="true">
3320 <arg value="CASCADE-MAKE.sh"/>
3321 </exec>
3322 </if>
3323 </target>
3324
3325
[27185]3326 <!-- Compile up gnome-lib src folder if: checkout.gnomelib.ext is turned on, and if not using the binary
[27034]3327 version (gnome-lib-minimal), and if the gnome-lib src folder is not already compiled up. -->
[27185]3328 <target name="compile-gnome-lib" if="checkout.gnomelib.ext">
[27034]3329
3330 <!-- http://stackoverflow.com/questions/3290307/sourcing-a-shell-profile-in-an-ant-build-file
3331 TODO: CASCADE-MAKE already sources devel.bash, but we still want to source it more globally,
3332 so that the rest of the GS3 compilation process also has access to those env variables -->
3333
3334 <property name="gnome.lib.src.dir" value="${basedir}/gs2build/ext/gnome-lib"/>
3335 <property name="gnome.lib.compiled.dir" value="${basedir}/gs2build/ext/gnome-lib/${os.bin.dir}"/>
3336
[28320]3337 <condition property="gnome.src.lib.present.firstcheck" value="true" else="false">
3338 <available file="${gnome.lib.src.dir}" type="dir" />
3339 </condition>
[28311]3340 <condition property="gnome.compiled.lib.present" value="true" else="false">
[27034]3341 <available file="${gnome.lib.compiled.dir}" type="dir"/>
3342 </condition>
[28311]3343 <condition property="gnome.lib.min.present" value="true" else="false">
[27034]3344 <available file="${basedir}/gs2build/ext/gnome-lib-minimal" type="dir" />
3345 </condition>
3346
[28311]3347 <!-- Make sure to checkout gnome-lib if it was not checked out at this stage
3348 since we're instructed to do so in th pre-condition to this target -->
[27034]3349 <if>
3350 <bool>
3351 <and>
[28320]3352 <isfalse value="${gnome.lib.min.present}"/>
3353 <isfalse value="${gnome.src.lib.present.firstcheck}"/>
[28311]3354 </and>
3355 </bool>
3356 <antcall target="checkout-gnome-lib"/>
3357 </if>
3358
[28320]3359 <!-- Keep track of whether we have the gnome-lib src folder now. Need to know this for a subsequent test -->
[28311]3360 <condition property="gnome.src.lib.present" value="true" else="false">
3361 <available file="${gnome.lib.src.dir}" type="dir" />
3362 </condition>
3363
3364 <!--<echo>MIN: ${gnome.lib.min.present}
3365 SRC LIB: ${gnome.src.lib.present}
3366 COMPILED: ${gnome.compiled.lib.present}</echo>-->
3367
3368 <if>
3369 <bool>
3370 <and>
3371 <isfalse value="${gnome.lib.min.present}"/> <!-- no gnome-lib-minimal binary present -->
[27034]3372 <istrue value="${gnome.src.lib.present}"/> <!-- gnome-lib folder for compilation is present-->
[28311]3373 <isfalse value="${gnome.compiled.lib.present}"/> <!-- gnome-lib not yet compiled, so no gnome-lib/os subfolder yet -->
[27034]3374 </and>
3375 </bool>
3376
3377 <!-- then compile it. Only necessary for mac/linux, since windows doesn't need gnome lib -->
3378 <exec executable="/bin/bash" dir="${gnome.lib.src.dir}" failonerror="true">
3379 <arg value="CASCADE-MAKE.sh"/>
3380 </exec>
3381 </if>
3382 </target>
3383
3384
[26791]3385 <target name="prepare-gnome-lib" depends="init" if="collection.building.enabled" unless="gnome-lib.present">
[27139]3386 <if>
3387 <bool>
[28643]3388 <istrue value="${checkout.gnomelib.ext}"/>
[27139]3389 </bool>
3390
[28643]3391 <antcall target="checkout-gnome-lib"/>
3392 <!--Compilation of gnome-lib happens during ant install, just before configuring (common-src and) build-src-->
3393
[28636]3394 <else>
[28643]3395 <echo>**** Not preparing gnome-lib:</echo>
3396 <echo>property checkout.gnomelib.ext in build.properties was not set or was set to false</echo>
[28636]3397 </else>
3398 </if>
3399 </target>
3400
3401
[26791]3402 <target name="checkout-gnome-lib" depends="init" if="collection.building.enabled" unless="nosvn.mode">
[27199]3403
3404 <property name="gnomelib.src.dir" value="${basedir}/gs2build/ext/gnome-lib"/>
3405 <condition property="gnome.src.present">
3406 <available file="${gnomelib.src.dir}" type="dir" />
3407 </condition>
3408
3409 <if>
3410 <bool>
3411 <not><istrue value="${gnome.src.present}"/></not>
3412 </bool>
3413
3414 <echo>checking out gnome-lib extension</echo>
3415 <exec executable="svn">
3416 <arg value="checkout"/>
3417 <arg value="${svn.root}/gs2-extensions/gnome-lib/trunk/src"/>
3418 <arg value="${gs2build.home}/ext/gnome-lib"/>
3419 </exec>
3420
3421 <else>
3422 <echo>gnomelib source code already exists at ${gnomelib.src.dir}</echo>
3423 </else>
3424 </if>
3425
[19843]3426 </target>
3427
[15124]3428 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
[15799]3429 unless="nosvn.mode">
[20930]3430
3431 <exec executable="svn">
3432 <arg value="checkout"/>
[21196]3433 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
[20930]3434 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]3435 <arg value="winbin"/>
[20930]3436 </exec>
3437
[15124]3438 </target>
3439
[15799]3440 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
[20930]3441 <exec executable="svn">
3442 <arg value="update"/>
3443 <arg value="winbin"/>
3444 <arg value="-r"/><arg value="${branch.revision}"/>
3445 </exec>
3446
[15799]3447 </target>
[15124]3448
3449 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
3450 <move todir="${gs2build.home}/bin/windows" failonerror="false">
3451 <fileset dir="${basedir}/winbin/bin"/>
3452 </move>
3453 </target>
[19843]3454
[15124]3455 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
3456 <delete dir="${basedir}/winbin"/>
3457 </target>
3458
[19871]3459 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
3460 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
3461 dest="${common.src.home}/packages/windows/crypt"/>
[18179]3462 <untar compression="gzip"
[19871]3463 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
3464 dest="${common.src.home}/packages/sqlite"/>
3465 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
3466 dest="${common.src.home}/indexers/packages/windows/iconv"/>
[15799]3467 </target>
[19878]3468
[15124]3469 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
3470 <!-- we want a windows path in the setup.bat file -->
3471 <pathconvert targetos="windows" property="gs2build.home.windows">
3472 <path path="${gs2build.home}"/>
3473 </pathconvert>
3474 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
3475 <filterset>
[16620]3476 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
[15799]3477 </filterset>
[15124]3478 </move>
3479 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
3480 </target>
3481
[19843]3482
[19948]3483 <target name="clean-build-src" depends="init" if="collection.building.enabled">
[19871]3484 <!-- unix: -->
[26079]3485 <if><bool><available file="${build.src.home}/Makefile"/></bool>
[19948]3486 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]3487 <arg value="clean"/>
3488 </exec>
[26079]3489 </if>
[15124]3490 <!-- windows: -->
[28044]3491 <exec executable="nmake" dir="${build.src.home}" osfamily="windows" failonerror="true">
[15799]3492 <arg value="/f"/>
3493 <arg value="win32.mak"/>
3494 <arg value="clean"/>
[19960]3495 <arg value="GSDLHOME=${gs2build.home}"/>
[15124]3496 </exec>
3497 </target>
3498
[19948]3499
3500 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
[19960]3501 <!-- unix: -->
[26079]3502 <if><bool><available file="${build.src.home}/Makefile"/></bool>
[19948]3503 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]3504 <arg value="distclean"/>
3505 </exec>
[26079]3506 </if>
[19960]3507 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
[28044]3508 <exec executable="nmake" dir="${build.src.home}" osfamily="windows" failonerror="true">
[19960]3509 <arg value="/f"/>
3510 <arg value="win32.mak"/>
3511 <arg value="clean"/>
3512 <arg value="GSDLHOME=${gs2build.home}"/>
3513 </exec>
[15124]3514 </target>
[19843]3515
[28643]3516 <target name="configure-build-src" depends="init" if="collection.building.enabled"
[19931]3517 description="Configure the build-src component">
3518 <exec executable="${build.src.home}/configure" os="${os.unix}"
3519 dir="${build.src.home}" failonerror="true">
3520 <arg value="--prefix=${gs2build.home}"/>
[26765]3521 <arg line="${gs2.opt.args} ${static.arg} ${cross.configure.args} ${allargs}"/>
[19931]3522 </exec>
3523 </target>
[19910]3524
[19931]3525 <!-- common-src is done separately and needs to be compiled first -->
3526 <target name="compile-build-src" depends="init" if="collection.building.enabled">
3527
3528 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[23611]3529 <arg line="${ldlpath.arg}"/>
[22845]3530 </exec>
3531
3532 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[19931]3533 <arg value="install"/>
3534 </exec>
[19910]3535
[19931]3536 <!-- run the setup script -->
[28044]3537 <!-- <exec executable="${compile.windows.c++.setup}" osfamily="windows" failonerror="true"/>-->
[19910]3538 <!--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]3539 <exec executable="nmake" dir="${build.src.home}" osfamily="windows" failonerror="true">
[19910]3540 <arg value="/f"/>
3541 <arg value="win32.mak"/>
[19934]3542 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]3543 </exec>
[28044]3544 <exec executable="nmake" dir="${build.src.home}" osfamily="windows" failonerror="true">
[19910]3545 <arg value="/f"/>
3546 <arg value="win32.mak"/>
3547 <arg value="install"/>
[19934]3548 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]3549 </exec>
[15124]3550 </target>
3551
3552
[15799]3553 <!-- ======================== TESTING Targets ========================= -->
[15124]3554
3555 <target name="test" description="Run the (incomplete) JUnit test suite "
3556 depends="init">
3557 <mkdir dir="${basedir}/test"/>
3558 <junit printsummary="withOutAndErr"
3559 errorproperty="test.failed"
3560 failureproperty="test.failed"
3561 fork="${junit.fork}">
3562 <formatter type="plain"/>
3563 <classpath>
[16936]3564 <pathelement location="${build.home}/gsdl3test.jar"/>
3565 <path refid="compile.classpath"/>
[15124]3566 </classpath>
3567 <test name="${testcase}" if="testcase"/>
3568 <batchtest todir="${basedir}/test" unless="testcase">
[18505]3569 <fileset dir="${build.home}" includes="**/*Test.class" />
[15124]3570 </batchtest>
3571 </junit>
3572 <echo>
3573 *********************************************
[15799]3574 Test output can be found in directory 'test'
[15124]3575 *********************************************
3576 </echo>
3577 </target>
[15799]3578
[20950]3579 <!-- ======================== FLAX Targets ========================= -->
3580 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
3581 <echo>checking out flax ...</echo>
3582 <mkdir dir="${basedir}/src/java/org/flax"/>
3583 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
[22198]3584 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
[20950]3585 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
3586 <mkdir dir="${web.home}/interfaces/flax"/>
3587 <mkdir dir="${web.home}/sites/flax"/>
3588 <mkdir dir="${basedir}/flax-resources"/>
3589 <mkdir dir="${basedir}/flax-lib"/>
[21272]3590 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
3591 <arg value="src/java/org/flax"/></exec>
3592 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
3593 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
[22198]3594 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
3595 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
3596 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
[21272]3597 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
3598 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
3599 <arg value="${web.home}/interfaces/flax"/></exec>
3600 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
3601 <arg value="${web.home}/sites/flax"/></exec>
3602 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
3603 <arg value="flax-resources"/></exec>
3604 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
3605 <arg value="flax-lib"/></exec>
[25901]3606 <antcall target="flax-copy-del-files" />
[20950]3607 </target>
[23442]3608
[25901]3609 <target name="flax-copy-del-files" description="copy some flax files into the appropriate greenstone3 directories and delete some unwanted greenstone stuff">
[23442]3610 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
3611 <copy todir="${web.home}/WEB-INF/lib">
[25901]3612 <fileset dir="${basedir}/flax-lib">
3613 <include name="*.jar"/>
3614 </fileset>
[23442]3615 </copy>
[25904]3616 <!--<delete dir="${web.home}/sites/gateway"/>
3617 <delete dir="${web.home}/sites/localsite"/>-->
[23442]3618 </target>
[20950]3619
3620 <target name="update-flax" description="update flax from repository">
3621 <echo>updating flax ...</echo>
[21272]3622 <exec executable="svn"><arg value="update"/>
3623 <arg value="src/java/org/flax"/></exec>
3624 <exec executable="svn"><arg value="update"/>
[22198]3625 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
3626 <exec executable="svn"><arg value="update"/>
[21272]3627 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
3628 <exec executable="svn"><arg value="update"/>
3629 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
3630 <exec executable="svn"><arg value="update"/>
3631 <arg value="${web.home}/interfaces/flax"/></exec>
3632 <exec executable="svn"><arg value="update"/>
[24366]3633 <arg value="${web.home}/web/sites/flax"/></exec>
3634 <exec executable="svn"><arg value="update"/>
[21272]3635 <arg value="flax-resources"/></exec>
3636 <exec executable="svn"><arg value="update"/>
3637 <arg value="flax-lib"/></exec>
[24098]3638 <antcall target="compile-core" />
[20950]3639 </target>
3640
[25901]3641 <!-- ========================End of FLAX Targets ========================= -->
[20963]3642
[19354]3643 <target name="compile-javadocs">
3644 <javadoc packagenames="org.greenstone.*"
3645 sourcepath="src/java"
3646 defaultexcludes="yes"
3647 destdir="docs/javadoc"
3648 author="true"
3649 version="true"
3650 use="true"
3651 windowtitle="Greenstone3 API">
3652 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
3653 </javadoc>
3654 </target>
3655
[20089]3656<!-- ========== Some distribution targets ======================== -->
[19972]3657 <target name="remove-source">
[23809]3658 <if><bool><isset property="with.gli.and.gems"/></bool>
[19975]3659 <delete includeEmptyDirs="true">
3660 <fileset dir="." defaultexcludes="false">
3661 <patternset refid="greenstone3.source.component"/>
3662 </fileset>
3663 </delete>
[23809]3664
3665 <else>
3666 <delete includeEmptyDirs="true">
3667 <fileset dir="." defaultexcludes="false">
3668 <patternset refid="greenstone3.source.no.gli.component"/>
3669 </fileset>
3670 </delete>
3671 </else>
3672 </if>
[19972]3673 </target>
3674
[19903]3675 <target name="dist-tidy"
[29387]3676 description="'tidies-up' a greenstone3 installation for distribution."
3677 unless="${properties.keep.src}">
[19903]3678
3679 <!-- delete unneeded things -->
3680 <delete dir="${packages.home}/axis"/>
3681 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
3682 <delete file="README-SVN.txt"/>
[32333]3683 <delete file="build.properties.svn"/>
[19903]3684
[19961]3685 <!-- delete source files -->
[19972]3686 <antcall target="remove-source"/>
[19903]3687
3688 <!-- create empty directories -->
[27829]3689 <mkdir dir="${web.writablehome}/applet"/>
3690 <mkdir dir="${web.writablehome}/logs"/>
3691 <mkdir dir="${web.writablehome}/logs/tmp"/>
[19903]3692
[27902]3693 <!-- Lines with ***** are commented out because these files are useful if we want hybrid installations -->
3694
[19903]3695 <!-- os specific tidy-ups -->
[20051]3696 <!-- linux, mac -->
3697 <if><bool><istrue value="${current.os.isunix}"/></bool>
[27902]3698 <!--*****<delete><fileset dir="." includes="*.bat"/></delete>-->
[23809]3699 <if><bool><isset property="with.gli.and.gems"/></bool>
[27902]3700 <!--*****<delete><fileset dir="gli" includes="*.bat"/></delete>-->
[23809]3701 </if>
[27902]3702 <!--*****<delete><fileset dir="gs2build" includes="*.bat"/></delete>-->
3703 <!--*****<delete><fileset dir="bin/script" includes="*.bat"/></delete>-->
[19946]3704 <delete file="${basedir}/gs2build/win32cfg.h"/>
[19939]3705 <delete file="${basedir}/gs2build/win32.mak"/>
[20051]3706 <delete dir="${basedir}/winutil"/>
[19903]3707 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
3708
[20051]3709 <!-- windows -->
3710 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
[27902]3711 <!--*****<delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>-->
[23809]3712 <if><bool><isset property="with.gli.and.gems"/></bool>
[27902]3713 <!--*****<delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>-->
[23809]3714 </if>
[27902]3715 <!--*****<delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>-->
3716 <!--*****<delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>-->
[20051]3717 </if></else></if>
3718
[19903]3719 </target>
3720
[20089]3721 <!-- fix up executable permissions for binary release -->
3722 <target name="fix-execute-permissions">
3723 <echo>Setting binaries to executable</echo>
[20127]3724 <chmod perm="775">
3725 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
3726 </chmod>
[20089]3727 </target>
3728
3729 <!-- fix up executable permissions for source code release -->
3730 <target name="fix-execute-permissions-source">
[20127]3731 <chmod perm="775">
3732 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
3733 </chmod>
[20089]3734 </target>
3735
[27380]3736 <!-- for macs, set up the .app shortcuts to gsi, gli, client-gli and gems -->
3737 <target name="gen-mac-shortcuts">
3738 <if><bool><istrue value="${current.os.ismac}"/></bool>
3739 <filter token="gsdl3srchome" value="${basedir}"/>
3740 <copy file="${basedir}/gs3-server.app/Contents/document.wflow.in" tofile="${basedir}/gs3-server.app/Contents/document.wflow" filtering="true" overwrite="true"/>
3741 <copy file="${basedir}/gli.app/Contents/document.wflow.in" tofile="${basedir}/gli.app/Contents/document.wflow" filtering="true" overwrite="true"/>
3742 <copy file="${basedir}/client-gli.app/Contents/document.wflow.in" tofile="${basedir}/client-gli.app/Contents/document.wflow" filtering="true" overwrite="true"/>
3743 <copy file="${basedir}/gems.app/Contents/document.wflow.in" tofile="${basedir}/gems.app/Contents/document.wflow" filtering="true" overwrite="true"/>
3744 </if>
3745 </target>
[20089]3746
[19931]3747 <!-- ============= tweaks for making compilation static ========== -->
3748 <target name="tweak-makefiles" depends="init" if="compile.static">
3749 <antcall target="rtftohtml-add-static" />
3750 </target>
3751
3752 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
[28136]3753 <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]3754 </target>
3755
[32338]3756 <target name="run-collection-tests">
[26115]3757 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
3758 <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 http://svn.greenstone.org/gs3-extensions/testing/trunk/src testing" in the ext directory of your Greenstone 3 installation. </fail>
3759 </if>
3760 <for param="testjar">
3761 <path>
3762 <fileset dir="${basedir}" includes="web/sites/*/collect/*/tests/tests.jar"/>
3763 </path>
3764 <sequential>
3765 <echo>Testing @{testjar}</echo>
3766 <java classname="org.junit.runner.JUnitCore" fork="true">
3767 <arg value="gstests.TestClass"/>
[32334]3768 <jvmarg value="-DSERVERURL=${server.protocol}://${tomcat.server}:${internal.tomcat.port}${app.path}${server.default.servlet} "/>
[26115]3769 <classpath>
3770 <fileset dir="${basedir}/ext/testing/lib/java">
3771 <include name="*.jar"/>
3772 </fileset>
3773 <files includes="@{testjar}"/>
3774 </classpath>
3775 </java>
3776 </sequential>
3777 </for>
3778 </target>
3779
3780 <target name="build-collection-tests">
3781 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
3782 <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 http://svn.greenstone.org/gs3-extensions/testing/trunk/src testing" in the ext directory of your Greenstone 3 installation. </fail>
3783 </if>
3784 <for param="compiledir">
3785 <path>
3786 <dirset dir="${basedir}" includes="web/sites/*/collect/*/tests/src"/>
3787 </path>
3788 <sequential>
3789 <echo>Compiling @{compiledir}</echo>
3790 <if><bool><not><available file="@{compiledir}/../build" type="dir"/></not></bool>
3791 <mkdir dir="@{compiledir}/../build"/>
3792 </if>
3793 <javac
3794 srcdir="@{compiledir}"
3795 destdir="@{compiledir}/../build"
[28137]3796 includeantruntime="${compile.includeantruntime}"
[26115]3797 debug="${compile.debug}"
3798 deprecation="${compile.deprecation}"
[29515]3799 optimize="${compile.optimize}"
3800 encoding="${compile.encoding}">
[26115]3801 <classpath>
3802 <fileset dir="${basedir}/ext/testing/lib/java">
3803 <include name="*.jar"/>
3804 </fileset>
3805 </classpath>
3806 <include name="gstests/*.java"/>
3807 </javac>
3808 <jar destfile="@{compiledir}/../tests.jar">
3809 <fileset dir="@{compiledir}/../build">
3810 <include name="gstests/**"/>
3811 </fileset>
3812 <manifest>
3813 <attribute name="Built-By" value="${user.name}" />
3814 </manifest>
3815 </jar>
3816 </sequential>
3817 </for>
3818 </target>
[26002]3819</project>
Note: See TracBrowser for help on using the repository browser.