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

Last change on this file since 29857 was 29845, checked in by ak19, 9 years ago

Modified gs3-server dialog to have an Allow External Connections checkbox to match with GS2. Affects org/greenstone/server code and server.properties file, greenstone.xml.in of tomcat, build.xml and build.properties

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