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

Last change on this file since 32310 was 32310, checked in by kjdon, 6 years ago

updating build.xml for the new .svn files, which get turned into .in files in resources. names better reflect their purposes

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