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

Last change on this file since 30758 was 30758, checked in by davidb, 8 years ago

Correcting previous commit. Experiment to see if this helps the release on El Capitan compile. The issue we are looking at is that setting DYLD_LIBRARY_PATH at this point leads to a problem with java, because it now sees the libiconv that gnome-lib-minimal has, which turns out to be incompatible with JDK 1.7_79

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