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

Last change on this file since 26123 was 26115, checked in by sjm84, 12 years ago

Two new tasks for automated building and running of collection tests

File size: 102.9 KB
Line 
1<?xml version="1.0"?>
2<!-- ======================================================================
3 March 2005
4
5 Greenstone3 build and install script
6
7 kjdon
8 ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
10 <echo>os.name: ${os.name}</echo>
11
12 <!-- ============ classpath =================== -->
13 <path id="project.classpath">
14 <fileset dir="lib/java">
15 <include name="**/*.jar"/>
16 </fileset>
17 </path>
18
19 <!-- ============ self defined tasks =================== -->
20 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
21 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
22 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
23 <!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>-->
24 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
25 <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" classpathref="project.classpath"/>
26 <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
27
28
29 <!-- ===================== Property Definitions =========================== -->
30
31 <!--
32
33 Each of the following properties are used in the build script.
34 Values for these properties are set by the first place they are
35 defined, from the following list:
36
37 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
38
39 * Definitions from a "build.properties" file in the top level
40 source directory of this application.
41
42 * Definitions from a "build.properties" file in the user's
43 home directory.
44
45 * Default definitions in this build.xml file.
46
47 You will note below that property values can be composed based on the
48 contents of previously defined properties. This is a powerful technique
49 that helps you minimize the number of changes required when your development
50 environment is modified. Note that property composition is allowed within
51 "build.properties" files as well as in the "build.xml" script.
52
53 -->
54
55 <!-- 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="truncate" os="${os.unix}" dir="${catalina.home}/logs" spawn="false">
1226 <arg value="-s0"/>
1227 <arg value="catalina.out"/>
1228 </exec>
1229 <exec executable="truncate" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1230 <arg value="-s0"/>
1231 <arg value="greenstone.log"/>
1232 </exec>
1233 <exec executable="truncate" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1234 <arg value="-s0"/>
1235 <arg value="server.log"/>
1236 </exec>
1237
1238 <exec executable="cmd" os="${os.windows}" dir="${catalina.home}/logs" spawn="false">
1239 <arg line="/c echo. > catalina.out"/>
1240 </exec>
1241 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1242 <arg line="/c echo. > greenstone.log"/>
1243 </exec>
1244 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1245 <arg line="/c echo. > server.log"/>
1246 </exec>
1247
1248 <if>
1249 <bool><available file="${web.home}/logs/tmp" type="dir"/></bool>
1250 <delete>
1251 <fileset dir="${web.home}/logs/tmp" includes="**/*"/>
1252 </delete>
1253 </if>
1254 </target>
1255
1256 <!-- ======================= ant Targets ============================ -->
1257 <target name="prepare-ant" depends="init">
1258 <if>
1259 <bool>
1260 <not><available file="${packages.home}/ant/.flagfile"/></not>
1261 </bool>
1262
1263 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1264 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1265 usetimestamp="true"/>
1266 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1267 dest="${packages.home}"/>
1268 <move todir="${packages.home}/ant">
1269 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1270 </move>
1271 <echo file="${packages.home}/ant/.flagfile">
1272 the timestamp of this file is the time that ant was extracted from the zip files.
1273 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1274 </echo>
1275
1276 <else>
1277 <echo>Ant has been prepared, will not prepare</echo>
1278 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1279 </else>
1280
1281 </if>
1282 </target>
1283
1284 <!-- ======================= Admin Targets ============================ -->
1285
1286 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1287 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1288 But you can do: echo mypassword | ant config-admin -->
1289 <target name="config-admin" description="Reset admin password">
1290 <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-8 characters):&gt;">
1291 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1292 </input>
1293 <!--<echo>PWD: ${admin.password}</echo>-->
1294 <antcall target="update-userdb">
1295 <param name="user.username" value="admin"/>
1296 <param name="user.password" value="${admin.password}"/>
1297 <param name="user.groups" value=""/>
1298 <param name="user.status" value=""/>
1299 <param name="user.comment" value="Password updated."/>
1300 <param name="user.email" value=""/>
1301 </antcall>
1302 </target>
1303
1304 <target name="config-user" description="Add or modify users" depends="get-user-data,update-userdb"/>
1305
1306 <target name="get-user-data" description="Get user details">
1307 <input addproperty="user.username" message="Username:&gt;"/>
1308 <input addproperty="user.password" defaultvalue="" message="Password (3-8 characters):&gt;">
1309 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1310 </input>
1311 <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list):&gt;"/>
1312 <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
1313 <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
1314 <input addproperty="user.email" defaultvalue="" message="Email:&gt;"/>
1315 </target>
1316
1317<!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1318 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1319 But you can do: echo mypassword | ant config-admin -->
1320 <target name="update-userdb" description="Add or modify users" depends="check-tomcat-running">
1321
1322 <!-- stop tomcat if running, since derby db is embedded and only allows connections from one jvm instance at a time
1323 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
1324 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
1325 <if>
1326 <bool>
1327 <istrue value="${tomcat.isrunning}"/>
1328 </bool>
1329 <antcall target="stop-tomcat"/>
1330 </if>
1331
1332 <!--<echo>${admin.password}</echo>--> <!-- for testing -->
1333 <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
1334 <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
1335 <arg file="${web.home}/sites/localsite/etc/usersDB"/>
1336 <arg value="${user.username}"/>
1337 <arg value="password=${user.password}"/>
1338 <arg value="groups=${user.groups}"/>
1339 <arg value="status=${user.status}"/>
1340 <arg value="comment=${user.comment}"/>
1341 <arg value="email=${user.email}"/>
1342 </java>
1343
1344 <!-- run tomcat again if it used to be running -->
1345 <if>
1346 <bool>
1347 <istrue value="${tomcat.isrunning}"/>
1348 </bool>
1349 <antcall target="start-tomcat"/>
1350 </if>
1351 </target>
1352
1353
1354 <!-- ======================= Axis Targets ============================ -->
1355
1356 <target name="prepare-axis" depends="init">
1357
1358 <if>
1359 <bool>
1360 <not><available file="${packages.home}/axis/.flagfile"/></not>
1361 </bool>
1362
1363 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1364 dest="${packages.home}/${axis.zip.version}"
1365 usetimestamp="true"/>
1366 <unzip src="${packages.home}/${axis.zip.version}"
1367 dest="${packages.home}"/>
1368 <move todir="${packages.home}/axis">
1369 <fileset dir="${packages.home}/${axis.dir.version}"/>
1370 </move>
1371 <!-- install axis into greenstone web app -->
1372 <copy todir="${web.lib}">
1373 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1374 <include name="*.jar"/>
1375 </fileset>
1376 </copy>
1377 <copy todir="${web.home}">
1378 <fileset dir="${packages.home}/axis/webapps/axis/">
1379 <include name="*.jsp"/>
1380 <include name="*.jws"/>
1381 </fileset>
1382 </copy>
1383 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1384 <copy todir="${web.classes}">
1385 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1386 <include name="*.properties"/>
1387 </fileset>
1388 </copy>
1389 <echo file="${packages.home}/axis/.flagfile">
1390 the timestamp of this file is the time that axis was extracted from the zip files.
1391 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1392 </echo>
1393
1394 <else>
1395 <echo>Axis has been prepared, will not prepare</echo>
1396 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1397 </else>
1398
1399 </if>
1400 </target>
1401
1402 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
1403 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
1404
1405 <target name="deploy-site">
1406 <java classname="org.apache.axis.client.AdminClient">
1407 <classpath refid="compile.classpath"/>
1408 <arg value="-l"/>
1409 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1410 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1411 </java>
1412 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
1413 </target>
1414
1415 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
1416 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
1417 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1418 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1419 tofile="${basedir}/resources/soap/undeploy.wsdd"
1420 filtering="true"
1421 overwrite="true"/>
1422 <java classname="org.apache.axis.client.AdminClient">
1423 <classpath refid="compile.classpath"/>
1424 <arg value="-l"/>
1425 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1426 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
1427 </java>
1428 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
1429 </target>
1430
1431 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1432 with the default servicename of localsite-->
1433 <target name="deploy-localsite" depends="init"
1434 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1435 <antcall target="start-tomcat"/>
1436 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
1437 <antcall target="create-deployment-files">
1438 <param name="axis.sitename" value="localsite"/>
1439 <param name="axis.servicesname" value="${base.webservice.name}"/>
1440 <param name="axis.siteuri" value="localsite"/>
1441 </antcall>
1442 <antcall target="deploy-site">
1443 <param name="axis.sitename" value="localsite"/>
1444 <param name="axis.servicesname" value="${base.webservice.name}"/>
1445 <param name="axis.siteuri" value="localsite"/>
1446 </antcall>
1447 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
1448 </target>
1449
1450 <target name="get-sitename" unless="axis.sitename">
1451 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
1452Press Enter for default:localsite</input>
1453 </target>
1454
1455 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1456 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1457To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1458Or press Enter for undeploying the default:localsite /&gt;</input>
1459 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1460 </target>
1461
1462 <target name="get-webservices" unless="axis.servicesname">
1463 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1464Choose from: ${web.services.list}
1465Or press Enter for default:${base.webservice.name} /&gt;</input>
1466 <echo>${axis.servicesname}</echo>
1467 </target>
1468
1469 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1470 <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>
1471 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1472 </target>
1473
1474 <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">
1475 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1476 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1477 </condition>
1478
1479 <!--everything else defaults to java:RPC at present-->
1480 <condition property="soap.method" value="provider='java:RPC'">
1481 <not>
1482 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1483 </not>
1484 </condition>
1485 </target>
1486
1487 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1488 <filter token="sitename" value="${axis.sitename}"/>
1489 <filter token="siteuri" value="${axis.siteuri}"/>
1490 <filter token="servicesname" value="${axis.servicesname}"/>
1491 <filter token="soapmethod" value="${soap.method}"/>
1492 <copy file="${basedir}/resources/soap/site.wsdd.template"
1493 tofile="${basedir}/resources/soap/deploy.wsdd"
1494 filtering="true"
1495 overwrite="true"/>
1496 <!-- create the java files and compile them -->
1497 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1498 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1499 filtering="true"
1500 overwrite="true"/>
1501 <mkdir dir="${build.home}"/>
1502 <javac srcdir="${src.home}"
1503 destdir="${build.home}"
1504 debug="${compile.debug}"
1505 deprecation="${compile.deprecation}"
1506 optimize="${compile.optimize}">
1507 <classpath refid="compile.classpath"/>
1508 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1509 </javac>
1510 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1511 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1512 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1513 overwrite="true" />
1514 </target>
1515
1516
1517 <!-- ====================== Core targets ============================== -->
1518 <!-- core targets refer to the core gsdl3 java src -->
1519
1520 <target name="prepare-core"/>
1521
1522 <target name="configure-core"/>
1523
1524 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1525 description="Update only the Greenstone core" />
1526
1527 <target name="svnupdate-core" unless="nosvn.mode">
1528 <exec executable="svn">
1529 <arg value="update"/>
1530 <arg value="${basedir}"/>
1531 <arg value="-r"/><arg value="${branch.revision}"/>
1532 </exec>
1533 </target>
1534
1535 <target name="clean-core"
1536 description="Clean only the Greenstone core">
1537 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1538 <delete dir="${build.home}"/>
1539 </target>
1540
1541 <target name="compile-core" depends="init"
1542 description="Compile only the Greenstone core">
1543 <mkdir dir="${build.home}"/>
1544
1545 <if><bool><isset property="with.jni"/></bool>
1546 <javac srcdir="${src.home}"
1547 destdir="${build.home}"
1548 debug="${compile.debug}"
1549 deprecation="${compile.deprecation}"
1550 optimize="${compile.optimize}">
1551 <classpath>
1552 <path refid="compile.classpath"/>
1553 </classpath>
1554 </javac>
1555 <else>
1556 <property name="gsprefix" value=""/>
1557 <javac srcdir="${src.home}"
1558 destdir="${build.home}"
1559 debug="${compile.debug}"
1560 deprecation="${compile.deprecation}"
1561 optimize="${compile.optimize}">
1562 <classpath>
1563 <path refid="compile.classpath"/>
1564 </classpath>
1565 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1566 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1567 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1568 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1569 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1570 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1571 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1572 </javac>
1573 </else>
1574 </if>
1575 <jar destfile="${build.home}/gsdl3.jar">
1576 <fileset dir="${build.home}">
1577 <include name="org/greenstone/gsdl3/**"/>
1578 <include name="org/flax/**"/>
1579 <exclude name="**/Test.class"/>
1580 </fileset>
1581 <manifest>
1582 <attribute name="Built-By" value="${user.name}" />
1583 </manifest>
1584 </jar>
1585 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1586
1587 <jar destfile="${build.home}/gutil.jar">
1588 <fileset dir="${build.home}">
1589 <include name="org/greenstone/util/**"/>
1590 </fileset>
1591 <manifest>
1592 <attribute name="Built-By" value="${user.name}" />
1593 </manifest>
1594 </jar>
1595 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1596
1597 <!-- copy the localsite server in case we need it -->
1598 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1599
1600 <!-- Greenstone Administrator Interface -->
1601 <jar destfile="${build.home}/GAI.jar">
1602 <fileset dir="${build.home}">
1603 <include name="org/greenstone/admin/**"/>
1604 </fileset>
1605 <manifest>
1606 <attribute name="Built-By" value="${user.name}" />
1607 </manifest>
1608 </jar>
1609 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1610 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1611 <jar destfile="${build.home}/phind.jar">
1612 <fileset dir="${build.home}">
1613 <include name="org/greenstone/applet/phind/**"/>
1614 </fileset>
1615 <manifest>
1616 <attribute name="Built-By" value="${user.name}" />
1617 </manifest>
1618 </jar>
1619 <mkdir dir="${web.applet}"/>
1620 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1621 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1622 <if>
1623 <bool><istrue value="${tomcat.islocal}"/></bool>
1624 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1625 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1626 </if>
1627
1628
1629 <!-- skip anttasks for now
1630 <jar destfile="${build.home}/anttasks.jar">
1631 <fileset dir="${build.home}">
1632 <include name="org/greenstone/anttasks/**"/>
1633 </fileset>
1634 <manifest>
1635 <attribute name="Built-By" value="${user.name}" />
1636 </manifest>
1637 </jar>
1638 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1639 <jar destfile="${build.home}/gsdl3test.jar">
1640 <fileset dir="${build.home}">
1641 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1642 <include name="org/greenstone/testing/**"/>
1643 </fileset>
1644 <manifest>
1645 <attribute name="Built-By" value="${user.name}" />
1646 </manifest>
1647 </jar>
1648 <jar destfile="${build.home}/server.jar">
1649 <fileset dir="${build.home}">
1650 <include name="org/greenstone/server/**"/>
1651 <include name="org/greenstone/util/**"/>
1652 </fileset>
1653 <fileset file="${basedir}/resources/java/server.properties"/>
1654 <manifest>
1655 <attribute name="Built-By" value="${user.name}"/>
1656 </manifest>
1657 </jar>
1658 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1659 </target>
1660
1661 <!-- ================== Packages targets ================================ -->
1662 <!-- these targets refer to the greenstone source packages - these need
1663 updating less often, so are in separate targets to the core -->
1664 <target name="prepare-packages" depends="init"/>
1665
1666 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1667 description="Update only the source packages"/>
1668
1669 <target name="svnupdate-packages" unless="nosvn.mode">
1670 <exec executable="svn">
1671 <arg value="update"/>
1672 <arg value="${src.packages.home}"/>
1673 <arg value="-r"/><arg value="${branch.revision}"/>
1674 </exec>
1675 </target>
1676
1677
1678 <target name="configure-packages" depends="init,configure-javagdbm"
1679 description="Configure only the packages."/>
1680
1681 <target name="configure-javagdbm" if="with.jni">
1682 <echo>
1683 Configuring JavaGDBM
1684 </echo>
1685
1686 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1687 <arg value="--prefix=${basedir}"/>
1688 <arg value="--libdir=${lib.jni}"/>
1689 <arg value="--with-gdbm=${gdbm.home}"/>
1690 </exec>
1691 </target>
1692
1693 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1694
1695 <target name="clean-javagdbm" depends="init">
1696 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
1697 <exec executable="make" os="${os.unix}"
1698 dir="${javagdbm.home}" failonerror="true">
1699 <arg value="clean"/>
1700 </exec>
1701 </if>
1702 </target>
1703
1704 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1705
1706 <target name="distclean-javagdbm" depends="init">
1707 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
1708 <exec executable="make" os="${os.unix}"
1709 dir="${javagdbm.home}" failonerror="true">
1710 <arg value="distclean"/>
1711 </exec>
1712 </if>
1713 </target>
1714
1715 <target name="compile-packages" description="Compile only the source packages">
1716 <!-- javagdbm -->
1717 <antcall target="compile-javagdbm"/>
1718 <!-- Search4j -->
1719 <antcall target="compile-search4j"/>
1720 </target>
1721
1722 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
1723
1724 <!-- unix: -->
1725 <echo>compile javagdbm</echo>
1726 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1727 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1728 <arg value="install"/>
1729 </exec>
1730
1731 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1732 "all" which will then perform both the compile AND link targets in jni/win32.mak
1733 (thereby also generating gdbmjava.dll). Then we run the same command with
1734 the "install" argument to copy the gdbmjava.dll into the correct location. -->
1735 <echo>Windows: compile javagdbm</echo>
1736 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1737 <env key="GSDL3SRCHOME" path="${basedir}"/>
1738 </exec>
1739 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1740 <env key="GSDL3SRCHOME" path="${basedir}"/>
1741 <arg value="install"/>
1742 </exec>
1743
1744 <!-- install the jar file -->
1745 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
1746 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1747 </target>
1748
1749 <target name="compile-search4j">
1750
1751 <!-- windows -->
1752 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1753 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1754 <arg value="/f"/>
1755 <arg value="win32.mak"/>
1756 <arg value='BINDIR="${basedir}\bin"'/>
1757 </exec>
1758 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1759 <arg value="/f"/>
1760 <arg value="win32.mak"/>
1761 <arg value="install"/>
1762 <arg value='BINDIR="${basedir}\bin"'/>
1763 </exec>
1764
1765 <!-- unix -->
1766 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1767 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1768 <arg value="--bindir=${basedir}/bin"/>
1769 <arg value="${static.arg}"/>
1770 </exec>
1771 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1772 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1773 <arg value="install"/>
1774 </exec>
1775
1776 <!-- else warn -->
1777 <else>
1778 <fail>this target does not support the current os</fail>
1779
1780 </else></if></else></if>
1781
1782 </target>
1783
1784 <target name="install-auxiliary-jar-files" depends="init">
1785
1786 <if>
1787 <bool><available file="${mg.home}/mg.jar"/></bool>
1788 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1789 </if>
1790
1791 <if>
1792 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
1793 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1794 </if>
1795
1796 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${web.lib}"/>
1797 </target>
1798
1799 <target name="install-jni-files" depends="init" if="with.jni">
1800 <antcall target="install-jni-files-linux"/>
1801 <antcall target="install-jni-files-windows"/>
1802 <antcall target="install-jni-files-macos"/>
1803 </target>
1804
1805 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1806 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1807 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1808 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1809 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1810 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1811 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1812 </target>
1813 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1814 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1815 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1816 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1817 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1818 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1819 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1820 </target>
1821 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1822 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1823 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1824 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1825 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1826 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1827 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1828 </target>
1829
1830 <!-- ========common-src targets =================================-->
1831 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1832 collection building is not enabled -->
1833
1834 <target name="update-common-src" depends="init" if="collection.building.disabled">
1835 </target>
1836
1837 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1838 <exec executable="svn">
1839 <arg value="update"/>
1840 <arg value="${common.src.home}"/>
1841 <arg value="-r"/><arg value="${branch.revision}"/>
1842 </exec>
1843 </target>
1844
1845 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1846 <antcall target="checkout-common-src"/>
1847 <antcall target="unzip-windows-packages"/>
1848 </target>
1849
1850 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1851 <echo>checking out common-src</echo>
1852 <exec executable="svn">
1853 <arg value="checkout"/>
1854 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
1855 <arg value="common-src"/>
1856 <arg value="-r"/><arg value="${branch.revision}"/>
1857 </exec>
1858 </target>
1859
1860 <target name="configure-common-src" depends="init">
1861 <exec executable="${common.src.home}/configure" os="${os.unix}"
1862 dir="${common.src.home}" failonerror="true">
1863 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1864 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1865 <arg line="${gs2.opt.args}"/>
1866 <arg line="${static.arg}"/>
1867 <arg line="${allargs}"/>
1868 </exec>
1869 </target>
1870
1871 <target name="clean-common-src" depends="init">
1872 <!-- unix: -->
1873 <if><bool><available file="${common.src.home}/Makefile"/></bool>
1874 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1875 <arg value="clean"/>
1876 </exec>
1877 </if>
1878 <!-- windows: -->
1879 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1880 <arg value="/f"/>
1881 <arg value="win32.mak"/>
1882 <arg value="clean"/>
1883 <arg value="GSDLHOME=${gs2build.home}"/>
1884 </exec>
1885 </target>
1886 <target name="distclean-common-src" depends="init">
1887 <!-- unix: -->
1888 <if><bool><available file="${common.src.home}/Makefile"/></bool>
1889 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1890 <arg value="distclean"/>
1891 </exec>
1892 </if>
1893 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1894 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1895 <arg value="/f"/>
1896 <arg value="win32.mak"/>
1897 <arg value="clean"/>
1898 <arg value="GSDLHOME=${gs2build.home}"/>
1899 </exec>
1900 </target>
1901 <target name="compile-common-src" depends="init">
1902 <!-- unix: -->
1903 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1904 <arg value="${gs2.compile.target}"/>
1905 </exec>
1906 <!-- windows: -->
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="GSDLHOME=${gs2build.home}"/>
1911 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1912 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1913 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1914 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1915 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1916 </exec>
1917 </target>
1918
1919 <!-- ======= collection-building targets ===========================-->
1920
1921 <target name="update-collection-building" if="collection.building.enabled"
1922 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"
1923 description="Update (SVN update, configure, compile etc) only the collection building components"/>
1924
1925 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1926 description="SVN update the collection building components">
1927 </target>
1928
1929 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1930 </target>
1931
1932 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1933 description="Configure the collection building components">
1934 </target>
1935
1936 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1937 description="Clean only the collection building components"
1938 if="collection.building.enabled"/>
1939
1940 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1941 description="Distclean only the collection building components"
1942 if="collection.building.enabled"/>
1943
1944 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1945 description="Compile only the collection building components">
1946 <!-- make install for common-src -->
1947 <!-- unix: -->
1948 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1949 <arg value="${gs2.install.target}"/>
1950 </exec>
1951
1952 <!-- windows: -->
1953 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1954 <arg value="/f"/>
1955 <arg value="win32.mak"/>
1956 <arg value="install"/>
1957 <arg value="GSDLHOME=${gs2build.home}"/>
1958 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1959 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1960 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1961 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1962 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1963 <!--
1964 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1965 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
1966 </exec>
1967
1968 <!-- install gs2build indexers for windows -->
1969 <if>
1970 <bool><istrue value="${current.os.iswindows}"/></bool>
1971 <copy todir="${gs2build.home}/bin/windows">
1972 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1973 <include name="*.*"/>
1974 </fileset>
1975 </copy>
1976 </if>
1977
1978 <!-- LuceneWrapper jar file not installed by default -->
1979 <mkdir dir="${gs2build.home}/bin/java"/>
1980 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${gs2build.home}/bin/java"/>
1981
1982 </target>
1983
1984 <!-- ============== gli targets ================================= -->
1985 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1986
1987 <exec executable="svn">
1988 <arg value="update"/>
1989 <arg value="${gli.home}"/>
1990 <arg value="-r"/><arg value="${branch.revision}"/>
1991 </exec>
1992
1993 <exec executable="svn" dir="web/WEB-INF/cgi">
1994 <arg value="export"/>
1995 <arg value="-r"/><arg value="${branch.revision}"/>
1996 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
1997 </exec>
1998 <exec executable="svn" dir="web/WEB-INF/cgi">
1999 <arg value="export"/>
2000 <arg value="-r"/><arg value="${branch.revision}"/>
2001 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
2002 </exec>
2003
2004 </target>
2005
2006 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
2007 <!-- checkout -->
2008 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
2009
2010 <exec executable="svn">
2011 <arg value="checkout"/>
2012 <arg value="${svn.root}/main/${branch.path}/gli"/>
2013 <arg value="-r"/><arg value="${branch.revision}"/>
2014 </exec>
2015
2016 <exec executable="svn" dir="web/WEB-INF/cgi">
2017 <arg value="export"/>
2018 <arg value="-r"/><arg value="${branch.revision}"/>
2019 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
2020 </exec>
2021 <exec executable="svn" dir="web/WEB-INF/cgi">
2022 <arg value="export"/>
2023 <arg value="-r"/><arg value="${branch.revision}"/>
2024 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
2025 </exec>
2026
2027 </if>
2028 </target>
2029
2030 <target name="clean-gli" depends="init" if="collection.building.enabled">
2031 <!-- gli -->
2032 <property name="gli.home" value="${basedir}/gli"/>
2033 <!-- linux -->
2034 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
2035 resolveExecutable="true" failonerror="true"/>
2036 <!-- windows -->
2037 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
2038 resolveExecutable="true" failonerror="true"/>
2039 </target>
2040
2041 <target name="compile-gli" depends="init" if="collection.building.enabled">
2042 <if><bool><isset property="with.gli.and.gems"/></bool>
2043 <!-- gli -->
2044 <property name="gli.home" value="${basedir}/gli"/>
2045
2046 <!-- linux -->
2047 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2048 <!--remote gli-->
2049 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
2050 resolveExecutable="true" failonerror="true"/>
2051 <!-- windows -->
2052 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2053 <!--remote gli-->
2054 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
2055 resolveExecutable="true" failonerror="true"/>
2056 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
2057 </if>
2058 </target>
2059
2060 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
2061 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
2062 <env key="gsdl3path" path="${basedir}"/>
2063 <env key="gsdlpath" path="${gs2build.home}"/>
2064 </exec>
2065 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
2066 <env key="gsdl3path" path="${basedir}"/>
2067 <env key="gsdlpath" path="${gs2build.home}"/>
2068 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
2069 </exec>
2070 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
2071 <env key="GSDL3PATH" path="${basedir}"/>
2072 <env key="GSDLPATH" path="${gs2build.home}"/>
2073 </exec>
2074 <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.
2075 </echo>
2076 </target>
2077
2078 <!-- ================ gs2build targets =========================== -->
2079
2080 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
2081 <echo>svn updating gs2build</echo>
2082 <exec executable="svn">
2083 <arg value="update"/>
2084 <arg value="${gs2build.home}"/>
2085 <arg value="-r"/><arg value="${branch.revision}"/>
2086 </exec>
2087 </target>
2088
2089 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
2090 <antcall target="checkout-gs2build"/>
2091 <antcall target="unzip-windows-packages"/>
2092 <antcall target="checkout-winbin"/>
2093 <antcall target="get-windows-binaries"/>
2094 <antcall target="delete-winbin"/>
2095 </target>
2096
2097 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
2098 <echo>checking out gs2build</echo>
2099 <exec executable="svn">
2100 <arg value="checkout"/>
2101 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
2102 <arg value="-r"/><arg value="${branch.revision}"/>
2103 </exec>
2104
2105
2106 </target>
2107
2108 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
2109 unless="nosvn.mode">
2110
2111 <exec executable="svn">
2112 <arg value="checkout"/>
2113 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
2114 <arg value="-r"/><arg value="${branch.revision}"/>
2115 <arg value="winbin"/>
2116 </exec>
2117
2118 </target>
2119
2120 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
2121 <exec executable="svn">
2122 <arg value="update"/>
2123 <arg value="winbin"/>
2124 <arg value="-r"/><arg value="${branch.revision}"/>
2125 </exec>
2126
2127 </target>
2128
2129 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
2130 <move todir="${gs2build.home}/bin/windows" failonerror="false">
2131 <fileset dir="${basedir}/winbin/bin"/>
2132 </move>
2133 </target>
2134
2135 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
2136 <delete dir="${basedir}/winbin"/>
2137 </target>
2138
2139 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
2140 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
2141 dest="${common.src.home}/packages/windows/crypt"/>
2142 <untar compression="gzip"
2143 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
2144 dest="${common.src.home}/packages/sqlite"/>
2145 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
2146 dest="${common.src.home}/indexers/packages/windows/iconv"/>
2147 </target>
2148
2149 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
2150 <!-- we want a windows path in the setup.bat file -->
2151 <pathconvert targetos="windows" property="gs2build.home.windows">
2152 <path path="${gs2build.home}"/>
2153 </pathconvert>
2154 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
2155 <filterset>
2156 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
2157 </filterset>
2158 </move>
2159 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
2160 </target>
2161
2162
2163 <target name="clean-build-src" depends="init" if="collection.building.enabled">
2164 <!-- unix: -->
2165 <if><bool><available file="${build.src.home}/Makefile"/></bool>
2166 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
2167 <arg value="clean"/>
2168 </exec>
2169 </if>
2170 <!-- windows: -->
2171 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2172 <arg value="/f"/>
2173 <arg value="win32.mak"/>
2174 <arg value="clean"/>
2175 <arg value="GSDLHOME=${gs2build.home}"/>
2176 </exec>
2177 </target>
2178
2179
2180 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
2181 <!-- unix: -->
2182 <if><bool><available file="${build.src.home}/Makefile"/></bool>
2183 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
2184 <arg value="distclean"/>
2185 </exec>
2186 </if>
2187 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
2188 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2189 <arg value="/f"/>
2190 <arg value="win32.mak"/>
2191 <arg value="clean"/>
2192 <arg value="GSDLHOME=${gs2build.home}"/>
2193 </exec>
2194 </target>
2195
2196 <target name="configure-build-src" depends="init" if="collection.building.enabled"
2197 description="Configure the build-src component">
2198 <exec executable="${build.src.home}/configure" os="${os.unix}"
2199 dir="${build.src.home}" failonerror="true">
2200 <arg value="--prefix=${gs2build.home}"/>
2201 <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
2202 </exec>
2203 </target>
2204
2205 <!-- common-src is done separately and needs to be compiled first -->
2206 <target name="compile-build-src" depends="init" if="collection.building.enabled">
2207
2208 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2209 <arg line="${ldlpath.arg}"/>
2210 </exec>
2211
2212 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2213 <arg value="install"/>
2214 </exec>
2215
2216 <!-- run the setup script -->
2217 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
2218 <!--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-->
2219 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2220 <arg value="/f"/>
2221 <arg value="win32.mak"/>
2222 <arg value="GSDLHOME=${gs2build.home}"/>
2223 </exec>
2224 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2225 <arg value="/f"/>
2226 <arg value="win32.mak"/>
2227 <arg value="install"/>
2228 <arg value="GSDLHOME=${gs2build.home}"/>
2229 </exec>
2230 </target>
2231
2232
2233 <!-- ======================== TESTING Targets ========================= -->
2234
2235 <target name="test" description="Run the (incomplete) JUnit test suite "
2236 depends="init">
2237 <mkdir dir="${basedir}/test"/>
2238 <junit printsummary="withOutAndErr"
2239 errorproperty="test.failed"
2240 failureproperty="test.failed"
2241 fork="${junit.fork}">
2242 <formatter type="plain"/>
2243 <classpath>
2244 <pathelement location="${build.home}/gsdl3test.jar"/>
2245 <path refid="compile.classpath"/>
2246 </classpath>
2247 <test name="${testcase}" if="testcase"/>
2248 <batchtest todir="${basedir}/test" unless="testcase">
2249 <fileset dir="${build.home}" includes="**/*Test.class" />
2250 </batchtest>
2251 </junit>
2252 <echo>
2253 *********************************************
2254 Test output can be found in directory 'test'
2255 *********************************************
2256 </echo>
2257 </target>
2258
2259 <!-- ======================== FLAX Targets ========================= -->
2260 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2261 <echo>checking out flax ...</echo>
2262 <mkdir dir="${basedir}/src/java/org/flax"/>
2263 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
2264 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
2265 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2266 <mkdir dir="${web.home}/interfaces/flax"/>
2267 <mkdir dir="${web.home}/sites/flax"/>
2268 <mkdir dir="${basedir}/flax-resources"/>
2269 <mkdir dir="${basedir}/flax-lib"/>
2270 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2271 <arg value="src/java/org/flax"/></exec>
2272 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2273 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2274 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2275 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2276 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
2277 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2278 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2279 <arg value="${web.home}/interfaces/flax"/></exec>
2280 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2281 <arg value="${web.home}/sites/flax"/></exec>
2282 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2283 <arg value="flax-resources"/></exec>
2284 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2285 <arg value="flax-lib"/></exec>
2286 <antcall target="flax-copy-del-files" />
2287 </target>
2288
2289 <target name="flax-copy-del-files" description="copy some flax files into the appropriate greenstone3 directories and delete some unwanted greenstone stuff">
2290 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2291 <copy todir="${web.home}/WEB-INF/lib">
2292 <fileset dir="${basedir}/flax-lib">
2293 <include name="*.jar"/>
2294 </fileset>
2295 </copy>
2296 <!--<delete dir="${web.home}/sites/gateway"/>
2297 <delete dir="${web.home}/sites/localsite"/>-->
2298 </target>
2299
2300 <target name="update-flax" description="update flax from repository">
2301 <echo>updating flax ...</echo>
2302 <exec executable="svn"><arg value="update"/>
2303 <arg value="src/java/org/flax"/></exec>
2304 <exec executable="svn"><arg value="update"/>
2305 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2306 <exec executable="svn"><arg value="update"/>
2307 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2308 <exec executable="svn"><arg value="update"/>
2309 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2310 <exec executable="svn"><arg value="update"/>
2311 <arg value="${web.home}/interfaces/flax"/></exec>
2312 <exec executable="svn"><arg value="update"/>
2313 <arg value="${web.home}/web/sites/flax"/></exec>
2314 <exec executable="svn"><arg value="update"/>
2315 <arg value="flax-resources"/></exec>
2316 <exec executable="svn"><arg value="update"/>
2317 <arg value="flax-lib"/></exec>
2318 <antcall target="compile-core" />
2319 </target>
2320
2321 <!-- ========================End of FLAX Targets ========================= -->
2322
2323 <target name="compile-javadocs">
2324 <javadoc packagenames="org.greenstone.*"
2325 sourcepath="src/java"
2326 defaultexcludes="yes"
2327 destdir="docs/javadoc"
2328 author="true"
2329 version="true"
2330 use="true"
2331 windowtitle="Greenstone3 API">
2332 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2333 </javadoc>
2334 </target>
2335
2336<!-- ========== Some distribution targets ======================== -->
2337 <target name="remove-source">
2338 <if><bool><isset property="with.gli.and.gems"/></bool>
2339 <delete includeEmptyDirs="true">
2340 <fileset dir="." defaultexcludes="false">
2341 <patternset refid="greenstone3.source.component"/>
2342 </fileset>
2343 </delete>
2344
2345 <else>
2346 <delete includeEmptyDirs="true">
2347 <fileset dir="." defaultexcludes="false">
2348 <patternset refid="greenstone3.source.no.gli.component"/>
2349 </fileset>
2350 </delete>
2351 </else>
2352 </if>
2353 </target>
2354
2355 <target name="dist-tidy"
2356 description="'tidies-up' a greenstone3 installation for distribution.">
2357
2358 <!-- delete unneeded things -->
2359 <delete dir="${packages.home}/axis"/>
2360 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2361 <delete file="README-SVN.txt"/>
2362 <delete file="build.properties.in"/>
2363
2364 <!-- delete source files -->
2365 <antcall target="remove-source"/>
2366
2367 <!-- create empty directories -->
2368 <mkdir dir="${web.home}/applet"/>
2369 <mkdir dir="${web.home}/logs"/>
2370 <mkdir dir="${web.home}/logs/tmp"/>
2371
2372 <!-- os specific tidy-ups -->
2373 <!-- linux, mac -->
2374 <if><bool><istrue value="${current.os.isunix}"/></bool>
2375 <delete><fileset dir="." includes="*.bat"/></delete>
2376 <if><bool><isset property="with.gli.and.gems"/></bool>
2377 <delete><fileset dir="gli" includes="*.bat"/></delete>
2378 </if>
2379 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2380 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
2381 <delete file="${basedir}/gs2build/win32cfg.h"/>
2382 <delete file="${basedir}/gs2build/win32.mak"/>
2383 <delete dir="${basedir}/winutil"/>
2384 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2385
2386 <!-- windows -->
2387 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2388 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
2389 <if><bool><isset property="with.gli.and.gems"/></bool>
2390 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2391 </if>
2392 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2393 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2394 </if></else></if>
2395
2396 </target>
2397
2398 <!-- fix up executable permissions for binary release -->
2399 <target name="fix-execute-permissions">
2400 <echo>Setting binaries to executable</echo>
2401 <chmod perm="775">
2402 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2403 </chmod>
2404 </target>
2405
2406 <!-- fix up executable permissions for source code release -->
2407 <target name="fix-execute-permissions-source">
2408 <chmod perm="775">
2409 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2410 </chmod>
2411 </target>
2412
2413
2414 <!-- ============= tweaks for making compilation static ========== -->
2415 <target name="tweak-makefiles" depends="init" if="compile.static">
2416 <antcall target="rtftohtml-add-static" />
2417 </target>
2418
2419 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2420 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2421 </target>
2422
2423 <target name="run-collection-tests">
2424 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
2425 <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>
2426 </if>
2427 <for param="testjar">
2428 <path>
2429 <fileset dir="${basedir}" includes="web/sites/*/collect/*/tests/tests.jar"/>
2430 </path>
2431 <sequential>
2432 <echo>Testing @{testjar}</echo>
2433 <java classname="org.junit.runner.JUnitCore" fork="true">
2434 <arg value="gstests.TestClass"/>
2435 <jvmarg value="-DSERVERURL=http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet} "/>
2436 <classpath>
2437 <fileset dir="${basedir}/ext/testing/lib/java">
2438 <include name="*.jar"/>
2439 </fileset>
2440 <files includes="@{testjar}"/>
2441 </classpath>
2442 </java>
2443 </sequential>
2444 </for>
2445 </target>
2446
2447 <target name="build-collection-tests">
2448 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
2449 <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>
2450 </if>
2451 <for param="compiledir">
2452 <path>
2453 <dirset dir="${basedir}" includes="web/sites/*/collect/*/tests/src"/>
2454 </path>
2455 <sequential>
2456 <echo>Compiling @{compiledir}</echo>
2457 <if><bool><not><available file="@{compiledir}/../build" type="dir"/></not></bool>
2458 <mkdir dir="@{compiledir}/../build"/>
2459 </if>
2460 <javac
2461 srcdir="@{compiledir}"
2462 destdir="@{compiledir}/../build"
2463 debug="${compile.debug}"
2464 deprecation="${compile.deprecation}"
2465 optimize="${compile.optimize}">
2466 <classpath>
2467 <fileset dir="${basedir}/ext/testing/lib/java">
2468 <include name="*.jar"/>
2469 </fileset>
2470 </classpath>
2471 <include name="gstests/*.java"/>
2472 </javac>
2473 <jar destfile="@{compiledir}/../tests.jar">
2474 <fileset dir="@{compiledir}/../build">
2475 <include name="gstests/**"/>
2476 </fileset>
2477 <manifest>
2478 <attribute name="Built-By" value="${user.name}" />
2479 </manifest>
2480 </jar>
2481 </sequential>
2482 </for>
2483 </target>
2484</project>
Note: See TracBrowser for help on using the repository browser.