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

Last change on this file since 26284 was 26185, checked in by ak19, 12 years ago

The ant clean-logs target did not work on nzdl's G's GS3 showcase because it didn't recognise the truncate command. Kathy suggested rm and then a touch instead.

File size: 103.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 <!-- create build.properties if it has not been created yet -->
56 <if>
57 <bool><not><available file="build.properties"/></not></bool>
58 <copy file="build.properties.in" tofile="build.properties"/>
59 </if>
60
61 <!-- create the packages dir if it has not been created yet -->
62 <mkdir dir="packages"/>
63
64 <!--the first three properties have to be put on the top to be used by build.properties-->
65 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
66 <property name="src.packages.home" value="${basedir}/src/packages"/>
67 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
68
69 <property file="build.properties"/>
70 <if><bool><available file="${user.home}/build.properties"/></bool>
71 <property file="${user.home}/build.properties"/>
72 </if>
73
74 <!-- now we've read in properties, apply defaults -->
75 <property name="disable.collection.building" value="false"/>
76
77 <!-- get properties from the environment -->
78 <property environment="env"/>
79
80 <!-- get the filesets defining components and executables -->
81 <import file="resources/xml/components.xml"/>
82 <import file="resources/xml/executables.xml"/>
83
84 <!-- version properties for external packages -->
85 <!-- for Java versions < 1.4, we print out the message that Java is too old.
86 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 7.0-->
87 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-7.0.26">
88 <equals arg1="1.4" arg2="${ant.java.version}"/>
89 </condition>
90 <condition property="tomcat.version.major" value="5" else="7">
91 <equals arg1="1.4" arg2="${ant.java.version}"/>
92 </condition>
93 <condition property="privileged.attribute" value="privileged='true'" else="">
94 <equals arg1="7" arg2="${tomcat.version.major}"/>
95 </condition>
96
97 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
98 <property name="axis.dir.version" value="axis-1_4"/>
99 <property name="sqlite.targz.version" value="sqlite-autoconf-3070602.tar.gz"/>
100
101 <property name="build.home" value="${basedir}/build"/>
102 <property name="src.home" value="${basedir}/src/java"/>
103 <property name="packages.home" value="${basedir}/packages"/>
104 <!-- this may be set in build.properties, eg if you move the web dir to
105 tomcats webapps directory -->
106 <property name="web.home" value="${basedir}/web"/>
107 <!-- jar files needed by applets go here -->
108 <property name="web.applet" value="${web.home}/applet"/>
109
110 <!-- jar files needed by the servlet (and extra ones) go here -->
111 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
112 <!-- other files needed by the servlet go here -->
113 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
114 <!--- flax: the WordNet home -->
115 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
116
117 <!-- jni libraries and java wrappers go here -->
118 <property name="lib.jni" value="${basedir}/lib/jni"/>
119
120 <!-- other jar files needed for installation (but not runtime) go here -->
121 <property name="lib.java" value="${basedir}/lib/java"/>
122
123 <property name="javadocs" value="${basedir}/docs/javadoc"/>
124
125 <property name="app.name" value="greenstone3"/>
126 <property name="app.path" value="/${app.name}"/>
127
128 <property name="admin.dir" value="${basedir}/admin"/>
129
130 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
131 <property name="app.version" value="trunk"/>
132 <property name="branch.path" value="trunk"/>
133 <property name="branch.revision" value="HEAD"/>
134
135 <!--constants -->
136 <property name="svn.root" value="http://svn.greenstone.org"/>
137
138 <!-- catalina home is set to tomcat basedir if already installed, otherwise
139 use greenstone's tomcat -->
140 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
141 <and>
142 <isset property="tomcat.installed.path"/>
143 <not>
144 <equals arg1="" arg2="${tomcat.installed.path}"/>
145 </not>
146 </and>
147 </condition>
148
149 <property name="os.linux" value="Linux"/>
150 <property name="os.mac" value="Mac OS X"/>
151 <property name="os.solaris" value="SunOS"/>
152 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
153 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista,Windows 7"/> <!-- check this!!!-->
154
155 <!-- this is true for linux and macs -->
156 <condition property="current.os.isunix">
157 <os family="unix"/>
158 </condition>
159
160 <condition property="current.os.isunixnotmac">
161 <and>
162 <os family="unix"/>
163 <not>
164 <os family="mac"/>
165 </not>
166 </and>
167 </condition>
168
169 <condition property="current.os.ismac">
170 <os family="mac"/>
171 </condition>
172
173 <condition property="current.os.iswindows">
174 <os family="windows"/>
175 </condition>
176
177 <!-- is there a better way to do this?? what about solaris?? -->
178 <condition property="os.bin.dir" value="windows">
179 <os family="windows"/>
180 </condition>
181 <condition property="os.bin.dir" value="darwin">
182 <os family="mac"/>
183 </condition>
184 <condition property="os.bin.dir" value="linux">
185 <and>
186 <os family="unix"/>
187 <not>
188 <os family="mac"/>
189 </not>
190 </and>
191 </condition>
192
193
194 <condition property="collection.building.disabled">
195 <and>
196 <isset property="disable.collection.building"/>
197 <istrue value="${disable.collection.building}"/>
198 </and>
199 </condition>
200
201 <condition property="collection.building.enabled">
202 <not>
203 <istrue value="${disable.collection.building}"/>
204 </not>
205 </condition>
206
207 <condition property="collection.building.enabled.windows">
208 <and>
209 <istrue value="${collection.building.enabled}"/>
210 <isset property="current.os.iswindows"/>
211 </and>
212 </condition>
213
214 <condition property="collection.building.enabled.unix">
215 <and>
216 <istrue value="${collection.building.enabled}"/>
217 <isset property="current.os.isunix"/>
218 </and>
219 </condition>
220
221 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
222 <isset property="compile.static"/>
223 </condition>
224
225 <!-- If building a release then we want to adjust environment variables so that the support library can be see during compilation -->
226 <if><bool><isset property="use.support.lib"/></bool>
227 <property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
228
229 <if><bool><isset property="env.CFLAGS"/></bool>
230 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CFLAGS}&quot;"/>
231 <else>
232 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
233 </else>
234 </if>
235
236 <if><bool><isset property="env.CPPFLAGS"/></bool>
237 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CPPFLAGS}&quot;"/>
238 <else>
239 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
240 </else>
241 </if>
242
243 <if><bool><isset property="env.CXXFLAGS"/></bool>
244 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CXXFLAGS}&quot;"/>
245 <else>
246 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
247 </else>
248 </if>
249
250 <if><bool><isset property="env.LDFLAGS"/></bool>
251 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib ${env.LDFLAGS}&quot;"/>
252 <else>
253 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib&quot;"/>
254 </else>
255 </if>
256
257 <if><bool><isset property="env.PATH"/></bool>
258 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin:${env.PATH}&quot;"/>
259 <else>
260 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin&quot;"/>
261 </else>
262 </if>
263
264 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
265 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig:${env.PKG_CONFIG_PATH}&quot;"/>
266 <else>
267 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig&quot;"/>
268 </else>
269 </if>
270
271 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
272 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
273 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}&quot;"/>
274 <else>
275 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
276 </else>
277 </if>
278 <else>
279 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
280 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
281 <else>
282 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
283 </else>
284 </if>
285 </else>
286 </if>
287
288 <else>
289 <if><bool><isset property="env.CFLAGS"/></bool>
290 <property name="cflags.arg" value="CFLAGS=&quot;${env.CFLAGS}&quot;"/>
291 <else>
292 <property name="cflags.arg" value=" "/>
293 </else>
294 </if>
295
296 <if><bool><isset property="env.CPPFLAGS"/></bool>
297 <property name="cppflags.arg" value="CPPFLAGS=&quot;${env.CPPFLAGS}&quot;"/>
298 <else>
299 <property name="cppflags.arg" value=" "/>
300 </else>
301 </if>
302
303 <if><bool><isset property="env.CXXFLAGS"/></bool>
304 <property name="cxxflags.arg" value="CXXFLAGS=&quot;${env.CXXFLAGS}&quot;"/>
305 <else>
306 <property name="cxxflags.arg" value=" "/>
307 </else>
308 </if>
309
310 <if><bool><isset property="env.LDFLAGS"/></bool>
311 <property name="ldflags.arg" value="LDFLAGS=&quot;${env.LDFLAGS}&quot;"/>
312 <else>
313 <property name="ldflags.arg" value=" "/>
314 </else>
315 </if>
316
317 <if><bool><isset property="env.PATH"/></bool>
318 <property name="path.arg" value="PATH=&quot;${env.PATH}&quot;"/>
319 <else>
320 <property name="path.arg" value=" "/>
321 </else>
322 </if>
323
324 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
325 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${env.PKG_CONFIG_PATH}&quot;"/>
326 <else>
327 <property name="pcpath.arg" value=" "/>
328 </else>
329 </if>
330
331 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
332 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
333 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
334 <else>
335 <property name="ldlpath.arg" value=" "/>
336 </else>
337 </if>
338 <else>
339 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
340 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
341 <else>
342 <property name="ldlpath.arg" value=" "/>
343 </else>
344 </if>
345 </else>
346 </if>
347 </else>
348 </if>
349 <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
350
351 <condition property="gs2.opt.args" value= " " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
352 <istrue value="${with.jni}"/>
353 </condition>
354 <condition property="gs2.compile.target" value="with-jni" else="without-jni">
355 <istrue value="${with.jni}"/>
356 </condition>
357 <condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
358 <istrue value="${with.jni}"/>
359 </condition>
360 <condition property="gs2.windows.enablejni" value="1" else="0">
361 <istrue value="${with.jni}"/>
362 </condition>
363 <condition property="gs2.windows.enablemg" value="1" else="0">
364 <istrue value="${with.jni}"/>
365 </condition>
366 <condition property="gs2.windows.enablemgpp" value="1" else="0">
367 <istrue value="${with.jni}"/>
368 </condition>
369 <!-- Should accent folding not also be set here ?? -->
370 <condition property="gs2.windows.usegdbm" value="1" else="0">
371 <istrue value="${with.jni}"/>
372 </condition>
373 <condition property="gs2.windows.usesqlite" value="1" else="0">
374 <istrue value="${with.jni}"/>
375 </condition>
376
377 <!-- where is search4j tool -->
378 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
379 <isset property="current.os.iswindows"/>
380 </condition>
381
382
383 <!-- ============= Base dirs for each package and component ============ -->
384 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
385 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
386 <property name="gli.home" value="${basedir}/gli"/>
387 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
388
389 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
390 <istrue value="${disable.collection.building}"/>
391 </condition>
392
393 <property name="build.src.home" value="${gs2build.home}/build-src"/>
394 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
395 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
396 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
397 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
398
399 <!-- ==================== Compilation Control Options ==================== -->
400
401 <!--
402
403 These properties control option settings on the Javac compiler when it
404 is invoked using the <javac> task.
405
406 compile.debug Should compilation include the debug option?
407
408 compile.deprecation Should compilation include the deprecation option?
409
410 compile.optimize Should compilation include the optimize option?
411
412 -->
413
414 <property name="compile.debug" value="true"/>
415 <property name="compile.deprecation" value="true"/>
416 <property name="compile.optimize" value="true"/>
417
418 <!--
419
420 Rather than relying on the CLASSPATH environment variable, Ant includes
421 features that makes it easy to dynamically construct the classpath you
422 need for each compilation. The example below constructs the compile
423 classpath to include the servlet.jar file, as well as the other components
424 that Tomcat makes available to web applications automatically, plus anything
425 that you explicitly added.
426
427 -->
428
429 <!-- All elements that Tomcat 5 exposes to applications -->
430 <path id="tomcat5">
431 <pathelement location="${catalina.home}/common/classes"/>
432 <fileset dir="${catalina.home}/common/endorsed">
433 <include name="*.jar"/>
434 </fileset>
435 <fileset dir="${catalina.home}/common/lib">
436 <include name="*.jar"/>
437 </fileset>
438 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
439 <pathelement location="${catalina.home}/shared/classes"/>
440 <fileset dir="${catalina.home}/shared/lib">
441 <include name="*.jar"/>
442 </fileset>
443 </path>
444
445 <!-- All elements that Tomcat 7 exposes to applications -->
446 <path id="tomcat7">
447 <fileset dir="${catalina.home}/lib">
448 <include name="*.jar"/>
449 </fileset>
450 </path>
451
452 <path id="compile.classpath">
453 <!-- Include all jar files and libraries in our jni lib directory -->
454 <pathelement location="${lib.jni}"/>
455 <fileset dir="${lib.jni}">
456 <include name="*.jar"/>
457 </fileset>
458 <!-- Include all jar files in our web lib directory -->
459 <pathelement location="${web.lib}"/>
460 <fileset dir="${web.lib}">
461 <include name="*.jar"/>
462 </fileset>
463
464 <pathelement location="${lib.java}"/>
465 <fileset dir="${lib.java}">
466 <include name="*.jar"/>
467 </fileset>
468
469 <!-- include the jar files from the source packages -->
470 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
471 so we add them in by name -->
472 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
473 <pathelement location="${lib.jni}/mg.jar"/>
474 <pathelement location="${lib.jni}/mgpp.jar"/>
475
476 <!-- Include all elements that Tomcat exposes to applications -->
477 <path refid="tomcat${tomcat.version.major}"/>
478
479 </path>
480
481 <path id="local.tomcat.classpath">
482 <!-- explicitly include the jni java wrappers in the classpath -->
483 <pathelement location="${lib.jni}"/>
484 <fileset dir="${lib.jni}">
485 <include name="*.jar"/>
486 </fileset>
487
488 <pathelement location="${web.lib}"/>
489 <fileset dir="${web.lib}">
490 <include name="derby.jar"/>
491 </fileset>
492 </path>
493
494 <path id="local.tomcat.path">
495 <pathelement location="${basedir}/bin/script"/>
496 <pathelement location="${basedir}/bin"/>
497 <pathelement location="${lib.jni}"/>
498 <pathelement path="${env.PATH}"/>
499 <pathelement path="${env.Path}"/>
500 <pathelement path="${wn.home}/bin"/>
501 </path>
502
503 <target name="test-setup">
504 <echo>ant java version=${ant.java.version}</echo>
505 <echo>is unix : ${current.os.isunix}</echo>
506 <echo>is mac : ${current.os.ismac}</echo>
507 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
508 <echo>is windows : ${current.os.iswindows}</echo>
509 <echo>os.unix: ${os.unix}</echo>
510 </target>
511
512 <!-- ==================== Primary and Global Targets ============================= -->
513
514 <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
515 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.">
516
517 <!-- make sure .sh files are executable -->
518 <chmod dir="${basedir}" perm="ugo+rx"
519 includes="*.sh"/>
520 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
521 includes="*.sh,*.pl"/>
522 </target>
523
524 <!-- 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 -->
525 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
526 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
527
528 <target name="install-common-src" depends="init"
529 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
530 <antcall target="configure-common-src"/>
531 <antcall target="compile-common-src"/>
532 <antcall target="install-auxiliary-jar-files"/>
533 <antcall target="install-jni-files"/>
534 </target>
535
536 <target name="install-collection-building" depends="init" if="collection.building.enabled"
537 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
538 <antcall target="configure-collection-building"/>
539 <antcall target="tweak-makefiles" />
540 <antcall target="compile-collection-building"/>
541 </target>
542
543
544 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
545 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
546
547 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
548 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
549
550 <target name="configure" depends="init,configure-tomcat,configure-web"
551 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."/>
552
553 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
554 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
555
556 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
557 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
558
559 <target name="update" depends="init,svnupdate,clean,install"
560 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'"/>
561
562
563 <target name="perl-for-building" depends="init">
564 <!-- uses perl.path if set in build.properties, otherwise try for
565 environment variable PERLPATH, and failing that assumes 'perl'
566 is on environment PATH -->
567 <!-- 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 -->
568 <if><bool><available file="${gs2build.home}"/></bool>
569
570 <if><bool><not><isset property="perl.path"/></not></bool>
571
572 <if>
573 <bool>
574 <and>
575 <isset property="env.PERLPATH"/>
576 <not><equals arg1="${env.PERLPATH}" arg2=""/></not>
577 </and>
578 </bool>
579 <property name="perl.path" value="${env.PERLPATH}"/>
580 <else>
581 <echo>
582 Using PATH environment variable to locate Perl.
583 </echo>
584 <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
585 <arg value="perl" />
586 </exec>
587
588 <exec executable="${gs2build.home}/bin/windows/which" os="${os.windows}" spawn="false" outputproperty="full.perl.path">
589 <arg value="perl" />
590 </exec>
591
592 <stringutil string="${full.perl.path}" property="partial.perl.path">
593 <replace regex="\/[^\/]*$" replacement="/" />
594 </stringutil>
595 <stringutil string="${partial.perl.path}" property="perl.path">
596 <replace regex="\\[^\\]*$" replacement="\\" />
597 </stringutil>
598 <if><bool><istrue value="${current.os.isunix}"/></bool>
599
600 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
601 <echo>
602 Non-standard location of Perl found: ${full.perl.path}
603 Set the environment variable PERLPATH or the perl.path property in
604 build.properties to explicitly control the version of Perl used.
605 </echo>
606 </if>
607 </if>
608 </else>
609 </if>
610 </if>
611
612 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
613 <if><bool><isset property="perl.path"/></bool>
614 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
615 <else>
616 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
617 </else>
618 </if>
619
620 <!-- gs2build not available, perl.path -->
621 <else>
622 <property name="perl.path" value=""/>
623 </else>
624 </if>
625 </target>
626
627 <target name="get-default-servlet-url">
628 <echo>http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}</echo>
629 </target>
630
631 <target name="start" depends="init,configure-web,start-tomcat"
632 description="Startup the Tomcat server." >
633 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
634 <echo>Tomcat: ${catalina.home}</echo>
635 <echo>Java : ${java.home}</echo>
636 <if><bool><available file="${build.src.home}"/></bool>
637 <echo>Perl : ${full.perl.path}</echo>
638 </if>
639 <if><bool><isset property="install.flax"/></bool>
640 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/flax"/>
641 <else>
642 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/"/>
643 </else>
644 </if>
645 <echo>URL : ${url}</echo>
646 <!-- assuming that index.html is not needed here -->
647
648 <!--Now write out the url with oaiserver suffix as the baseURL property in OAIConfig.xml-->
649 <available file="${web.classes}/OAIConfig.xml" property="oaiconfig.present"/>
650 <antcall target="init-oaiconfig">
651 <param name="url" value="${url}"/>
652 </antcall>
653 </target>
654
655 <target name="init-oaiconfig" if="oaiconfig.present">
656 <echo>Writing out baseURL ${url}oaiserver to ${web.classes}/OAIConfig.xml</echo>
657 <rsr file="${web.classes}/OAIConfig.xml" pattern="&lt;baseURL&gt;.*&lt;/baseURL&gt;" replacement="&lt;baseURL&gt;${url}oaiserver&lt;/baseURL&gt;" />
658 </target>
659
660 <target name="stop" depends="init,stop-tomcat"
661 description="Shutdown the Tomcat server."/>
662
663 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
664
665
666 <!-- =========== Help targets =================================== -->
667
668 <property name="install-command" value="ant [options] prepare install"/>
669
670 <target name="usage" description="Print a help message">
671 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
672 <echo message=" Execute 'ant -help' for Ant help."/>
673 <echo>
674 To install Greenstone3, run '${install-command}'.
675 There are properties defined in build.properties. The install
676 process will ask you if these properties are set correctly.
677 To avoid this prompt, use the '-Dproperties.accepted=yes'
678 option.
679 To log the output, use the '-logfile build.log' option.
680 The README.txt file has more information about the ant targets
681 and install process.
682 </echo>
683 </target>
684
685 <target name="help" depends="usage" description="Print a help message"/>
686
687 <target name="debug" depends="init" description="Display all the currently used properties">
688 <echoproperties/>
689 </target>
690
691 <!-- ====== initialization and setup targets ================== -->
692
693 <target name="accept-properties" unless="properties.accepted">
694 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
695 tomcat.server=${tomcat.server}
696 tomcat.port=${tomcat.port}
697 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
698 proxy.host=${proxy.host}
699 proxy.port=${proxy.port}
700 disable.collection.building=${disable.collection.building}
701 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
702 </input>
703 <condition property="do.abort">
704 <equals arg1="n" arg2="${properties.ok}"/>
705 </condition>
706 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
707 </target>
708
709 <!-- this sets up some initial properties -->
710 <target name="init">
711
712 <!-- has the gs3-setup script been run?? -->
713 <condition property="gs3-setup-not-done">
714 <not>
715 <isset property="env.GSDL3HOME"/>
716 </not>
717 </condition>
718
719 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
720
721 <condition property="java.too.old">
722 <or>
723 <equals arg1="1.1" arg2="${ant.java.version}"/>
724 <equals arg1="1.2" arg2="${ant.java.version}"/>
725 <equals arg1="1.3" arg2="${ant.java.version}"/>
726 </or>
727 </condition>
728 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
729
730 <available file="${basedir}/gli" property="gli.present"/>
731 <available file="${basedir}/common-src" property="common.src.present"/>
732 <available file="${basedir}/gs2build" property="gs2build.present"/>
733
734 <condition property="tomcat.islocal">
735 <or>
736 <not><isset property="tomcat.installed.path"/></not>
737 <equals arg1="" arg2="${tomcat.installed.path}"/>
738 </or>
739 </condition>
740
741 <echo>tomcat.port = ${tomcat.port}</echo>
742
743 <condition property="proxy.present">
744 <and>
745 <isset property="proxy.host"/>
746 <not><equals arg1="" arg2="${proxy.host}"/></not>
747 </and>
748 </condition>
749
750 <!--
751 the next block checks if the bundled tomcat is present in the 'packages' directory,
752 and checks for the lethal combination of tomcat 7 and java 1.4. Test for
753 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
754 download, as there is no other surefire way to check tomcat version under java 1.4
755 -->
756 <condition property="packages.tomcat.ispresent" value="true" else="false">
757 <available file="packages/tomcat"/>
758 </condition>
759 <condition property="packages.tomcat.istomcat7" value="true" else="false">
760 <available file="packages/tomcat/tomcat7.txt"/>
761 </condition>
762 <if>
763 <bool>
764 <and>
765 <istrue value="${packages.tomcat.ispresent}"/>
766 <istrue value="${packages.tomcat.istomcat7}"/>
767 <equals arg1="1.4" arg2="${ant.java.version}"/>
768 </and>
769 </bool>
770 <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>
771 </if>
772
773 </target>
774
775 <target name="setup-proxy" depends="init" if="proxy.present">
776 <condition property="ask.user">
777 <or>
778 <equals arg1="" arg2="${proxy.user}"/>
779 <equals arg1="" arg2="${proxy.password}"/>
780 </or>
781 </condition>
782
783 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
784 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
785 </target>
786
787 <!-- ========== Web app Targets ================================ -->
788
789 <target name="prepare-web" depends="init">
790 <mkdir dir="${web.home}/applet"/>
791 <mkdir dir="${web.home}/logs"/>
792 <mkdir dir="${web.home}/logs/tmp"/>
793 </target>
794
795 <!-- 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.
796 The test for whether we need it assumes we won't be trying to compile GS3 against Java versions less than 1.4. -->
797 <target name="configure-java-version" depends="init"
798 description="Activates or deactivates some jar libraries as needed depending on your java version">
799
800 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
801 <condition property="need.xalan.jar">
802 <or>
803 <not><equals arg1="1.4" arg2="${ant.java.version}"/></not>
804 </or>
805 </condition>
806
807 <!-- if they have xalan.jar but dont need it -->
808 <if>
809 <bool>
810 <and>
811 <isset property="have.xalan.jar"/>
812 <not><isset property="need.xalan.jar"/></not>
813 </and>
814 </bool>
815 <antcall target="deactivate-xalan-jar"/>
816 </if>
817
818 <!-- if they need xalan.jar but dont have it -->
819 <if>
820 <bool>
821 <and>
822 <not><isset property="have.xalan.jar"/></not>
823 <isset property="need.xalan.jar"/>
824 </and>
825 </bool>
826 <antcall target="activate-xalan-jar"/>
827 </if>
828
829 </target>
830
831 <target name="activate-xalan-jar">
832 <echo>activating xalan.jar</echo>
833 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
834 <if>
835 <bool>
836 <and>
837 <isset property="current.os.ismac"/>
838 <available file="${catalina.home}/common/endorsed" type="dir"/>
839 </and>
840 </bool>
841 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
842 </if>
843 </target>
844
845 <target name="deactivate-xalan-jar">
846 <echo>deactivating xalan.jar</echo>
847 <delete file="${web.lib}/xalan.jar"/>
848 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
849 </target>
850
851
852 <target name="prepare-collections" depends="init"
853 description="Unpack all the collections from their svn zipped versions">
854 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
855 <property name="index.zip" value="index.zip"/>
856
857 <echo message="installing collections..."/>
858 <antcall target="gs2mgdemo-install"/>
859 <antcall target="gs2mgppdemo-install"/>
860 <antcall target="gberg-install"/>
861 <antcall target="lucene-jdbm-demo-install"/>
862 </target>
863
864 <target name="gs2mgdemo-prepare" if="collect.dir">
865 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
866
867 <condition property="gs2mgdemo.present">
868 <and>
869 <available file="${gs2mgdemo.dir}/${index.zip}"/>
870 </and>
871 </condition>
872 </target>
873
874 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
875 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
876 <echo>collection gs2mgdemo installed</echo>
877 </target>
878
879 <target name="gs2mgppdemo-prepare" if="collect.dir">
880 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
881
882 <condition property="gs2mgppdemo.present">
883 <and>
884 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
885 </and>
886 </condition>
887 </target>
888
889 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
890 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
891 <echo>collection gs2mgppdemo installed</echo>
892 </target>
893
894 <target name="gberg-prepare" if="collect.dir">
895 <property name="gberg.dir" value="${collect.dir}/gberg"/>
896 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
897 </target>
898
899 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
900 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
901 <echo>collection gberg installed</echo>
902 </target>
903
904 <target name="lucene-jdbm-demo-prepare" if="collect.dir">
905 <property name="lucene-jdbm-demo.dir" value="${collect.dir}/lucene-jdbm-demo"/>
906 <available file="${lucene-jdbm-demo.dir}/${index.zip}" property="lucene-jdbm-demo.present"/>
907 </target>
908
909 <target name="lucene-jdbm-demo-install" if="lucene-jdbm-demo.present" depends="lucene-jdbm-demo-prepare">
910 <unzip dest="${lucene-jdbm-demo.dir}" src="${lucene-jdbm-demo.dir}/${index.zip}"/>
911 <echo>collection lucene-jdbm-demo installed</echo>
912 </target>
913
914 <target name="configure-web" depends="init,perl-for-building"
915 description="Configure only the web app config files">
916 <!-- we want a unix path in the global.properties file -->
917 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
918 <path path="${web.home}"/>
919 </pathconvert>
920 <stringutil string="${perl.path}" property="escaped.perl.path">
921 <replace regex="\\" replacement="\\\\" />
922 </stringutil>
923
924 <filter token="gsdlhome" value="${gs2build.home}"/>
925 <filter token="gsdl3srchome" value="${basedir}"/>
926 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
927 <filter token="gsdl3version" value="${app.version}"/>
928 <filter token="tomcat.server" value="${tomcat.server}"/>
929 <filter token="tomcat.port" value="${tomcat.port}"/>
930 <filter token="perlpath" value="${escaped.perl.path}"/>
931 <filter token="disable.collection.building" value="${disable.collection.building}"/>
932 <copy file="${basedir}/web/WEB-INF/cgi/gsdl3site.cfg.in" tofile="${basedir}/web/WEB-INF/cgi/gsdl3site.cfg" filtering="true" overwrite="true"/>
933 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
934 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
935 <chmod file="${web.classes}/global.properties" perm="600"/>
936 <chmod file="${web.classes}/log4j.properties" perm="600"/>
937 </target>
938
939 <target name="compile-web" depends="init">
940 <javac srcdir="${web.classes}"
941 destdir="${web.classes}"
942 debug="${compile.debug}"
943 deprecation="${compile.deprecation}"
944 optimize="${compile.optimize}">
945 <classpath><path refid="compile.classpath"/></classpath>
946 </javac>
947 </target>
948
949 <target name="compile-classpath-jars" depends="init">
950 <if><bool><available file="admin/cp.mf"/></bool>
951 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
952 </if>
953 <if><bool><available file="${lib.java}/cp.mf"/></bool>
954 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
955 </if>
956 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
957 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
958 </if>
959 <if><bool><available file="${web.lib}/cp.mf"/></bool>
960 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
961 </if>
962 <jar destfile="cp.jar">
963 <manifest>
964 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
965 </manifest>
966 </jar>
967 </target>
968
969 <target name="clean-classpath-jars" depends="init">
970 <delete file="admin/cp.jar"/>
971 <delete file="${lib.java}/cp.jar"/>
972 <delete file="${lib.jni}/cp.jar"/>
973 <delete file="${web.lib}/cp.jar"/>
974 <delete file="cp.jar"/>
975 </target>
976
977
978 <target name="svnupdate-web" unless="nosvn.mode">
979 <exec executable="svn">
980 <arg value="update"/>
981 <arg value="${web.home}"/>
982 <arg value="-r"/><arg value="${branch.revision}"/>
983 </exec>
984 </target>
985
986 <target name="update-web" depends="init,svnupdate-web,configure-web"
987 description="update only the web stuff (config files)"/>
988
989 <!-- ======================= Tomcat Targets ========================== -->
990
991 <!-- this target downloads and installs Tomcat -->
992 <!-- we download tomcat (version 7 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
993 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
994 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">
995 <if>
996 <bool>
997 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
998 </bool>
999
1000 <!-- check that packages dir is there -->
1001 <mkdir dir="${packages.home}"/>
1002 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
1003 dest="${packages.home}/${tomcat.version}.zip"
1004 usetimestamp="true"/>
1005 <unzip src="${packages.home}/${tomcat.version}.zip"
1006 dest="${packages.home}"/>
1007
1008 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
1009 we would need to have the tomcat compat package to work with Java 1.4-->
1010 <if>
1011 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
1012 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
1013 dest="${packages.home}/${tomcat.version}-compat.zip"
1014 usetimestamp="true"/>
1015 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
1016 dest="${packages.home}"/>
1017 </if>
1018
1019 <!-- delete any existing tomcat -->
1020 <delete dir="${packages.home}/tomcat"/>
1021 <move todir="${packages.home}/tomcat">
1022 <fileset dir="${packages.home}/${tomcat.version}"/>
1023 </move>
1024 <!--
1025 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
1026 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
1027 overwrite="true"/>
1028 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
1029 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
1030 overwrite="true"/>
1031 -->
1032 <!-- make sure we have execute permission for the .sh files -->
1033 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
1034 includes="*.sh"/>
1035
1036 <echo file="${packages.home}/tomcat/.flagfile">
1037 the timestamp of this file is the time that tomcat was extracted from the zip files.
1038 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
1039 </echo>
1040
1041 <!-- this is not strictly a prepare tomcat thing, but if one changes
1042 Java, then they need to change tomcat as well, so might as well call
1043 it here -->
1044 <antcall target="configure-java-version"/>
1045 <else>
1046 <echo>Tomcat has been prepared, will not prepare</echo>
1047 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
1048 </else>
1049
1050 </if>
1051
1052 </target>
1053
1054 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1055
1056 <target name="configure-tomcat-local" depends="init,perl-for-building" if="tomcat.islocal">
1057 <!-- re-setup the server.xml file -->
1058 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
1059 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
1060 <filterset>
1061 <filter token="port" value="${tomcat.port}"/>
1062 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
1063 </filterset>
1064 </copy>
1065 <!-- set up the greenstone3 context -->
1066 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
1067 <filterset>
1068 <filter token="gsdl3webhome" value="${web.home}"/>
1069 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
1070 </filterset>
1071 </copy>
1072
1073 <!-- set up the greenstone3 web.xml file -->
1074 <copy file="${basedir}/resources/tomcat/web.xml" tofile="${packages.home}/tomcat/conf/web.xml" overwrite="true">
1075 <filterset>
1076 <filter token="perlpath" value="${perl.path}"/>
1077 </filterset>
1078 </copy>
1079 </target>
1080
1081 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
1082 <!-- re-setup the server.xml file -->
1083 <!-- need to edit the config file, or do we get the user to do this???-->
1084 </target>
1085
1086
1087
1088<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
1089 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
1090 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
1091 <property name="tomcat.path" refid="local.tomcat.path"/>
1092 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
1093
1094 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
1095 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
1096
1097 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1098 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1099 <env key="GSDL3HOME" value="${basedir}"/>
1100 <env key="PATH" path="${tomcat.path}"/>
1101 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1102 <env key="CATALINA_HOME" value="${catalina.home}"/>
1103 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1104 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
1105 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
1106 <env key="WNHOME" path="${wn.home}"/>
1107 </exec>
1108 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
1109 <env key="GSDLOS" value="windows"/>
1110 <env key="GSDL3HOME" value="${basedir}"/>
1111 <env key="Path" path="${tomcat.path}"/>
1112 <env key="PATH" path="${tomcat.path}"/>
1113 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1114 <env key="CATALINA_HOME" value="${catalina.home}"/>
1115 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1116 </exec>
1117 <!-- wait for the server to startup in case other targets need it running -->
1118 <waitfor maxwait="5" maxwaitunit="second">
1119 <and>
1120 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1121 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
1122 </and>
1123 </waitfor>
1124 </target>
1125
1126 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
1127 <target name="reconfigure" description="Reconfigure the message router">
1128 <waitfor maxwait="5" maxwaitunit="second">
1129 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
1130 </waitfor>
1131 </target>
1132
1133 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
1134 <target name="reconfigure-collection" description="Reconfigure the collection">
1135 <waitfor maxwait="5" maxwaitunit="second">
1136 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
1137 </waitfor>
1138 </target>
1139
1140 <!-- windows: do we want to launch a webrowser?? -->
1141 <!-- shouldn't this test whether anything is running first?
1142 It's safer to always attempt to stop tomcat: that way we won't be dependent on the right time
1143 to check whether the server is stopped or still running before attempting to start again.
1144 This target, which was recently called force-stop-tomcat for a while but is back to being
1145 called stop-tomcat, now hides the Java exception output that appears whenever tomcat is already
1146 stopped as happens when stop-tomcat is called consecutively. -->
1147 <target name="force-stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
1148 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1149 <env key="CATALINA_HOME" value="${catalina.home}"/>
1150 <arg line=">/dev/null 2>&amp;1"/>
1151 </exec>
1152 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
1153 <env key="CATALINA_HOME" value="${catalina.home}"/>
1154 <arg line=">nul 2>&amp;1"/>
1155 </exec>
1156 </target>
1157
1158 <!-- Can also try the "socket" condition in place of the "http" condition
1159 And also use a <waitfor> in place of <condition>, such as:
1160 <waitfor maxwait="5" maxwaitunit="second" timeoutproperty="tomcat.isstopped"><http url="..."/></waitfor>
1161 The http URL resolves to host:port/greenstone3
1162 Condition uses <http/> rather than <socket/> for testing, since if the server was stopped, the socket
1163 might still be in use for some moments. We test the URL with the http condition since it's likelier to
1164 fail sooner if the server has indeed been stopped. -->
1165 <target name="check-tomcat-running">
1166 <condition property="tomcat.isrunning">
1167 <http url="http://${tomcat.server}:${tomcat.port}${app.path}"/>
1168 </condition>
1169 </target>
1170
1171 <!-- stop-tomcat checks if the tomcat server is already running. If it appears to be running
1172 (regardless of whether tomcat was just starting to shut down), this target calls force-stop-tomcat
1173 to issue the shutdown command to tomcat. Then it waits for at most 15 seconds for the server to
1174 actually stop by checking the socket at which tomcat listens every second, printing a warning
1175 at the end of the max wait time of 15 seconds if tomcat was still running. -->
1176 <target name="stop-tomcat" description="Shutdown only Tomcat if running" depends="check-tomcat-running" if="tomcat.isrunning">
1177 <antcall target="force-stop-tomcat"/>
1178
1179 <property name="wait.numchecks" value="15"/>
1180 <echo>Waiting for the server to shutdown... (${wait.numchecks} seconds max)</echo>
1181 <waitfor maxwait="${wait.numchecks}" maxwaitunit="second" checkevery="1" checkeveryunit="second" timeoutproperty="tomcat.timedout">
1182 <not><socket server="${tomcat.server}" port="${tomcat.port}"/></not>
1183 </waitfor>
1184
1185 <if>
1186 <bool>
1187 <isset property="${tomcat.timedout}"/>
1188 </bool>
1189 <property name="tomcat.isrunning" value="true"/>
1190 <echo>WARNING: Checked the socket ${wait.numchecks} times, but port ${tomcat.port} is still busy.</echo>
1191 <else>
1192 <echo>Tomcat is stopped.</echo>
1193 <property name="tomcat.isrunning" value="false"/>
1194 </else>
1195 </if>
1196 </target>
1197
1198 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
1199
1200 <target name="setup-catalina-ant-tasks">
1201 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
1202 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
1203 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1204 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
1205 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1206 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
1207 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1208 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
1209 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1210 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
1211 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1212 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
1213 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1214 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
1215 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1216 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
1217 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1218 </target>
1219
1220 <!-- http://blog.andrewbeacock.com/2007/11/how-to-truncate-log-file-using-ubuntu.html
1221 Doing "cat </dev/null > packages/tomcat/logs/catalina.out" doesn't work as an ant target.
1222 It seems to have a problem with cat or </dev/null, with or without the < sign. -->
1223 <target name="clean-logs" description="Empties catalina.out, greenstone.log and contents of web/logs/tmp">
1224 <echo>Truncating catalina.out, greenstone.log and server.log, and emptying ${web.home}/logs/tmp</echo>
1225 <exec executable="rm" os="${os.unix}" dir="${catalina.home}/logs" spawn="false">
1226 <arg value="-f"/>
1227 <arg value="catalina.out"/>
1228 </exec>
1229 <exec executable="rm" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1230 <arg value="-f"/>
1231 <arg value="greenstone.log"/>
1232 </exec>
1233 <exec executable="rm" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1234 <arg value="-f"/>
1235 <arg value="server.log"/>
1236 </exec>
1237
1238 <exec executable="touch" os="${os.unix}" dir="${catalina.home}/logs"
1239 spawn="false">
1240 <arg value="catalina.out"/>
1241 </exec>
1242 <exec executable="touch" os="${os.unix}" dir="${web.home}/logs"
1243 spawn="false">
1244 <arg value="greenstone.log"/>
1245 </exec>
1246 <exec executable="touch" os="${os.unix}" dir="${web.home}/logs"
1247 spawn="false">
1248 <arg value="server.log"/>
1249 </exec>
1250
1251 <exec executable="cmd" os="${os.windows}" dir="${catalina.home}/logs" spawn="false">
1252 <arg line="/c echo. > catalina.out"/>
1253 </exec>
1254 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1255 <arg line="/c echo. > greenstone.log"/>
1256 </exec>
1257 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1258 <arg line="/c echo. > server.log"/>
1259 </exec>
1260
1261 <if>
1262 <bool><available file="${web.home}/logs/tmp" type="dir"/></bool>
1263 <delete>
1264 <fileset dir="${web.home}/logs/tmp" includes="**/*"/>
1265 </delete>
1266 </if>
1267 </target>
1268
1269 <!-- ======================= ant Targets ============================ -->
1270 <target name="prepare-ant" depends="init">
1271 <if>
1272 <bool>
1273 <not><available file="${packages.home}/ant/.flagfile"/></not>
1274 </bool>
1275
1276 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1277 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1278 usetimestamp="true"/>
1279 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1280 dest="${packages.home}"/>
1281 <move todir="${packages.home}/ant">
1282 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1283 </move>
1284 <echo file="${packages.home}/ant/.flagfile">
1285 the timestamp of this file is the time that ant was extracted from the zip files.
1286 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1287 </echo>
1288
1289 <else>
1290 <echo>Ant has been prepared, will not prepare</echo>
1291 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1292 </else>
1293
1294 </if>
1295 </target>
1296
1297 <!-- ======================= Admin Targets ============================ -->
1298
1299 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1300 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1301 But you can do: echo mypassword | ant config-admin -->
1302 <target name="config-admin" description="Reset admin password">
1303 <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-8 characters):&gt;">
1304 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1305 </input>
1306 <!--<echo>PWD: ${admin.password}</echo>-->
1307 <antcall target="update-userdb">
1308 <param name="user.username" value="admin"/>
1309 <param name="user.password" value="${admin.password}"/>
1310 <param name="user.groups" value=""/>
1311 <param name="user.status" value=""/>
1312 <param name="user.comment" value="Password updated."/>
1313 <param name="user.email" value=""/>
1314 </antcall>
1315 </target>
1316
1317 <target name="config-user" description="Add or modify users" depends="get-user-data,update-userdb"/>
1318
1319 <target name="get-user-data" description="Get user details">
1320 <input addproperty="user.username" message="Username:&gt;"/>
1321 <input addproperty="user.password" defaultvalue="" message="Password (3-8 characters):&gt;">
1322 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1323 </input>
1324 <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list):&gt;"/>
1325 <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
1326 <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
1327 <input addproperty="user.email" defaultvalue="" message="Email:&gt;"/>
1328 </target>
1329
1330<!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1331 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1332 But you can do: echo mypassword | ant config-admin -->
1333 <target name="update-userdb" description="Add or modify users" depends="check-tomcat-running">
1334
1335 <!-- stop tomcat if running, since derby db is embedded and only allows connections from one jvm instance at a time
1336 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
1337 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
1338 <if>
1339 <bool>
1340 <istrue value="${tomcat.isrunning}"/>
1341 </bool>
1342 <antcall target="stop-tomcat"/>
1343 </if>
1344
1345 <!--<echo>${admin.password}</echo>--> <!-- for testing -->
1346 <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
1347 <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
1348 <arg file="${web.home}/sites/localsite/etc/usersDB"/>
1349 <arg value="${user.username}"/>
1350 <arg value="password=${user.password}"/>
1351 <arg value="groups=${user.groups}"/>
1352 <arg value="status=${user.status}"/>
1353 <arg value="comment=${user.comment}"/>
1354 <arg value="email=${user.email}"/>
1355 </java>
1356
1357 <!-- run tomcat again if it used to be running -->
1358 <if>
1359 <bool>
1360 <istrue value="${tomcat.isrunning}"/>
1361 </bool>
1362 <antcall target="start-tomcat"/>
1363 </if>
1364 </target>
1365
1366
1367 <!-- ======================= Axis Targets ============================ -->
1368
1369 <target name="prepare-axis" depends="init">
1370
1371 <if>
1372 <bool>
1373 <not><available file="${packages.home}/axis/.flagfile"/></not>
1374 </bool>
1375
1376 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1377 dest="${packages.home}/${axis.zip.version}"
1378 usetimestamp="true"/>
1379 <unzip src="${packages.home}/${axis.zip.version}"
1380 dest="${packages.home}"/>
1381 <move todir="${packages.home}/axis">
1382 <fileset dir="${packages.home}/${axis.dir.version}"/>
1383 </move>
1384 <!-- install axis into greenstone web app -->
1385 <copy todir="${web.lib}">
1386 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1387 <include name="*.jar"/>
1388 </fileset>
1389 </copy>
1390 <copy todir="${web.home}">
1391 <fileset dir="${packages.home}/axis/webapps/axis/">
1392 <include name="*.jsp"/>
1393 <include name="*.jws"/>
1394 </fileset>
1395 </copy>
1396 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1397 <copy todir="${web.classes}">
1398 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1399 <include name="*.properties"/>
1400 </fileset>
1401 </copy>
1402 <echo file="${packages.home}/axis/.flagfile">
1403 the timestamp of this file is the time that axis was extracted from the zip files.
1404 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1405 </echo>
1406
1407 <else>
1408 <echo>Axis has been prepared, will not prepare</echo>
1409 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1410 </else>
1411
1412 </if>
1413 </target>
1414
1415 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
1416 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
1417
1418 <target name="deploy-site">
1419 <java classname="org.apache.axis.client.AdminClient">
1420 <classpath refid="compile.classpath"/>
1421 <arg value="-l"/>
1422 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1423 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1424 </java>
1425 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
1426 </target>
1427
1428 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
1429 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
1430 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1431 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1432 tofile="${basedir}/resources/soap/undeploy.wsdd"
1433 filtering="true"
1434 overwrite="true"/>
1435 <java classname="org.apache.axis.client.AdminClient">
1436 <classpath refid="compile.classpath"/>
1437 <arg value="-l"/>
1438 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1439 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
1440 </java>
1441 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
1442 </target>
1443
1444 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1445 with the default servicename of localsite-->
1446 <target name="deploy-localsite" depends="init"
1447 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1448 <antcall target="start-tomcat"/>
1449 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
1450 <antcall target="create-deployment-files">
1451 <param name="axis.sitename" value="localsite"/>
1452 <param name="axis.servicesname" value="${base.webservice.name}"/>
1453 <param name="axis.siteuri" value="localsite"/>
1454 </antcall>
1455 <antcall target="deploy-site">
1456 <param name="axis.sitename" value="localsite"/>
1457 <param name="axis.servicesname" value="${base.webservice.name}"/>
1458 <param name="axis.siteuri" value="localsite"/>
1459 </antcall>
1460 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
1461 </target>
1462
1463 <target name="get-sitename" unless="axis.sitename">
1464 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
1465Press Enter for default:localsite</input>
1466 </target>
1467
1468 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1469 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1470To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1471Or press Enter for undeploying the default:localsite /&gt;</input>
1472 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1473 </target>
1474
1475 <target name="get-webservices" unless="axis.servicesname">
1476 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1477Choose from: ${web.services.list}
1478Or press Enter for default:${base.webservice.name} /&gt;</input>
1479 <echo>${axis.servicesname}</echo>
1480 </target>
1481
1482 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1483 <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>
1484 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1485 </target>
1486
1487 <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">
1488 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1489 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1490 </condition>
1491
1492 <!--everything else defaults to java:RPC at present-->
1493 <condition property="soap.method" value="provider='java:RPC'">
1494 <not>
1495 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1496 </not>
1497 </condition>
1498 </target>
1499
1500 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1501 <filter token="sitename" value="${axis.sitename}"/>
1502 <filter token="siteuri" value="${axis.siteuri}"/>
1503 <filter token="servicesname" value="${axis.servicesname}"/>
1504 <filter token="soapmethod" value="${soap.method}"/>
1505 <copy file="${basedir}/resources/soap/site.wsdd.template"
1506 tofile="${basedir}/resources/soap/deploy.wsdd"
1507 filtering="true"
1508 overwrite="true"/>
1509 <!-- create the java files and compile them -->
1510 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1511 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1512 filtering="true"
1513 overwrite="true"/>
1514 <mkdir dir="${build.home}"/>
1515 <javac srcdir="${src.home}"
1516 destdir="${build.home}"
1517 debug="${compile.debug}"
1518 deprecation="${compile.deprecation}"
1519 optimize="${compile.optimize}">
1520 <classpath refid="compile.classpath"/>
1521 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1522 </javac>
1523 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1524 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1525 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1526 overwrite="true" />
1527 </target>
1528
1529
1530 <!-- ====================== Core targets ============================== -->
1531 <!-- core targets refer to the core gsdl3 java src -->
1532
1533 <target name="prepare-core"/>
1534
1535 <target name="configure-core"/>
1536
1537 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1538 description="Update only the Greenstone core" />
1539
1540 <target name="svnupdate-core" unless="nosvn.mode">
1541 <exec executable="svn">
1542 <arg value="update"/>
1543 <arg value="${basedir}"/>
1544 <arg value="-r"/><arg value="${branch.revision}"/>
1545 </exec>
1546 </target>
1547
1548 <target name="clean-core"
1549 description="Clean only the Greenstone core">
1550 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1551 <delete dir="${build.home}"/>
1552 </target>
1553
1554 <target name="compile-core" depends="init"
1555 description="Compile only the Greenstone core">
1556 <mkdir dir="${build.home}"/>
1557
1558 <if><bool><isset property="with.jni"/></bool>
1559 <javac srcdir="${src.home}"
1560 destdir="${build.home}"
1561 debug="${compile.debug}"
1562 deprecation="${compile.deprecation}"
1563 optimize="${compile.optimize}">
1564 <classpath>
1565 <path refid="compile.classpath"/>
1566 </classpath>
1567 </javac>
1568 <else>
1569 <property name="gsprefix" value=""/>
1570 <javac srcdir="${src.home}"
1571 destdir="${build.home}"
1572 debug="${compile.debug}"
1573 deprecation="${compile.deprecation}"
1574 optimize="${compile.optimize}">
1575 <classpath>
1576 <path refid="compile.classpath"/>
1577 </classpath>
1578 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1579 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1580 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1581 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1582 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1583 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1584 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1585 </javac>
1586 </else>
1587 </if>
1588 <jar destfile="${build.home}/gsdl3.jar">
1589 <fileset dir="${build.home}">
1590 <include name="org/greenstone/gsdl3/**"/>
1591 <include name="org/flax/**"/>
1592 <exclude name="**/Test.class"/>
1593 </fileset>
1594 <manifest>
1595 <attribute name="Built-By" value="${user.name}" />
1596 </manifest>
1597 </jar>
1598 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1599
1600 <jar destfile="${build.home}/gutil.jar">
1601 <fileset dir="${build.home}">
1602 <include name="org/greenstone/util/**"/>
1603 </fileset>
1604 <manifest>
1605 <attribute name="Built-By" value="${user.name}" />
1606 </manifest>
1607 </jar>
1608 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1609
1610 <!-- copy the localsite server in case we need it -->
1611 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1612
1613 <!-- Greenstone Administrator Interface -->
1614 <jar destfile="${build.home}/GAI.jar">
1615 <fileset dir="${build.home}">
1616 <include name="org/greenstone/admin/**"/>
1617 </fileset>
1618 <manifest>
1619 <attribute name="Built-By" value="${user.name}" />
1620 </manifest>
1621 </jar>
1622 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1623 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1624 <jar destfile="${build.home}/phind.jar">
1625 <fileset dir="${build.home}">
1626 <include name="org/greenstone/applet/phind/**"/>
1627 </fileset>
1628 <manifest>
1629 <attribute name="Built-By" value="${user.name}" />
1630 </manifest>
1631 </jar>
1632 <mkdir dir="${web.applet}"/>
1633 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1634 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1635 <if>
1636 <bool><istrue value="${tomcat.islocal}"/></bool>
1637 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1638 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1639 </if>
1640
1641
1642 <!-- skip anttasks for now
1643 <jar destfile="${build.home}/anttasks.jar">
1644 <fileset dir="${build.home}">
1645 <include name="org/greenstone/anttasks/**"/>
1646 </fileset>
1647 <manifest>
1648 <attribute name="Built-By" value="${user.name}" />
1649 </manifest>
1650 </jar>
1651 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1652 <jar destfile="${build.home}/gsdl3test.jar">
1653 <fileset dir="${build.home}">
1654 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1655 <include name="org/greenstone/testing/**"/>
1656 </fileset>
1657 <manifest>
1658 <attribute name="Built-By" value="${user.name}" />
1659 </manifest>
1660 </jar>
1661 <jar destfile="${build.home}/server.jar">
1662 <fileset dir="${build.home}">
1663 <include name="org/greenstone/server/**"/>
1664 <include name="org/greenstone/util/**"/>
1665 </fileset>
1666 <fileset file="${basedir}/resources/java/server.properties"/>
1667 <manifest>
1668 <attribute name="Built-By" value="${user.name}"/>
1669 </manifest>
1670 </jar>
1671 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1672 </target>
1673
1674 <!-- ================== Packages targets ================================ -->
1675 <!-- these targets refer to the greenstone source packages - these need
1676 updating less often, so are in separate targets to the core -->
1677 <target name="prepare-packages" depends="init"/>
1678
1679 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1680 description="Update only the source packages"/>
1681
1682 <target name="svnupdate-packages" unless="nosvn.mode">
1683 <exec executable="svn">
1684 <arg value="update"/>
1685 <arg value="${src.packages.home}"/>
1686 <arg value="-r"/><arg value="${branch.revision}"/>
1687 </exec>
1688 </target>
1689
1690
1691 <target name="configure-packages" depends="init,configure-javagdbm"
1692 description="Configure only the packages."/>
1693
1694 <target name="configure-javagdbm" if="with.jni">
1695 <echo>
1696 Configuring JavaGDBM
1697 </echo>
1698
1699 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1700 <arg value="--prefix=${basedir}"/>
1701 <arg value="--libdir=${lib.jni}"/>
1702 <arg value="--with-gdbm=${gdbm.home}"/>
1703 </exec>
1704 </target>
1705
1706 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1707
1708 <target name="clean-javagdbm" depends="init">
1709 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
1710 <exec executable="make" os="${os.unix}"
1711 dir="${javagdbm.home}" failonerror="true">
1712 <arg value="clean"/>
1713 </exec>
1714 </if>
1715 </target>
1716
1717 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1718
1719 <target name="distclean-javagdbm" depends="init">
1720 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
1721 <exec executable="make" os="${os.unix}"
1722 dir="${javagdbm.home}" failonerror="true">
1723 <arg value="distclean"/>
1724 </exec>
1725 </if>
1726 </target>
1727
1728 <target name="compile-packages" description="Compile only the source packages">
1729 <!-- javagdbm -->
1730 <antcall target="compile-javagdbm"/>
1731 <!-- Search4j -->
1732 <antcall target="compile-search4j"/>
1733 </target>
1734
1735 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
1736
1737 <!-- unix: -->
1738 <echo>compile javagdbm</echo>
1739 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1740 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1741 <arg value="install"/>
1742 </exec>
1743
1744 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1745 "all" which will then perform both the compile AND link targets in jni/win32.mak
1746 (thereby also generating gdbmjava.dll). Then we run the same command with
1747 the "install" argument to copy the gdbmjava.dll into the correct location. -->
1748 <echo>Windows: compile javagdbm</echo>
1749 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1750 <env key="GSDL3SRCHOME" path="${basedir}"/>
1751 </exec>
1752 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1753 <env key="GSDL3SRCHOME" path="${basedir}"/>
1754 <arg value="install"/>
1755 </exec>
1756
1757 <!-- install the jar file -->
1758 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
1759 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1760 </target>
1761
1762 <target name="compile-search4j">
1763
1764 <!-- windows -->
1765 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1766 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1767 <arg value="/f"/>
1768 <arg value="win32.mak"/>
1769 <arg value='BINDIR="${basedir}\bin"'/>
1770 </exec>
1771 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1772 <arg value="/f"/>
1773 <arg value="win32.mak"/>
1774 <arg value="install"/>
1775 <arg value='BINDIR="${basedir}\bin"'/>
1776 </exec>
1777
1778 <!-- unix -->
1779 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1780 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1781 <arg value="--bindir=${basedir}/bin"/>
1782 <arg value="${static.arg}"/>
1783 </exec>
1784 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1785 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1786 <arg value="install"/>
1787 </exec>
1788
1789 <!-- else warn -->
1790 <else>
1791 <fail>this target does not support the current os</fail>
1792
1793 </else></if></else></if>
1794
1795 </target>
1796
1797 <target name="install-auxiliary-jar-files" depends="init">
1798
1799 <if>
1800 <bool><available file="${mg.home}/mg.jar"/></bool>
1801 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1802 </if>
1803
1804 <if>
1805 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
1806 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1807 </if>
1808
1809 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${web.lib}"/>
1810 </target>
1811
1812 <target name="install-jni-files" depends="init" if="with.jni">
1813 <antcall target="install-jni-files-linux"/>
1814 <antcall target="install-jni-files-windows"/>
1815 <antcall target="install-jni-files-macos"/>
1816 </target>
1817
1818 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1819 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1820 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1821 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1822 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1823 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1824 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1825 </target>
1826 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1827 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1828 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1829 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1830 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1831 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1832 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1833 </target>
1834 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1835 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1836 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1837 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1838 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1839 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1840 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1841 </target>
1842
1843 <!-- ========common-src targets =================================-->
1844 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1845 collection building is not enabled -->
1846
1847 <target name="update-common-src" depends="init" if="collection.building.disabled">
1848 </target>
1849
1850 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1851 <exec executable="svn">
1852 <arg value="update"/>
1853 <arg value="${common.src.home}"/>
1854 <arg value="-r"/><arg value="${branch.revision}"/>
1855 </exec>
1856 </target>
1857
1858 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1859 <antcall target="checkout-common-src"/>
1860 <antcall target="unzip-windows-packages"/>
1861 </target>
1862
1863 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1864 <echo>checking out common-src</echo>
1865 <exec executable="svn">
1866 <arg value="checkout"/>
1867 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
1868 <arg value="common-src"/>
1869 <arg value="-r"/><arg value="${branch.revision}"/>
1870 </exec>
1871 </target>
1872
1873 <target name="configure-common-src" depends="init">
1874 <exec executable="${common.src.home}/configure" os="${os.unix}"
1875 dir="${common.src.home}" failonerror="true">
1876 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1877 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1878 <arg line="${gs2.opt.args}"/>
1879 <arg line="${static.arg}"/>
1880 <arg line="${allargs}"/>
1881 </exec>
1882 </target>
1883
1884 <target name="clean-common-src" depends="init">
1885 <!-- unix: -->
1886 <if><bool><available file="${common.src.home}/Makefile"/></bool>
1887 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1888 <arg value="clean"/>
1889 </exec>
1890 </if>
1891 <!-- windows: -->
1892 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1893 <arg value="/f"/>
1894 <arg value="win32.mak"/>
1895 <arg value="clean"/>
1896 <arg value="GSDLHOME=${gs2build.home}"/>
1897 </exec>
1898 </target>
1899 <target name="distclean-common-src" depends="init">
1900 <!-- unix: -->
1901 <if><bool><available file="${common.src.home}/Makefile"/></bool>
1902 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1903 <arg value="distclean"/>
1904 </exec>
1905 </if>
1906 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1907 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1908 <arg value="/f"/>
1909 <arg value="win32.mak"/>
1910 <arg value="clean"/>
1911 <arg value="GSDLHOME=${gs2build.home}"/>
1912 </exec>
1913 </target>
1914 <target name="compile-common-src" depends="init">
1915 <!-- unix: -->
1916 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1917 <arg value="${gs2.compile.target}"/>
1918 </exec>
1919 <!-- windows: -->
1920 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1921 <arg value="/f"/>
1922 <arg value="win32.mak"/>
1923 <arg value="GSDLHOME=${gs2build.home}"/>
1924 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1925 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1926 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1927 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1928 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1929 </exec>
1930 </target>
1931
1932 <!-- ======= collection-building targets ===========================-->
1933
1934 <target name="update-collection-building" if="collection.building.enabled"
1935 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"
1936 description="Update (SVN update, configure, compile etc) only the collection building components"/>
1937
1938 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1939 description="SVN update the collection building components">
1940 </target>
1941
1942 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1943 </target>
1944
1945 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1946 description="Configure the collection building components">
1947 </target>
1948
1949 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1950 description="Clean only the collection building components"
1951 if="collection.building.enabled"/>
1952
1953 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1954 description="Distclean only the collection building components"
1955 if="collection.building.enabled"/>
1956
1957 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1958 description="Compile only the collection building components">
1959 <!-- make install for common-src -->
1960 <!-- unix: -->
1961 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1962 <arg value="${gs2.install.target}"/>
1963 </exec>
1964
1965 <!-- windows: -->
1966 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1967 <arg value="/f"/>
1968 <arg value="win32.mak"/>
1969 <arg value="install"/>
1970 <arg value="GSDLHOME=${gs2build.home}"/>
1971 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1972 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1973 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1974 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1975 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1976 <!--
1977 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1978 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
1979 </exec>
1980
1981 <!-- install gs2build indexers for windows -->
1982 <if>
1983 <bool><istrue value="${current.os.iswindows}"/></bool>
1984 <copy todir="${gs2build.home}/bin/windows">
1985 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1986 <include name="*.*"/>
1987 </fileset>
1988 </copy>
1989 </if>
1990
1991 <!-- LuceneWrapper jar file not installed by default -->
1992 <mkdir dir="${gs2build.home}/bin/java"/>
1993 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${gs2build.home}/bin/java"/>
1994
1995 </target>
1996
1997 <!-- ============== gli targets ================================= -->
1998 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1999
2000 <exec executable="svn">
2001 <arg value="update"/>
2002 <arg value="${gli.home}"/>
2003 <arg value="-r"/><arg value="${branch.revision}"/>
2004 </exec>
2005
2006 <exec executable="svn" dir="web/WEB-INF/cgi">
2007 <arg value="export"/>
2008 <arg value="-r"/><arg value="${branch.revision}"/>
2009 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
2010 </exec>
2011 <exec executable="svn" dir="web/WEB-INF/cgi">
2012 <arg value="export"/>
2013 <arg value="-r"/><arg value="${branch.revision}"/>
2014 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
2015 </exec>
2016
2017 </target>
2018
2019 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
2020 <!-- checkout -->
2021 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
2022
2023 <exec executable="svn">
2024 <arg value="checkout"/>
2025 <arg value="${svn.root}/main/${branch.path}/gli"/>
2026 <arg value="-r"/><arg value="${branch.revision}"/>
2027 </exec>
2028
2029 <exec executable="svn" dir="web/WEB-INF/cgi">
2030 <arg value="export"/>
2031 <arg value="-r"/><arg value="${branch.revision}"/>
2032 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
2033 </exec>
2034 <exec executable="svn" dir="web/WEB-INF/cgi">
2035 <arg value="export"/>
2036 <arg value="-r"/><arg value="${branch.revision}"/>
2037 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
2038 </exec>
2039
2040 </if>
2041 </target>
2042
2043 <target name="clean-gli" depends="init" if="collection.building.enabled">
2044 <!-- gli -->
2045 <property name="gli.home" value="${basedir}/gli"/>
2046 <!-- linux -->
2047 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
2048 resolveExecutable="true" failonerror="true"/>
2049 <!-- windows -->
2050 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
2051 resolveExecutable="true" failonerror="true"/>
2052 </target>
2053
2054 <target name="compile-gli" depends="init" if="collection.building.enabled">
2055 <if><bool><isset property="with.gli.and.gems"/></bool>
2056 <!-- gli -->
2057 <property name="gli.home" value="${basedir}/gli"/>
2058
2059 <!-- linux -->
2060 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2061 <!--remote gli-->
2062 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
2063 resolveExecutable="true" failonerror="true"/>
2064 <!-- windows -->
2065 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2066 <!--remote gli-->
2067 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
2068 resolveExecutable="true" failonerror="true"/>
2069 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
2070 </if>
2071 </target>
2072
2073 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
2074 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
2075 <env key="gsdl3path" path="${basedir}"/>
2076 <env key="gsdlpath" path="${gs2build.home}"/>
2077 </exec>
2078 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
2079 <env key="gsdl3path" path="${basedir}"/>
2080 <env key="gsdlpath" path="${gs2build.home}"/>
2081 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
2082 </exec>
2083 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
2084 <env key="GSDL3PATH" path="${basedir}"/>
2085 <env key="GSDLPATH" path="${gs2build.home}"/>
2086 </exec>
2087 <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.
2088 </echo>
2089 </target>
2090
2091 <!-- ================ gs2build targets =========================== -->
2092
2093 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
2094 <echo>svn updating gs2build</echo>
2095 <exec executable="svn">
2096 <arg value="update"/>
2097 <arg value="${gs2build.home}"/>
2098 <arg value="-r"/><arg value="${branch.revision}"/>
2099 </exec>
2100 </target>
2101
2102 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
2103 <antcall target="checkout-gs2build"/>
2104 <antcall target="unzip-windows-packages"/>
2105 <antcall target="checkout-winbin"/>
2106 <antcall target="get-windows-binaries"/>
2107 <antcall target="delete-winbin"/>
2108 </target>
2109
2110 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
2111 <echo>checking out gs2build</echo>
2112 <exec executable="svn">
2113 <arg value="checkout"/>
2114 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
2115 <arg value="-r"/><arg value="${branch.revision}"/>
2116 </exec>
2117
2118
2119 </target>
2120
2121 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
2122 unless="nosvn.mode">
2123
2124 <exec executable="svn">
2125 <arg value="checkout"/>
2126 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
2127 <arg value="-r"/><arg value="${branch.revision}"/>
2128 <arg value="winbin"/>
2129 </exec>
2130
2131 </target>
2132
2133 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
2134 <exec executable="svn">
2135 <arg value="update"/>
2136 <arg value="winbin"/>
2137 <arg value="-r"/><arg value="${branch.revision}"/>
2138 </exec>
2139
2140 </target>
2141
2142 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
2143 <move todir="${gs2build.home}/bin/windows" failonerror="false">
2144 <fileset dir="${basedir}/winbin/bin"/>
2145 </move>
2146 </target>
2147
2148 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
2149 <delete dir="${basedir}/winbin"/>
2150 </target>
2151
2152 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
2153 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
2154 dest="${common.src.home}/packages/windows/crypt"/>
2155 <untar compression="gzip"
2156 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
2157 dest="${common.src.home}/packages/sqlite"/>
2158 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
2159 dest="${common.src.home}/indexers/packages/windows/iconv"/>
2160 </target>
2161
2162 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
2163 <!-- we want a windows path in the setup.bat file -->
2164 <pathconvert targetos="windows" property="gs2build.home.windows">
2165 <path path="${gs2build.home}"/>
2166 </pathconvert>
2167 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
2168 <filterset>
2169 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
2170 </filterset>
2171 </move>
2172 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
2173 </target>
2174
2175
2176 <target name="clean-build-src" depends="init" if="collection.building.enabled">
2177 <!-- unix: -->
2178 <if><bool><available file="${build.src.home}/Makefile"/></bool>
2179 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
2180 <arg value="clean"/>
2181 </exec>
2182 </if>
2183 <!-- windows: -->
2184 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2185 <arg value="/f"/>
2186 <arg value="win32.mak"/>
2187 <arg value="clean"/>
2188 <arg value="GSDLHOME=${gs2build.home}"/>
2189 </exec>
2190 </target>
2191
2192
2193 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
2194 <!-- unix: -->
2195 <if><bool><available file="${build.src.home}/Makefile"/></bool>
2196 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
2197 <arg value="distclean"/>
2198 </exec>
2199 </if>
2200 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
2201 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2202 <arg value="/f"/>
2203 <arg value="win32.mak"/>
2204 <arg value="clean"/>
2205 <arg value="GSDLHOME=${gs2build.home}"/>
2206 </exec>
2207 </target>
2208
2209 <target name="configure-build-src" depends="init" if="collection.building.enabled"
2210 description="Configure the build-src component">
2211 <exec executable="${build.src.home}/configure" os="${os.unix}"
2212 dir="${build.src.home}" failonerror="true">
2213 <arg value="--prefix=${gs2build.home}"/>
2214 <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
2215 </exec>
2216 </target>
2217
2218 <!-- common-src is done separately and needs to be compiled first -->
2219 <target name="compile-build-src" depends="init" if="collection.building.enabled">
2220
2221 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2222 <arg line="${ldlpath.arg}"/>
2223 </exec>
2224
2225 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2226 <arg value="install"/>
2227 </exec>
2228
2229 <!-- run the setup script -->
2230 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
2231 <!--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-->
2232 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2233 <arg value="/f"/>
2234 <arg value="win32.mak"/>
2235 <arg value="GSDLHOME=${gs2build.home}"/>
2236 </exec>
2237 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2238 <arg value="/f"/>
2239 <arg value="win32.mak"/>
2240 <arg value="install"/>
2241 <arg value="GSDLHOME=${gs2build.home}"/>
2242 </exec>
2243 </target>
2244
2245
2246 <!-- ======================== TESTING Targets ========================= -->
2247
2248 <target name="test" description="Run the (incomplete) JUnit test suite "
2249 depends="init">
2250 <mkdir dir="${basedir}/test"/>
2251 <junit printsummary="withOutAndErr"
2252 errorproperty="test.failed"
2253 failureproperty="test.failed"
2254 fork="${junit.fork}">
2255 <formatter type="plain"/>
2256 <classpath>
2257 <pathelement location="${build.home}/gsdl3test.jar"/>
2258 <path refid="compile.classpath"/>
2259 </classpath>
2260 <test name="${testcase}" if="testcase"/>
2261 <batchtest todir="${basedir}/test" unless="testcase">
2262 <fileset dir="${build.home}" includes="**/*Test.class" />
2263 </batchtest>
2264 </junit>
2265 <echo>
2266 *********************************************
2267 Test output can be found in directory 'test'
2268 *********************************************
2269 </echo>
2270 </target>
2271
2272 <!-- ======================== FLAX Targets ========================= -->
2273 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2274 <echo>checking out flax ...</echo>
2275 <mkdir dir="${basedir}/src/java/org/flax"/>
2276 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
2277 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
2278 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2279 <mkdir dir="${web.home}/interfaces/flax"/>
2280 <mkdir dir="${web.home}/sites/flax"/>
2281 <mkdir dir="${basedir}/flax-resources"/>
2282 <mkdir dir="${basedir}/flax-lib"/>
2283 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2284 <arg value="src/java/org/flax"/></exec>
2285 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2286 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2287 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2288 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2289 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
2290 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2291 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2292 <arg value="${web.home}/interfaces/flax"/></exec>
2293 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2294 <arg value="${web.home}/sites/flax"/></exec>
2295 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2296 <arg value="flax-resources"/></exec>
2297 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2298 <arg value="flax-lib"/></exec>
2299 <antcall target="flax-copy-del-files" />
2300 </target>
2301
2302 <target name="flax-copy-del-files" description="copy some flax files into the appropriate greenstone3 directories and delete some unwanted greenstone stuff">
2303 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2304 <copy todir="${web.home}/WEB-INF/lib">
2305 <fileset dir="${basedir}/flax-lib">
2306 <include name="*.jar"/>
2307 </fileset>
2308 </copy>
2309 <!--<delete dir="${web.home}/sites/gateway"/>
2310 <delete dir="${web.home}/sites/localsite"/>-->
2311 </target>
2312
2313 <target name="update-flax" description="update flax from repository">
2314 <echo>updating flax ...</echo>
2315 <exec executable="svn"><arg value="update"/>
2316 <arg value="src/java/org/flax"/></exec>
2317 <exec executable="svn"><arg value="update"/>
2318 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2319 <exec executable="svn"><arg value="update"/>
2320 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2321 <exec executable="svn"><arg value="update"/>
2322 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2323 <exec executable="svn"><arg value="update"/>
2324 <arg value="${web.home}/interfaces/flax"/></exec>
2325 <exec executable="svn"><arg value="update"/>
2326 <arg value="${web.home}/web/sites/flax"/></exec>
2327 <exec executable="svn"><arg value="update"/>
2328 <arg value="flax-resources"/></exec>
2329 <exec executable="svn"><arg value="update"/>
2330 <arg value="flax-lib"/></exec>
2331 <antcall target="compile-core" />
2332 </target>
2333
2334 <!-- ========================End of FLAX Targets ========================= -->
2335
2336 <target name="compile-javadocs">
2337 <javadoc packagenames="org.greenstone.*"
2338 sourcepath="src/java"
2339 defaultexcludes="yes"
2340 destdir="docs/javadoc"
2341 author="true"
2342 version="true"
2343 use="true"
2344 windowtitle="Greenstone3 API">
2345 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2346 </javadoc>
2347 </target>
2348
2349<!-- ========== Some distribution targets ======================== -->
2350 <target name="remove-source">
2351 <if><bool><isset property="with.gli.and.gems"/></bool>
2352 <delete includeEmptyDirs="true">
2353 <fileset dir="." defaultexcludes="false">
2354 <patternset refid="greenstone3.source.component"/>
2355 </fileset>
2356 </delete>
2357
2358 <else>
2359 <delete includeEmptyDirs="true">
2360 <fileset dir="." defaultexcludes="false">
2361 <patternset refid="greenstone3.source.no.gli.component"/>
2362 </fileset>
2363 </delete>
2364 </else>
2365 </if>
2366 </target>
2367
2368 <target name="dist-tidy"
2369 description="'tidies-up' a greenstone3 installation for distribution.">
2370
2371 <!-- delete unneeded things -->
2372 <delete dir="${packages.home}/axis"/>
2373 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2374 <delete file="README-SVN.txt"/>
2375 <delete file="build.properties.in"/>
2376
2377 <!-- delete source files -->
2378 <antcall target="remove-source"/>
2379
2380 <!-- create empty directories -->
2381 <mkdir dir="${web.home}/applet"/>
2382 <mkdir dir="${web.home}/logs"/>
2383 <mkdir dir="${web.home}/logs/tmp"/>
2384
2385 <!-- os specific tidy-ups -->
2386 <!-- linux, mac -->
2387 <if><bool><istrue value="${current.os.isunix}"/></bool>
2388 <delete><fileset dir="." includes="*.bat"/></delete>
2389 <if><bool><isset property="with.gli.and.gems"/></bool>
2390 <delete><fileset dir="gli" includes="*.bat"/></delete>
2391 </if>
2392 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2393 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
2394 <delete file="${basedir}/gs2build/win32cfg.h"/>
2395 <delete file="${basedir}/gs2build/win32.mak"/>
2396 <delete dir="${basedir}/winutil"/>
2397 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2398
2399 <!-- windows -->
2400 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2401 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
2402 <if><bool><isset property="with.gli.and.gems"/></bool>
2403 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2404 </if>
2405 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2406 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2407 </if></else></if>
2408
2409 </target>
2410
2411 <!-- fix up executable permissions for binary release -->
2412 <target name="fix-execute-permissions">
2413 <echo>Setting binaries to executable</echo>
2414 <chmod perm="775">
2415 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2416 </chmod>
2417 </target>
2418
2419 <!-- fix up executable permissions for source code release -->
2420 <target name="fix-execute-permissions-source">
2421 <chmod perm="775">
2422 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2423 </chmod>
2424 </target>
2425
2426
2427 <!-- ============= tweaks for making compilation static ========== -->
2428 <target name="tweak-makefiles" depends="init" if="compile.static">
2429 <antcall target="rtftohtml-add-static" />
2430 </target>
2431
2432 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2433 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2434 </target>
2435
2436 <target name="run-collection-tests">
2437 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
2438 <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>
2439 </if>
2440 <for param="testjar">
2441 <path>
2442 <fileset dir="${basedir}" includes="web/sites/*/collect/*/tests/tests.jar"/>
2443 </path>
2444 <sequential>
2445 <echo>Testing @{testjar}</echo>
2446 <java classname="org.junit.runner.JUnitCore" fork="true">
2447 <arg value="gstests.TestClass"/>
2448 <jvmarg value="-DSERVERURL=http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet} "/>
2449 <classpath>
2450 <fileset dir="${basedir}/ext/testing/lib/java">
2451 <include name="*.jar"/>
2452 </fileset>
2453 <files includes="@{testjar}"/>
2454 </classpath>
2455 </java>
2456 </sequential>
2457 </for>
2458 </target>
2459
2460 <target name="build-collection-tests">
2461 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
2462 <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>
2463 </if>
2464 <for param="compiledir">
2465 <path>
2466 <dirset dir="${basedir}" includes="web/sites/*/collect/*/tests/src"/>
2467 </path>
2468 <sequential>
2469 <echo>Compiling @{compiledir}</echo>
2470 <if><bool><not><available file="@{compiledir}/../build" type="dir"/></not></bool>
2471 <mkdir dir="@{compiledir}/../build"/>
2472 </if>
2473 <javac
2474 srcdir="@{compiledir}"
2475 destdir="@{compiledir}/../build"
2476 debug="${compile.debug}"
2477 deprecation="${compile.deprecation}"
2478 optimize="${compile.optimize}">
2479 <classpath>
2480 <fileset dir="${basedir}/ext/testing/lib/java">
2481 <include name="*.jar"/>
2482 </fileset>
2483 </classpath>
2484 <include name="gstests/*.java"/>
2485 </javac>
2486 <jar destfile="@{compiledir}/../tests.jar">
2487 <fileset dir="@{compiledir}/../build">
2488 <include name="gstests/**"/>
2489 </fileset>
2490 <manifest>
2491 <attribute name="Built-By" value="${user.name}" />
2492 </manifest>
2493 </jar>
2494 </sequential>
2495 </for>
2496 </target>
2497</project>
Note: See TracBrowser for help on using the repository browser.