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

Last change on this file since 30303 was 30303, checked in by ak19, 5 years ago

Dr Bainbridge worked out the fix for getting solr collections working off a readonly location like a DVD-ROM.

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