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

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

Configuring tomcat works automatically. Still need to automate getting the certificate (and then later automate renewing the certificate, after first testing I can manually renew it.)

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