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

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

Trying to compile release on gilda El Capitan.

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