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

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

Tidying up

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