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

Last change on this file since 30617 was 30614, checked in by ak19, 8 years ago

Dealing with spaces in filepath for editing and rebuilding using the web document editor

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