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

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

Related to commits 29903 and 29923. Adding a property for the derbyserver, which will be localhost by default.

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