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

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

Fixing annoyingness: To avoid the CGI permissions error appearing continuously in the (localhost) log, need privileged=true set in the root context.xml file too, not just greenstone context file.

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