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

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

Undoing experimental commits 30786-30793

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