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

Last change on this file since 26495 was 26495, checked in by ak19, 11 years ago

Added target to allow tomcat to be started up in debug mode which will allow it to be debugged in Eclipse. Still need to add the instructions for setting Eclipse up to the wiki. But these instructions are based on http://www.wikijava.org/wiki/Debugging_a_servlet_with_tomcat_and_Eclipse_tutorial

File size: 106.9 KB
RevLine 
[15124]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=".">
[20241]10 <echo>os.name: ${os.name}</echo>
[15124]11
[15799]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"/>
[19930]22 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
[21196]23 <!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>-->
[15799]24 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
[26115]25 <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" classpathref="project.classpath"/>
[23854]26 <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
27
[19930]28
[15799]29 <!-- ===================== Property Definitions =========================== -->
30
31 <!--
[15124]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
[15799]40 source directory of this application.
[15124]41
42 * Definitions from a "build.properties" file in the user's
[15799]43 home directory.
[15124]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
[15799]53 -->
[18227]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
[18515]61 <!-- create the packages dir if it has not been created yet -->
62 <mkdir dir="packages"/>
[15799]63
[15859]64 <!--the first three properties have to be put on the top to be used by build.properties-->
[19960]65 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
[15124]66 <property name="src.packages.home" value="${basedir}/src/packages"/>
[15859]67 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
[19878]68
[15124]69 <property file="build.properties"/>
[16962]70 <if><bool><available file="${user.home}/build.properties"/></bool>
71 <property file="${user.home}/build.properties"/>
72 </if>
[15124]73
[20464]74 <!-- now we've read in properties, apply defaults -->
75 <property name="disable.collection.building" value="false"/>
76
[15124]77 <!-- get properties from the environment -->
78 <property environment="env"/>
[15799]79
[20127]80 <!-- get the filesets defining components and executables -->
[19975]81 <import file="resources/xml/components.xml"/>
[20127]82 <import file="resources/xml/executables.xml"/>
[15799]83
84 <!-- version properties for external packages -->
[20079]85 <!-- for Java versions < 1.4, we print out the message that Java is too old.
[25131]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">
[20079]88 <equals arg1="1.4" arg2="${ant.java.version}"/>
89 </condition>
[25131]90 <condition property="tomcat.version.major" value="5" else="7">
[20079]91 <equals arg1="1.4" arg2="${ant.java.version}"/>
92 </condition>
[22320]93 <condition property="privileged.attribute" value="privileged='true'" else="">
[25384]94 <equals arg1="7" arg2="${tomcat.version.major}"/>
[22320]95 </condition>
[20233]96
[22405]97 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
98 <property name="axis.dir.version" value="axis-1_4"/>
[24077]99 <property name="sqlite.targz.version" value="sqlite-autoconf-3070602.tar.gz"/>
[15799]100
[15124]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"/>
[20085]109
[15124]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"/>
[19878]119
120 <!-- other jar files needed for installation (but not runtime) go here -->
[18110]121 <property name="lib.java" value="${basedir}/lib/java"/>
[15799]122
[15124]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
[18124]128 <property name="admin.dir" value="${basedir}/admin"/>
[15124]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
[19878]138 <!-- catalina home is set to tomcat basedir if already installed, otherwise
[15124]139 use greenstone's tomcat -->
[20085]140 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
[15124]141 <and>
142 <isset property="tomcat.installed.path"/>
143 <not>
[16936]144 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]145 </not>
146 </and>
147 </condition>
[25131]148
[15124]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}"/>
[22056]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!!!-->
[15124]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>
[19933]164 <os family="mac"/>
[15124]165 </not>
166 </and>
167 </condition>
[19878]168
[15124]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
[19933]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
[19878]194 <condition property="collection.building.disabled">
[20464]195 <and>
196 <isset property="disable.collection.building"/>
197 <istrue value="${disable.collection.building}"/>
198 </and>
[19878]199 </condition>
200
[15124]201 <condition property="collection.building.enabled">
202 <not>
[20464]203 <istrue value="${disable.collection.building}"/>
[15124]204 </not>
205 </condition>
[19878]206
[15124]207 <condition property="collection.building.enabled.windows">
208 <and>
[20464]209 <istrue value="${collection.building.enabled}"/>
[15124]210 <isset property="current.os.iswindows"/>
211 </and>
212 </condition>
213
214 <condition property="collection.building.enabled.unix">
215 <and>
[20464]216 <istrue value="${collection.building.enabled}"/>
[15124]217 <isset property="current.os.isunix"/>
218 </and>
219 </condition>
[22847]220
[20085]221 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
[19931]222 <isset property="compile.static"/>
223 </condition>
[22184]224
[22845]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>
[23599]227 <property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
[22845]228
[23599]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>
[22845]235
[23599]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>
[22847]242
[23599]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
[23611]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>
[23599]278 <else>
[23611]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>
[23599]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
[23611]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>
[23599]338 <else>
[23611]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>
[23599]346 </if>
347 </else>
[22868]348 </if>
[23611]349 <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
[22868]350
[22184]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>
[22976]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>
[19931]376
[15799]377 <!-- where is search4j tool -->
[20085]378 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
[15799]379 <isset property="current.os.iswindows"/>
[15136]380 </condition>
381
[15799]382
[15124]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
[21347]389 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
[20464]390 <istrue value="${disable.collection.building}"/>
[19871]391 </condition>
[19931]392
393 <property name="build.src.home" value="${gs2build.home}/build-src"/>
[19871]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
[15799]399 <!-- ==================== Compilation Control Options ==================== -->
[15124]400
[15799]401 <!--
[15124]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
[15799]412 -->
[15124]413
414 <property name="compile.debug" value="true"/>
415 <property name="compile.deprecation" value="true"/>
416 <property name="compile.optimize" value="true"/>
417
[15799]418 <!--
[15124]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
[15799]427 -->
[20079]428
429 <!-- All elements that Tomcat 5 exposes to applications -->
430 <path id="tomcat5">
[20085]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>
[20079]443 </path>
444
[25131]445 <!-- All elements that Tomcat 7 exposes to applications -->
446 <path id="tomcat7">
[20085]447 <fileset dir="${catalina.home}/lib">
448 <include name="*.jar"/>
449 </fileset>
[20079]450 </path>
451
[15124]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
[18110]464 <pathelement location="${lib.java}"/>
465 <fileset dir="${lib.java}">
466 <include name="*.jar"/>
467 </fileset>
[15124]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 -->
[22184]472 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
[15124]473 <pathelement location="${lib.jni}/mg.jar"/>
474 <pathelement location="${lib.jni}/mgpp.jar"/>
475
[20085]476 <!-- Include all elements that Tomcat exposes to applications -->
477 <path refid="tomcat${tomcat.version.major}"/>
478
[15124]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>
[25095]487
488 <pathelement location="${web.lib}"/>
489 <fileset dir="${web.lib}">
490 <include name="derby.jar"/>
491 </fileset>
[15124]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>
[20085]511
[15799]512 <!-- ==================== Primary and Global Targets ============================= -->
[15124]513
[19873]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"
[15124]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>
[16936]523
[19871]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 -->
[19878]525 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
[19843]526 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
527
[19931]528 <target name="install-common-src" depends="init"
529 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
[19894]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>
[19878]535
[19894]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"/>
[19931]539 <antcall target="tweak-makefiles" />
[19894]540 <antcall target="compile-collection-building"/>
541 </target>
542
[19878]543
[20209]544 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
[19878]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"
[15124]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"
[23855]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."/>
[15124]552
[20209]553 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
[19878]554 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
[15124]555
[20209]556 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
[19878]557 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
[15799]558
[19878]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'"/>
[15124]561
[23854]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 -->
[23856]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 -->
[23857]568 <if><bool><available file="${gs2build.home}"/></bool>
[23854]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>
[23896]582 Using PATH environment variable to locate Perl.
[23854]583 </echo>
584 <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
585 <arg value="perl" />
586 </exec>
587
[23941]588 <exec executable="${gs2build.home}/bin/windows/which" os="${os.windows}" spawn="false" outputproperty="full.perl.path">
589 <arg value="perl" />
590 </exec>
[23896]591
[25640]592 <stringutil string="${full.perl.path}" property="partial.perl.path">
593 <replace regex="\/[^\/]*$" replacement="/" />
[23854]594 </stringutil>
[25640]595 <stringutil string="${partial.perl.path}" property="perl.path">
596 <replace regex="\\[^\\]*$" replacement="\\" />
597 </stringutil>
[23896]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>
[23854]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.
[23896]605 </echo>
606 </if>
[23854]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>
[23857]619
620 <!-- gs2build not available, perl.path -->
621 <else>
622 <property name="perl.path" value=""/>
623 </else>
624 </if>
[23854]625 </target>
626
[25549]627 <target name="get-default-servlet-url">
628 <echo>http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}</echo>
629 </target>
630
[23854]631 <target name="start" depends="init,configure-web,start-tomcat"
[15124]632 description="Startup the Tomcat server." >
[15799]633 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
[16936]634 <echo>Tomcat: ${catalina.home}</echo>
635 <echo>Java : ${java.home}</echo>
[23849]636 <if><bool><available file="${build.src.home}"/></bool>
637 <echo>Perl : ${full.perl.path}</echo>
638 </if>
[23936]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>
[15799]646 <!-- assuming that index.html is not needed here -->
[26033]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>
[15124]653 </target>
654
[26033]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
[15124]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
[15799]666 <!-- =========== Help targets =================================== -->
[15124]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."/>
[23849]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.
[15124]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
[15799]691 <!-- ====== initialization and setup targets ================== -->
[15124]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:
[15799]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}
[19878]700 disable.collection.building=${disable.collection.building}
[19910]701 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
[15124]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>
[20085]708
[15124]709 <!-- this sets up some initial properties -->
710 <target name="init">
711
[20085]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
[20092]719 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
[20085]720
[15124]721 <condition property="java.too.old">
722 <or>
[16936]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}"/>
[15124]726 </or>
727 </condition>
[20208]728 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
[15124]729
730 <available file="${basedir}/gli" property="gli.present"/>
[19878]731 <available file="${basedir}/common-src" property="common.src.present"/>
[15124]732 <available file="${basedir}/gs2build" property="gs2build.present"/>
733
734 <condition property="tomcat.islocal">
735 <or>
[16936]736 <not><isset property="tomcat.installed.path"/></not>
737 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]738 </or>
739 </condition>
740
[15799]741 <echo>tomcat.port = ${tomcat.port}</echo>
[15124]742
743 <condition property="proxy.present">
744 <and>
[16936]745 <isset property="proxy.host"/>
746 <not><equals arg1="" arg2="${proxy.host}"/></not>
[15124]747 </and>
748 </condition>
749
[20235]750 <!--
[20290]751 the next block checks if the bundled tomcat is present in the 'packages' directory,
[25131]752 and checks for the lethal combination of tomcat 7 and java 1.4. Test for
[20290]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
[20235]755 -->
756 <condition property="packages.tomcat.ispresent" value="true" else="false">
757 <available file="packages/tomcat"/>
758 </condition>
[25131]759 <condition property="packages.tomcat.istomcat7" value="true" else="false">
760 <available file="packages/tomcat/tomcat7.txt"/>
[20290]761 </condition>
[20235]762 <if>
763 <bool>
[20290]764 <and>
765 <istrue value="${packages.tomcat.ispresent}"/>
[25131]766 <istrue value="${packages.tomcat.istomcat7}"/>
[20290]767 <equals arg1="1.4" arg2="${ant.java.version}"/>
768 </and>
[20235]769 </bool>
[20290]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>
[20235]771 </if>
772
[15124]773 </target>
774
775 <target name="setup-proxy" depends="init" if="proxy.present">
776 <condition property="ask.user">
777 <or>
[16936]778 <equals arg1="" arg2="${proxy.user}"/>
779 <equals arg1="" arg2="${proxy.password}"/>
[15124]780 </or>
781 </condition>
[19878]782
[15124]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
[15799]787 <!-- ========== Web app Targets ================================ -->
788
[20089]789 <target name="prepare-web" depends="init">
[15124]790 <mkdir dir="${web.home}/applet"/>
791 <mkdir dir="${web.home}/logs"/>
[25446]792 <mkdir dir="${web.home}/logs/tmp"/>
[15124]793 </target>
794
[24607]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. -->
[15124]797 <target name="configure-java-version" depends="init"
[15139]798 description="Activates or deactivates some jar libraries as needed depending on your java version">
[15136]799
[15799]800 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
[15124]801 <condition property="need.xalan.jar">
[15799]802 <or>
[24607]803 <not><equals arg1="1.4" arg2="${ant.java.version}"/></not>
[15799]804 </or>
805 </condition>
[15136]806
[15799]807 <!-- if they have xalan.jar but dont need it -->
808 <if>
809 <bool>
[16936]810 <and>
811 <isset property="have.xalan.jar"/>
812 <not><isset property="need.xalan.jar"/></not>
813 </and>
[15799]814 </bool>
815 <antcall target="deactivate-xalan-jar"/>
816 </if>
[15136]817
[15799]818 <!-- if they need xalan.jar but dont have it -->
819 <if>
820 <bool>
[16936]821 <and>
822 <not><isset property="have.xalan.jar"/></not>
823 <isset property="need.xalan.jar"/>
824 </and>
[15799]825 </bool>
826 <antcall target="activate-xalan-jar"/>
827 </if>
[15136]828
[15124]829 </target>
830
[15139]831 <target name="activate-xalan-jar">
[15799]832 <echo>activating xalan.jar</echo>
[15124]833 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
[20085]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"/>
[15799]842 </if>
[15124]843 </target>
[15035]844
[15139]845 <target name="deactivate-xalan-jar">
[15799]846 <echo>deactivating xalan.jar</echo>
[15124]847 <delete file="${web.lib}/xalan.jar"/>
[20089]848 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
[15124]849 </target>
850
[15837]851
[25491]852 <target name="prepare-collections" depends="init"
853 description="Unpack all the collections from their svn zipped versions">
[16936]854 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
[17008]855 <property name="index.zip" value="index.zip"/>
[15799]856
[16936]857 <echo message="installing collections..."/>
858 <antcall target="gs2mgdemo-install"/>
859 <antcall target="gs2mgppdemo-install"/>
860 <antcall target="gberg-install"/>
[25214]861 <antcall target="lucene-jdbm-demo-install"/>
[16936]862 </target>
[15837]863
[16936]864 <target name="gs2mgdemo-prepare" if="collect.dir">
865 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
[15799]866
[16936]867 <condition property="gs2mgdemo.present">
868 <and>
[15837]869 <available file="${gs2mgdemo.dir}/${index.zip}"/>
[16936]870 </and>
871 </condition>
872 </target>
[15799]873
[17008]874 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
875 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
[16936]876 <echo>collection gs2mgdemo installed</echo>
877 </target>
[15799]878
[16936]879 <target name="gs2mgppdemo-prepare" if="collect.dir">
880 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
[15837]881
[16936]882 <condition property="gs2mgppdemo.present">
883 <and>
[15837]884 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
[16936]885 </and>
886 </condition>
887 </target>
[15799]888
[16936]889 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
[17008]890 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
[16936]891 <echo>collection gs2mgppdemo installed</echo>
892 </target>
[15799]893
[16936]894 <target name="gberg-prepare" if="collect.dir">
895 <property name="gberg.dir" value="${collect.dir}/gberg"/>
[17008]896 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
[16936]897 </target>
[15799]898
[16936]899 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
[19878]900 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
[16936]901 <echo>collection gberg installed</echo>
902 </target>
[15799]903
[25214]904 <target name="lucene-jdbm-demo-prepare" if="collect.dir">
905 <property name="lucene-jdbm-demo.dir" value="${collect.dir}/lucene-jdbm-demo"/>
[25491]906 <available file="${lucene-jdbm-demo.dir}/${index.zip}" property="lucene-jdbm-demo.present"/>
[25214]907 </target>
908
909 <target name="lucene-jdbm-demo-install" if="lucene-jdbm-demo.present" depends="lucene-jdbm-demo-prepare">
[25491]910 <unzip dest="${lucene-jdbm-demo.dir}" src="${lucene-jdbm-demo.dir}/${index.zip}"/>
[25214]911 <echo>collection lucene-jdbm-demo installed</echo>
912 </target>
913
[23854]914 <target name="configure-web" depends="init,perl-for-building"
[15124]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>
[24868]920 <stringutil string="${perl.path}" property="escaped.perl.path">
921 <replace regex="\\" replacement="\\\\" />
922 </stringutil>
923
[25830]924 <filter token="gsdlhome" value="${gs2build.home}"/>
925 <filter token="gsdl3srchome" value="${basedir}"/>
[15124]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}"/>
[24868]930 <filter token="perlpath" value="${escaped.perl.path}"/>
[25570]931 <filter token="disable.collection.building" value="${disable.collection.building}"/>
[25830]932 <copy file="${basedir}/web/WEB-INF/cgi/gsdl3site.cfg.in" tofile="${basedir}/web/WEB-INF/cgi/gsdl3site.cfg" filtering="true" overwrite="true"/>
[15124]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}">
[16936]945 <classpath><path refid="compile.classpath"/></classpath>
[15124]946 </javac>
947 </target>
948
[20209]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>
[20211]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"/>
[20209]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
[15799]978 <target name="svnupdate-web" unless="nosvn.mode">
[20930]979 <exec executable="svn">
980 <arg value="update"/>
981 <arg value="${web.home}"/>
982 <arg value="-r"/><arg value="${branch.revision}"/>
983 </exec>
[15799]984 </target>
[15124]985
986 <target name="update-web" depends="init,svnupdate-web,configure-web"
987 description="update only the web stuff (config files)"/>
988
[15799]989 <!-- ======================= Tomcat Targets ========================== -->
[15124]990
991 <!-- this target downloads and installs Tomcat -->
[25131]992 <!-- we download tomcat (version 7 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
[20089]993 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
[25131]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>
[16951]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}"/>
[20085]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
[16951]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>
[25133]1024 <!--
[16951]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"/>
[25133]1031 -->
[16951]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
[20089]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"/>
[16951]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
[15124]1052 </target>
1053
1054 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1055
[25570]1056 <target name="configure-tomcat-local" depends="init,perl-for-building" if="tomcat.islocal">
[15124]1057 <!-- re-setup the server.xml file -->
[20079]1058 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
1059 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
[15124]1060 <filterset>
[16936]1061 <filter token="port" value="${tomcat.port}"/>
1062 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
[15124]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>
[16936]1068 <filter token="gsdl3webhome" value="${web.home}"/>
[22320]1069 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
[15124]1070 </filterset>
1071 </copy>
[25570]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>
[15124]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>
[26495]1085
[22551]1086
[26495]1087 <!-- This target runs tomcat's "bin/catalina.bat(.sh) jpda start"
1088 to allow debugging the running GS3 server in Eclipse. See the instructions at
1089 http://www.wikijava.org/wiki/Debugging_a_servlet_with_tomcat_and_Eclipse_tutorial
1090 on how to use this with eclipse
1091 -->
1092 <target name="debug-start-tomcat" description="Startup Tomcat for debugger" depends="init" if="tomcat.islocal">
1093 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
1094 <property name="tomcat.path" refid="local.tomcat.path"/>
1095
1096 <if><bool>
1097 <isset property="fedora.maxpermsize"/></bool>
1098 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M ${fedora.maxpermsize}"/>
1099 <else>
1100 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
1101 </else>
1102 </if>
1103
1104 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
1105 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
1106
1107 <exec executable="${catalina.home}/bin/catalina.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1108 <arg value="jpda" />
1109 <arg value="start" />
1110 <env key="JPDA_ADDRESS" value="8000"/> <!-- for debugging Tomcat in Eclipse -->
1111 <env key="JPDA_TRANSPORT" value="dt_socket"/> <!-- for debugging Tomcat in Eclipse -->
1112 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1113 <env key="PATH" path="${tomcat.path}"/>
1114 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1115 <env key="CATALINA_HOME" value="${catalina.home}"/>
1116 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1117 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
1118 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
1119 <env key="WNHOME" path="${wn.home}"/>
1120 <env key="FEDORA_HOME" path="${fedora.home}"/>
1121 </exec>
1122 <exec executable="${catalina.home}/bin/catalina.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
1123 <arg value="jpda" />
1124 <arg value="start" />
1125 <env key="JPDA_ADDRESS" value="8000"/> <!-- for debugging Tomcat in Eclipse -->
1126 <env key="JPDA_TRANSPORT" value="dt_socket"/> <!-- for debugging Tomcat in Eclipse -->
1127 <env key="GSDLOS" value="windows"/>
1128 <env key="GSDL3HOME" value="${basedir}"/>
1129 <env key="Path" path="${tomcat.path}"/>
1130 <env key="PATH" path="${tomcat.path}"/>
1131 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1132 <env key="CATALINA_HOME" value="${catalina.home}"/>
1133 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1134 <env key="FEDORA_HOME" path="${fedora.home}"/>
1135 </exec>
1136 <!-- wait for the server to startup in case other targets need it running -->
1137 <waitfor maxwait="5" maxwaitunit="second">
1138 <and>
1139 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1140 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
1141 </and>
1142 </waitfor>
1143 </target>
[23854]1144
1145
[22551]1146<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
[20089]1147 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
[15799]1148 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
[15124]1149 <property name="tomcat.path" refid="local.tomcat.path"/>
[25095]1150
[26359]1151 <if><bool>
1152 <isset property="fedora.maxpermsize"/></bool>
1153 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M ${fedora.maxpermsize}"/>
1154 <else>
1155 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
1156 </else>
1157 </if>
1158
[25095]1159 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
1160 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
1161
[21351]1162 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]1163 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1164 <env key="GSDL3HOME" value="${basedir}"/>
1165 <env key="PATH" path="${tomcat.path}"/>
1166 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1167 <env key="CATALINA_HOME" value="${catalina.home}"/>
1168 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1169 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
[22184]1170 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
[15124]1171 <env key="WNHOME" path="${wn.home}"/>
[26433]1172 <env key="FEDORA_HOME" path="${fedora.home}"/>
[15124]1173 </exec>
[25616]1174 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
[15124]1175 <env key="GSDLOS" value="windows"/>
1176 <env key="GSDL3HOME" value="${basedir}"/>
1177 <env key="Path" path="${tomcat.path}"/>
1178 <env key="PATH" path="${tomcat.path}"/>
1179 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
[16628]1180 <env key="CATALINA_HOME" value="${catalina.home}"/>
[15124]1181 <env key="CLASSPATH" path="${tomcat.classpath}"/>
[26433]1182 <env key="FEDORA_HOME" path="${fedora.home}"/>
[15124]1183 </exec>
1184 <!-- wait for the server to startup in case other targets need it running -->
1185 <waitfor maxwait="5" maxwaitunit="second">
1186 <and>
[16936]1187 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1188 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
[15124]1189 </and>
1190 </waitfor>
1191 </target>
1192
[22551]1193 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
1194 <target name="reconfigure" description="Reconfigure the message router">
1195 <waitfor maxwait="5" maxwaitunit="second">
1196 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
1197 </waitfor>
1198 </target>
1199
1200 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
1201 <target name="reconfigure-collection" description="Reconfigure the collection">
1202 <waitfor maxwait="5" maxwaitunit="second">
1203 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
1204 </waitfor>
1205 </target>
1206
[15124]1207 <!-- windows: do we want to launch a webrowser?? -->
[25418]1208 <!-- shouldn't this test whether anything is running first?
1209 It's safer to always attempt to stop tomcat: that way we won't be dependent on the right time
1210 to check whether the server is stopped or still running before attempting to start again.
1211 This target, which was recently called force-stop-tomcat for a while but is back to being
1212 called stop-tomcat, now hides the Java exception output that appears whenever tomcat is already
1213 stopped as happens when stop-tomcat is called consecutively. -->
[25420]1214 <target name="force-stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
[21351]1215 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[26433]1216 <env key="FEDORA_HOME" path="${fedora.home}"/>
[15124]1217 <env key="CATALINA_HOME" value="${catalina.home}"/>
[25418]1218 <arg line=">/dev/null 2>&amp;1"/>
[15124]1219 </exec>
[21351]1220 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
[26433]1221 <env key="FEDORA_HOME" path="${fedora.home}"/>
[16628]1222 <env key="CATALINA_HOME" value="${catalina.home}"/>
[25418]1223 <arg line=">nul 2>&amp;1"/>
[25443]1224 </exec>
[15124]1225 </target>
1226
[25418]1227 <!-- Can also try the "socket" condition in place of the "http" condition
1228 And also use a <waitfor> in place of <condition>, such as:
1229 <waitfor maxwait="5" maxwaitunit="second" timeoutproperty="tomcat.isstopped"><http url="..."/></waitfor>
[25420]1230 The http URL resolves to host:port/greenstone3
1231 Condition uses <http/> rather than <socket/> for testing, since if the server was stopped, the socket
1232 might still be in use for some moments. We test the URL with the http condition since it's likelier to
1233 fail sooner if the server has indeed been stopped. -->
[25418]1234 <target name="check-tomcat-running">
1235 <condition property="tomcat.isrunning">
1236 <http url="http://${tomcat.server}:${tomcat.port}${app.path}"/>
1237 </condition>
[25321]1238 </target>
1239
[25443]1240 <!-- stop-tomcat checks if the tomcat server is already running. If it appears to be running
1241 (regardless of whether tomcat was just starting to shut down), this target calls force-stop-tomcat
1242 to issue the shutdown command to tomcat. Then it waits for at most 15 seconds for the server to
1243 actually stop by checking the socket at which tomcat listens every second, printing a warning
1244 at the end of the max wait time of 15 seconds if tomcat was still running. -->
1245 <target name="stop-tomcat" description="Shutdown only Tomcat if running" depends="check-tomcat-running" if="tomcat.isrunning">
[25321]1246 <antcall target="force-stop-tomcat"/>
[25443]1247
1248 <property name="wait.numchecks" value="15"/>
1249 <echo>Waiting for the server to shutdown... (${wait.numchecks} seconds max)</echo>
1250 <waitfor maxwait="${wait.numchecks}" maxwaitunit="second" checkevery="1" checkeveryunit="second" timeoutproperty="tomcat.timedout">
[25444]1251 <not><socket server="${tomcat.server}" port="${tomcat.port}"/></not>
[25443]1252 </waitfor>
1253
1254 <if>
1255 <bool>
1256 <isset property="${tomcat.timedout}"/>
1257 </bool>
1258 <property name="tomcat.isrunning" value="true"/>
1259 <echo>WARNING: Checked the socket ${wait.numchecks} times, but port ${tomcat.port} is still busy.</echo>
1260 <else>
1261 <echo>Tomcat is stopped.</echo>
1262 <property name="tomcat.isrunning" value="false"/>
1263 </else>
1264 </if>
[25420]1265 </target>
[25321]1266
[15124]1267 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
1268
1269 <target name="setup-catalina-ant-tasks">
1270 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
1271 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
1272 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1273 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
1274 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1275 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
1276 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1277 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
1278 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1279 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
1280 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1281 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
1282 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1283 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
1284 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1285 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
1286 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1287 </target>
1288
[25449]1289 <!-- http://blog.andrewbeacock.com/2007/11/how-to-truncate-log-file-using-ubuntu.html
1290 Doing "cat </dev/null > packages/tomcat/logs/catalina.out" doesn't work as an ant target.
1291 It seems to have a problem with cat or </dev/null, with or without the < sign. -->
1292 <target name="clean-logs" description="Empties catalina.out, greenstone.log and contents of web/logs/tmp">
[26185]1293 <echo>Truncating catalina.out, greenstone.log and server.log, and emptying ${web.home}/logs/tmp</echo>
1294 <exec executable="rm" os="${os.unix}" dir="${catalina.home}/logs" spawn="false">
1295 <arg value="-f"/>
[25449]1296 <arg value="catalina.out"/>
1297 </exec>
[26185]1298 <exec executable="rm" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1299 <arg value="-f"/>
[25449]1300 <arg value="greenstone.log"/>
1301 </exec>
[26185]1302 <exec executable="rm" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1303 <arg value="-f"/>
[26002]1304 <arg value="server.log"/>
1305 </exec>
[15124]1306
[26185]1307 <exec executable="touch" os="${os.unix}" dir="${catalina.home}/logs"
1308 spawn="false">
1309 <arg value="catalina.out"/>
1310 </exec>
1311 <exec executable="touch" os="${os.unix}" dir="${web.home}/logs"
1312 spawn="false">
1313 <arg value="greenstone.log"/>
1314 </exec>
1315 <exec executable="touch" os="${os.unix}" dir="${web.home}/logs"
1316 spawn="false">
1317 <arg value="server.log"/>
1318 </exec>
1319
[25449]1320 <exec executable="cmd" os="${os.windows}" dir="${catalina.home}/logs" spawn="false">
1321 <arg line="/c echo. > catalina.out"/>
1322 </exec>
1323 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1324 <arg line="/c echo. > greenstone.log"/>
1325 </exec>
[26002]1326 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1327 <arg line="/c echo. > server.log"/>
1328 </exec>
[25449]1329
[25501]1330 <if>
1331 <bool><available file="${web.home}/logs/tmp" type="dir"/></bool>
1332 <delete>
1333 <fileset dir="${web.home}/logs/tmp" includes="**/*"/>
1334 </delete>
1335 </if>
[25449]1336 </target>
1337
[15799]1338 <!-- ======================= ant Targets ============================ -->
[15124]1339 <target name="prepare-ant" depends="init">
[16951]1340 <if>
1341 <bool>
1342 <not><available file="${packages.home}/ant/.flagfile"/></not>
1343 </bool>
1344
1345 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1346 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1347 usetimestamp="true"/>
1348 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1349 dest="${packages.home}"/>
1350 <move todir="${packages.home}/ant">
1351 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1352 </move>
1353 <echo file="${packages.home}/ant/.flagfile">
1354 the timestamp of this file is the time that ant was extracted from the zip files.
1355 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1356 </echo>
1357
1358 <else>
1359 <echo>Ant has been prepared, will not prepare</echo>
1360 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1361 </else>
1362
1363 </if>
[15124]1364 </target>
1365
[25338]1366 <!-- ======================= Admin Targets ============================ -->
1367
1368 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1369 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1370 But you can do: echo mypassword | ant config-admin -->
1371 <target name="config-admin" description="Reset admin password">
1372 <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-8 characters):&gt;">
1373 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1374 </input>
[25343]1375 <!--<echo>PWD: ${admin.password}</echo>-->
[25338]1376 <antcall target="update-userdb">
1377 <param name="user.username" value="admin"/>
1378 <param name="user.password" value="${admin.password}"/>
1379 <param name="user.groups" value=""/>
1380 <param name="user.status" value=""/>
1381 <param name="user.comment" value="Password updated."/>
1382 <param name="user.email" value=""/>
1383 </antcall>
1384 </target>
1385
1386 <target name="config-user" description="Add or modify users" depends="get-user-data,update-userdb"/>
1387
1388 <target name="get-user-data" description="Get user details">
1389 <input addproperty="user.username" message="Username:&gt;"/>
1390 <input addproperty="user.password" defaultvalue="" message="Password (3-8 characters):&gt;">
1391 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1392 </input>
1393 <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list):&gt;"/>
1394 <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
1395 <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
1396 <input addproperty="user.email" defaultvalue="" message="Email:&gt;"/>
1397 </target>
1398
1399<!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1400 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1401 But you can do: echo mypassword | ant config-admin -->
[25418]1402 <target name="update-userdb" description="Add or modify users" depends="check-tomcat-running">
1403
1404 <!-- stop tomcat if running, since derby db is embedded and only allows connections from one jvm instance at a time
1405 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
1406 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
[25338]1407 <if>
1408 <bool>
1409 <istrue value="${tomcat.isrunning}"/>
1410 </bool>
[25418]1411 <antcall target="stop-tomcat"/>
[25338]1412 </if>
1413
1414 <!--<echo>${admin.password}</echo>--> <!-- for testing -->
1415 <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
1416 <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
1417 <arg file="${web.home}/sites/localsite/etc/usersDB"/>
1418 <arg value="${user.username}"/>
1419 <arg value="password=${user.password}"/>
1420 <arg value="groups=${user.groups}"/>
1421 <arg value="status=${user.status}"/>
1422 <arg value="comment=${user.comment}"/>
1423 <arg value="email=${user.email}"/>
1424 </java>
1425
1426 <!-- run tomcat again if it used to be running -->
1427 <if>
1428 <bool>
1429 <istrue value="${tomcat.isrunning}"/>
1430 </bool>
1431 <antcall target="start-tomcat"/>
1432 </if>
1433 </target>
1434
1435
[20079]1436 <!-- ======================= Axis Targets ============================ -->
1437
[15124]1438 <target name="prepare-axis" depends="init">
[16951]1439
1440 <if>
1441 <bool>
1442 <not><available file="${packages.home}/axis/.flagfile"/></not>
1443 </bool>
1444
1445 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1446 dest="${packages.home}/${axis.zip.version}"
1447 usetimestamp="true"/>
1448 <unzip src="${packages.home}/${axis.zip.version}"
1449 dest="${packages.home}"/>
1450 <move todir="${packages.home}/axis">
1451 <fileset dir="${packages.home}/${axis.dir.version}"/>
1452 </move>
1453 <!-- install axis into greenstone web app -->
1454 <copy todir="${web.lib}">
1455 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1456 <include name="*.jar"/>
1457 </fileset>
1458 </copy>
1459 <copy todir="${web.home}">
1460 <fileset dir="${packages.home}/axis/webapps/axis/">
1461 <include name="*.jsp"/>
1462 <include name="*.jws"/>
1463 </fileset>
1464 </copy>
1465 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1466 <copy todir="${web.classes}">
1467 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1468 <include name="*.properties"/>
1469 </fileset>
1470 </copy>
1471 <echo file="${packages.home}/axis/.flagfile">
1472 the timestamp of this file is the time that axis was extracted from the zip files.
1473 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1474 </echo>
1475
1476 <else>
1477 <echo>Axis has been prepared, will not prepare</echo>
1478 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1479 </else>
1480
1481 </if>
[15124]1482 </target>
1483
[15229]1484 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
[15124]1485 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
[15799]1486
1487 <target name="deploy-site">
[15124]1488 <java classname="org.apache.axis.client.AdminClient">
1489 <classpath refid="compile.classpath"/>
1490 <arg value="-l"/>
1491 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]1492 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1493 </java>
1494 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
[15124]1495 </target>
1496
[15229]1497 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
[15124]1498 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
[15229]1499 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1500 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1501 tofile="${basedir}/resources/soap/undeploy.wsdd"
1502 filtering="true"
1503 overwrite="true"/>
[15124]1504 <java classname="org.apache.axis.client.AdminClient">
1505 <classpath refid="compile.classpath"/>
1506 <arg value="-l"/>
1507 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]1508 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
[15124]1509 </java>
[15229]1510 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
[15799]1511 </target>
[15124]1512
[16936]1513 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1514 with the default servicename of localsite-->
[15124]1515 <target name="deploy-localsite" depends="init"
1516 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1517 <antcall target="start-tomcat"/>
[15235]1518 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
[15229]1519 <antcall target="create-deployment-files">
1520 <param name="axis.sitename" value="localsite"/>
[15235]1521 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]1522 <param name="axis.siteuri" value="localsite"/>
1523 </antcall>
[15124]1524 <antcall target="deploy-site">
1525 <param name="axis.sitename" value="localsite"/>
[15235]1526 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]1527 <param name="axis.siteuri" value="localsite"/>
[15124]1528 </antcall>
[15369]1529 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
[15124]1530 </target>
[15799]1531
[16936]1532 <target name="get-sitename" unless="axis.sitename">
[15229]1533 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
[15235]1534Press Enter for default:localsite</input>
[15124]1535 </target>
1536
[15229]1537 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1538 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1539To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
[20209]1540Or press Enter for undeploying the default:localsite /&gt;</input>
[15229]1541 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
[15124]1542 </target>
1543
[15229]1544 <target name="get-webservices" unless="axis.servicesname">
[15235]1545 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
[15229]1546Choose from: ${web.services.list}
[20209]1547Or press Enter for default:${base.webservice.name} /&gt;</input>
[15229]1548 <echo>${axis.servicesname}</echo>
1549 </target>
1550
1551 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
[15235]1552 <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>
[15229]1553 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1554 </target>
1555
1556 <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">
1557 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
[15235]1558 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15124]1559 </condition>
[15229]1560
1561 <!--everything else defaults to java:RPC at present-->
1562 <condition property="soap.method" value="provider='java:RPC'">
1563 <not>
[15235]1564 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15229]1565 </not>
1566 </condition>
[16936]1567 </target>
[15799]1568
[16936]1569 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
[15124]1570 <filter token="sitename" value="${axis.sitename}"/>
1571 <filter token="siteuri" value="${axis.siteuri}"/>
[15229]1572 <filter token="servicesname" value="${axis.servicesname}"/>
1573 <filter token="soapmethod" value="${soap.method}"/>
[15124]1574 <copy file="${basedir}/resources/soap/site.wsdd.template"
[15229]1575 tofile="${basedir}/resources/soap/deploy.wsdd"
1576 filtering="true"
1577 overwrite="true"/>
[15124]1578 <!-- create the java files and compile them -->
[15229]1579 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1580 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1581 filtering="true"
1582 overwrite="true"/>
[15124]1583 <mkdir dir="${build.home}"/>
1584 <javac srcdir="${src.home}"
1585 destdir="${build.home}"
1586 debug="${compile.debug}"
1587 deprecation="${compile.deprecation}"
1588 optimize="${compile.optimize}">
1589 <classpath refid="compile.classpath"/>
[15229]1590 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
[15124]1591 </javac>
1592 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
[15799]1593 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1594 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1595 overwrite="true" />
[15124]1596 </target>
[15799]1597
[15124]1598
[15799]1599 <!-- ====================== Core targets ============================== -->
1600 <!-- core targets refer to the core gsdl3 java src -->
[15124]1601
[19878]1602 <target name="prepare-core"/>
[15124]1603
1604 <target name="configure-core"/>
1605
1606 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1607 description="Update only the Greenstone core" />
1608
[15799]1609 <target name="svnupdate-core" unless="nosvn.mode">
[20930]1610 <exec executable="svn">
1611 <arg value="update"/>
1612 <arg value="${basedir}"/>
1613 <arg value="-r"/><arg value="${branch.revision}"/>
1614 </exec>
[15124]1615 </target>
1616
1617 <target name="clean-core"
1618 description="Clean only the Greenstone core">
[19878]1619 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
[15124]1620 <delete dir="${build.home}"/>
1621 </target>
1622
[15799]1623 <target name="compile-core" depends="init"
[15124]1624 description="Compile only the Greenstone core">
1625 <mkdir dir="${build.home}"/>
[25131]1626
[23803]1627 <if><bool><isset property="with.jni"/></bool>
1628 <javac srcdir="${src.home}"
1629 destdir="${build.home}"
1630 debug="${compile.debug}"
1631 deprecation="${compile.deprecation}"
1632 optimize="${compile.optimize}">
1633 <classpath>
1634 <path refid="compile.classpath"/>
1635 </classpath>
1636 </javac>
1637 <else>
1638 <property name="gsprefix" value=""/>
1639 <javac srcdir="${src.home}"
1640 destdir="${build.home}"
1641 debug="${compile.debug}"
1642 deprecation="${compile.deprecation}"
1643 optimize="${compile.optimize}">
1644 <classpath>
1645 <path refid="compile.classpath"/>
1646 </classpath>
1647 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1648 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1649 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1650 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1651 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1652 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1653 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1654 </javac>
1655 </else>
1656 </if>
[15124]1657 <jar destfile="${build.home}/gsdl3.jar">
1658 <fileset dir="${build.home}">
[16936]1659 <include name="org/greenstone/gsdl3/**"/>
[15124]1660 <include name="org/flax/**"/>
[16936]1661 <exclude name="**/Test.class"/>
[15124]1662 </fileset>
1663 <manifest>
[16936]1664 <attribute name="Built-By" value="${user.name}" />
[15124]1665 </manifest>
1666 </jar>
1667 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
[22101]1668
1669 <jar destfile="${build.home}/gutil.jar">
1670 <fileset dir="${build.home}">
1671 <include name="org/greenstone/util/**"/>
1672 </fileset>
1673 <manifest>
1674 <attribute name="Built-By" value="${user.name}" />
1675 </manifest>
1676 </jar>
1677 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1678
[15124]1679 <!-- copy the localsite server in case we need it -->
[15235]1680 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
[15124]1681
[17918]1682 <!-- Greenstone Administrator Interface -->
[15124]1683 <jar destfile="${build.home}/GAI.jar">
1684 <fileset dir="${build.home}">
[16936]1685 <include name="org/greenstone/admin/**"/>
[15124]1686 </fileset>
1687 <manifest>
[16936]1688 <attribute name="Built-By" value="${user.name}" />
[15124]1689 </manifest>
1690 </jar>
[17917]1691 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
[18124]1692 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
[15124]1693 <jar destfile="${build.home}/phind.jar">
1694 <fileset dir="${build.home}">
[16936]1695 <include name="org/greenstone/applet/phind/**"/>
[15124]1696 </fileset>
1697 <manifest>
[16936]1698 <attribute name="Built-By" value="${user.name}" />
[15124]1699 </manifest>
1700 </jar>
1701 <mkdir dir="${web.applet}"/>
1702 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1703 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
[18515]1704 <if>
1705 <bool><istrue value="${tomcat.islocal}"/></bool>
[20085]1706 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1707 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
[18515]1708 </if>
1709
1710
[17116]1711 <!-- skip anttasks for now
[15124]1712 <jar destfile="${build.home}/anttasks.jar">
1713 <fileset dir="${build.home}">
[16936]1714 <include name="org/greenstone/anttasks/**"/>
[15124]1715 </fileset>
1716 <manifest>
[16936]1717 <attribute name="Built-By" value="${user.name}" />
[15124]1718 </manifest>
1719 </jar>
[17116]1720 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
[15124]1721 <jar destfile="${build.home}/gsdl3test.jar">
1722 <fileset dir="${build.home}">
[16936]1723 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1724 <include name="org/greenstone/testing/**"/>
[15124]1725 </fileset>
1726 <manifest>
[16936]1727 <attribute name="Built-By" value="${user.name}" />
[15124]1728 </manifest>
1729 </jar>
1730 <jar destfile="${build.home}/server.jar">
1731 <fileset dir="${build.home}">
[16936]1732 <include name="org/greenstone/server/**"/>
[22634]1733 <include name="org/greenstone/util/**"/>
[15124]1734 </fileset>
1735 <fileset file="${basedir}/resources/java/server.properties"/>
1736 <manifest>
[16936]1737 <attribute name="Built-By" value="${user.name}"/>
[15124]1738 </manifest>
1739 </jar>
1740 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1741 </target>
[15799]1742
1743 <!-- ================== Packages targets ================================ -->
[15124]1744 <!-- these targets refer to the greenstone source packages - these need
1745 updating less often, so are in separate targets to the core -->
[19871]1746 <target name="prepare-packages" depends="init"/>
[15124]1747
1748 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1749 description="Update only the source packages"/>
1750
[15799]1751 <target name="svnupdate-packages" unless="nosvn.mode">
[20930]1752 <exec executable="svn">
1753 <arg value="update"/>
1754 <arg value="${src.packages.home}"/>
1755 <arg value="-r"/><arg value="${branch.revision}"/>
1756 </exec>
[15124]1757 </target>
[19931]1758
[15124]1759
[19871]1760 <target name="configure-packages" depends="init,configure-javagdbm"
[15124]1761 description="Configure only the packages."/>
1762
[22184]1763 <target name="configure-javagdbm" if="with.jni">
[15124]1764 <echo>
1765 Configuring JavaGDBM
1766 </echo>
[18417]1767
[19904]1768 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15124]1769 <arg value="--prefix=${basedir}"/>
1770 <arg value="--libdir=${lib.jni}"/>
[19873]1771 <arg value="--with-gdbm=${gdbm.home}"/>
[15124]1772 </exec>
1773 </target>
1774
[19871]1775 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
[15124]1776
1777 <target name="clean-javagdbm" depends="init">
[26082]1778 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
[15124]1779 <exec executable="make" os="${os.unix}"
[19904]1780 dir="${javagdbm.home}" failonerror="true">
[15124]1781 <arg value="clean"/>
1782 </exec>
[26082]1783 </if>
[15124]1784 </target>
1785
[19871]1786 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
[15185]1787
[15799]1788 <target name="distclean-javagdbm" depends="init">
[26079]1789 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
[15799]1790 <exec executable="make" os="${os.unix}"
[19904]1791 dir="${javagdbm.home}" failonerror="true">
[15799]1792 <arg value="distclean"/>
1793 </exec>
[26079]1794 </if>
[15799]1795 </target>
1796
1797 <target name="compile-packages" description="Compile only the source packages">
[22184]1798 <!-- javagdbm -->
1799 <antcall target="compile-javagdbm"/>
1800 <!-- Search4j -->
1801 <antcall target="compile-search4j"/>
1802 </target>
1803
1804 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
[15799]1805
[19878]1806 <!-- unix: -->
[15799]1807 <echo>compile javagdbm</echo>
[19904]1808 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1809 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15799]1810 <arg value="install"/>
1811 </exec>
[15098]1812
[23852]1813 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1814 "all" which will then perform both the compile AND link targets in jni/win32.mak
1815 (thereby also generating gdbmjava.dll). Then we run the same command with
1816 the "install" argument to copy the gdbmjava.dll into the correct location. -->
[23849]1817 <echo>Windows: compile javagdbm</echo>
[24076]1818 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1819 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23852]1820 </exec>
1821 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
[24076]1822 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23847]1823 <arg value="install"/>
[15799]1824 </exec>
[15124]1825
[15799]1826 <!-- install the jar file -->
[23847]1827 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
[15799]1828 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1829 </target>
1830
[17491]1831 <target name="compile-search4j">
[17509]1832
[19996]1833 <!-- windows -->
[19997]1834 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[19996]1835 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1836 <arg value="/f"/>
1837 <arg value="win32.mak"/>
1838 <arg value='BINDIR="${basedir}\bin"'/>
1839 </exec>
1840 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1841 <arg value="/f"/>
1842 <arg value="win32.mak"/>
1843 <arg value="install"/>
1844 <arg value='BINDIR="${basedir}\bin"'/>
1845 </exec>
[17509]1846
[19996]1847 <!-- unix -->
[19997]1848 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
[19996]1849 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1850 <arg value="--bindir=${basedir}/bin"/>
1851 <arg value="${static.arg}"/>
1852 </exec>
1853 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1854 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1855 <arg value="install"/>
1856 </exec>
[17509]1857
[19996]1858 <!-- else warn -->
1859 <else>
1860 <fail>this target does not support the current os</fail>
[17509]1861
[19996]1862 </else></if></else></if>
1863
[17491]1864 </target>
1865
[19871]1866 <target name="install-auxiliary-jar-files" depends="init">
[22184]1867
1868 <if>
1869 <bool><available file="${mg.home}/mg.jar"/></bool>
1870 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1871 </if>
1872
1873 <if>
[22199]1874 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
[22184]1875 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1876 </if>
1877
[24744]1878 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${web.lib}"/>
[19871]1879 </target>
1880
[22976]1881 <target name="install-jni-files" depends="init" if="with.jni">
1882 <antcall target="install-jni-files-linux"/>
1883 <antcall target="install-jni-files-windows"/>
1884 <antcall target="install-jni-files-macos"/>
1885 </target>
[15124]1886
[15799]1887 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
[15124]1888 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1889 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
[15799]1890 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
[15124]1891 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1892 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
[15799]1893 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1894 </target>
1895 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
[15124]1896 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1897 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
[15799]1898 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
[15124]1899 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1900 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
[15799]1901 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1902 </target>
1903 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
[15124]1904 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1905 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
[15799]1906 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
[15124]1907 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1908 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
[15799]1909 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1910 </target>
1911
[19871]1912 <!-- ========common-src targets =================================-->
1913 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1914 collection building is not enabled -->
1915
1916 <target name="update-common-src" depends="init" if="collection.building.disabled">
1917 </target>
[19931]1918
[19871]1919 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
[20930]1920 <exec executable="svn">
1921 <arg value="update"/>
1922 <arg value="${common.src.home}"/>
1923 <arg value="-r"/><arg value="${branch.revision}"/>
1924 </exec>
[19871]1925 </target>
1926
[19878]1927 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
[19871]1928 <antcall target="checkout-common-src"/>
1929 <antcall target="unzip-windows-packages"/>
1930 </target>
1931
1932 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1933 <echo>checking out common-src</echo>
[20930]1934 <exec executable="svn">
1935 <arg value="checkout"/>
[21196]1936 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
[20930]1937 <arg value="common-src"/>
1938 <arg value="-r"/><arg value="${branch.revision}"/>
1939 </exec>
[19871]1940 </target>
1941
[19931]1942 <target name="configure-common-src" depends="init">
[19871]1943 <exec executable="${common.src.home}/configure" os="${os.unix}"
[19904]1944 dir="${common.src.home}" failonerror="true">
[19931]1945 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
[19933]1946 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
[22184]1947 <arg line="${gs2.opt.args}"/>
[22854]1948 <arg line="${static.arg}"/>
[23611]1949 <arg line="${allargs}"/>
[19871]1950 </exec>
1951 </target>
1952
[19931]1953 <target name="clean-common-src" depends="init">
[19871]1954 <!-- unix: -->
[26082]1955 <if><bool><available file="${common.src.home}/Makefile"/></bool>
[19904]1956 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]1957 <arg value="clean"/>
1958 </exec>
[26082]1959 </if>
[19871]1960 <!-- windows: -->
[19904]1961 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
[19871]1962 <arg value="/f"/>
1963 <arg value="win32.mak"/>
1964 <arg value="clean"/>
[19960]1965 <arg value="GSDLHOME=${gs2build.home}"/>
[19871]1966 </exec>
1967 </target>
[19931]1968 <target name="distclean-common-src" depends="init">
[19960]1969 <!-- unix: -->
[26079]1970 <if><bool><available file="${common.src.home}/Makefile"/></bool>
[19904]1971 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]1972 <arg value="distclean"/>
1973 </exec>
[26079]1974 </if>
[19960]1975 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1976 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1977 <arg value="/f"/>
1978 <arg value="win32.mak"/>
1979 <arg value="clean"/>
1980 <arg value="GSDLHOME=${gs2build.home}"/>
1981 </exec>
[19871]1982 </target>
[19931]1983 <target name="compile-common-src" depends="init">
[19871]1984 <!-- unix: -->
[19904]1985 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]1986 <arg value="${gs2.compile.target}"/>
[19871]1987 </exec>
1988 <!-- windows: -->
[19904]1989 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
[19871]1990 <arg value="/f"/>
1991 <arg value="win32.mak"/>
[19934]1992 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]1993 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[22976]1994 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1995 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1996 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1997 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
[19871]1998 </exec>
1999 </target>
2000
[19843]2001 <!-- ======= collection-building targets ===========================-->
[15124]2002
[19843]2003 <target name="update-collection-building" if="collection.building.enabled"
[19931]2004 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"
[19843]2005 description="Update (SVN update, configure, compile etc) only the collection building components"/>
[15124]2006
[19843]2007 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
2008 description="SVN update the collection building components">
2009 </target>
[15124]2010
[19843]2011 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
[15124]2012 </target>
2013
[19931]2014 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
2015 description="Configure the collection building components">
[19843]2016 </target>
[15098]2017
[19948]2018 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
[19843]2019 description="Clean only the collection building components"
2020 if="collection.building.enabled"/>
[18495]2021
[19948]2022 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
[19843]2023 description="Distclean only the collection building components"
2024 if="collection.building.enabled"/>
2025
[19931]2026 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
[19843]2027 description="Compile only the collection building components">
[19931]2028 <!-- make install for common-src -->
2029 <!-- unix: -->
2030 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]2031 <arg value="${gs2.install.target}"/>
[19931]2032 </exec>
2033
2034 <!-- windows: -->
2035 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
2036 <arg value="/f"/>
2037 <arg value="win32.mak"/>
[21370]2038 <arg value="install"/>
[23837]2039 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]2040 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[23837]2041 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
2042 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
2043 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
2044 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
2045 <!--
2046 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
2047 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
[19931]2048 </exec>
2049
2050 <!-- install gs2build indexers for windows -->
2051 <if>
2052 <bool><istrue value="${current.os.iswindows}"/></bool>
2053 <copy todir="${gs2build.home}/bin/windows">
2054 <fileset dir="${gs2build.home}/common-src/indexers/bin">
2055 <include name="*.*"/>
2056 </fileset>
2057 </copy>
2058 </if>
2059
2060 <!-- LuceneWrapper jar file not installed by default -->
2061 <mkdir dir="${gs2build.home}/bin/java"/>
[24744]2062 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${gs2build.home}/bin/java"/>
[19931]2063
[15124]2064 </target>
[19843]2065
2066 <!-- ============== gli targets ================================= -->
[15799]2067 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
[19929]2068
[20930]2069 <exec executable="svn">
2070 <arg value="update"/>
2071 <arg value="${gli.home}"/>
2072 <arg value="-r"/><arg value="${branch.revision}"/>
2073 </exec>
2074
[21196]2075 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]2076 <arg value="export"/>
2077 <arg value="-r"/><arg value="${branch.revision}"/>
[25136]2078 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
[20930]2079 </exec>
[21196]2080 <exec executable="svn" dir="web/WEB-INF/cgi">
2081 <arg value="export"/>
2082 <arg value="-r"/><arg value="${branch.revision}"/>
[25136]2083 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
[21196]2084 </exec>
[20930]2085
[15124]2086 </target>
2087
[19843]2088 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
[19911]2089 <!-- checkout -->
[23808]2090 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
[19929]2091
[20930]2092 <exec executable="svn">
2093 <arg value="checkout"/>
[21196]2094 <arg value="${svn.root}/main/${branch.path}/gli"/>
[20930]2095 <arg value="-r"/><arg value="${branch.revision}"/>
2096 </exec>
2097
[21196]2098 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]2099 <arg value="export"/>
2100 <arg value="-r"/><arg value="${branch.revision}"/>
[25570]2101 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
[20930]2102 </exec>
[21196]2103 <exec executable="svn" dir="web/WEB-INF/cgi">
2104 <arg value="export"/>
2105 <arg value="-r"/><arg value="${branch.revision}"/>
[25570]2106 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
[21196]2107 </exec>
[20930]2108
[19911]2109 </if>
[15124]2110 </target>
[19843]2111
2112 <target name="clean-gli" depends="init" if="collection.building.enabled">
2113 <!-- gli -->
2114 <property name="gli.home" value="${basedir}/gli"/>
2115 <!-- linux -->
2116 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
[20826]2117 resolveExecutable="true" failonerror="true"/>
[19843]2118 <!-- windows -->
2119 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
[20826]2120 resolveExecutable="true" failonerror="true"/>
[19843]2121 </target>
2122
2123 <target name="compile-gli" depends="init" if="collection.building.enabled">
[23808]2124 <if><bool><isset property="with.gli.and.gems"/></bool>
[23807]2125 <!-- gli -->
2126 <property name="gli.home" value="${basedir}/gli"/>
[15098]2127
[23807]2128 <!-- linux -->
2129 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2130 <!--remote gli-->
2131 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
2132 resolveExecutable="true" failonerror="true"/>
2133 <!-- windows -->
2134 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2135 <!--remote gli-->
2136 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
2137 resolveExecutable="true" failonerror="true"/>
2138 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
2139 </if>
[19843]2140 </target>
[15124]2141
[19843]2142 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
[21351]2143 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
[19843]2144 <env key="gsdl3path" path="${basedir}"/>
[19871]2145 <env key="gsdlpath" path="${gs2build.home}"/>
[19843]2146 </exec>
[21351]2147 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
[19843]2148 <env key="gsdl3path" path="${basedir}"/>
[19871]2149 <env key="gsdlpath" path="${gs2build.home}"/>
[19873]2150 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
[19843]2151 </exec>
[21351]2152 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
[19843]2153 <env key="GSDL3PATH" path="${basedir}"/>
[19871]2154 <env key="GSDLPATH" path="${gs2build.home}"/>
[19843]2155 </exec>
2156 <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.
2157 </echo>
2158 </target>
2159
2160 <!-- ================ gs2build targets =========================== -->
2161
2162 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
2163 <echo>svn updating gs2build</echo>
[20930]2164 <exec executable="svn">
2165 <arg value="update"/>
2166 <arg value="${gs2build.home}"/>
2167 <arg value="-r"/><arg value="${branch.revision}"/>
2168 </exec>
[15799]2169 </target>
[19843]2170
[15124]2171 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
2172 <antcall target="checkout-gs2build"/>
2173 <antcall target="unzip-windows-packages"/>
2174 <antcall target="checkout-winbin"/>
2175 <antcall target="get-windows-binaries"/>
2176 <antcall target="delete-winbin"/>
2177 </target>
2178
[19843]2179 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
2180 <echo>checking out gs2build</echo>
[20930]2181 <exec executable="svn">
2182 <arg value="checkout"/>
[21196]2183 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
[20930]2184 <arg value="-r"/><arg value="${branch.revision}"/>
2185 </exec>
2186
[21196]2187
[19843]2188 </target>
2189
[15124]2190 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
[15799]2191 unless="nosvn.mode">
[20930]2192
2193 <exec executable="svn">
2194 <arg value="checkout"/>
[21196]2195 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
[20930]2196 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]2197 <arg value="winbin"/>
[20930]2198 </exec>
2199
[15124]2200 </target>
2201
[15799]2202 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
[20930]2203 <exec executable="svn">
2204 <arg value="update"/>
2205 <arg value="winbin"/>
2206 <arg value="-r"/><arg value="${branch.revision}"/>
2207 </exec>
2208
[15799]2209 </target>
[15124]2210
2211 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
2212 <move todir="${gs2build.home}/bin/windows" failonerror="false">
2213 <fileset dir="${basedir}/winbin/bin"/>
2214 </move>
2215 </target>
[19843]2216
[15124]2217 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
2218 <delete dir="${basedir}/winbin"/>
2219 </target>
2220
[19871]2221 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
2222 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
2223 dest="${common.src.home}/packages/windows/crypt"/>
[18179]2224 <untar compression="gzip"
[19871]2225 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
2226 dest="${common.src.home}/packages/sqlite"/>
2227 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
2228 dest="${common.src.home}/indexers/packages/windows/iconv"/>
[15799]2229 </target>
[19878]2230
[15124]2231 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
2232 <!-- we want a windows path in the setup.bat file -->
2233 <pathconvert targetos="windows" property="gs2build.home.windows">
2234 <path path="${gs2build.home}"/>
2235 </pathconvert>
2236 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
2237 <filterset>
[16620]2238 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
[15799]2239 </filterset>
[15124]2240 </move>
2241 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
2242 </target>
2243
[19843]2244
[19948]2245 <target name="clean-build-src" depends="init" if="collection.building.enabled">
[19871]2246 <!-- unix: -->
[26079]2247 <if><bool><available file="${build.src.home}/Makefile"/></bool>
[19948]2248 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]2249 <arg value="clean"/>
2250 </exec>
[26079]2251 </if>
[15124]2252 <!-- windows: -->
[19948]2253 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[15799]2254 <arg value="/f"/>
2255 <arg value="win32.mak"/>
2256 <arg value="clean"/>
[19960]2257 <arg value="GSDLHOME=${gs2build.home}"/>
[15124]2258 </exec>
2259 </target>
2260
[19948]2261
2262 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
[19960]2263 <!-- unix: -->
[26079]2264 <if><bool><available file="${build.src.home}/Makefile"/></bool>
[19948]2265 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]2266 <arg value="distclean"/>
2267 </exec>
[26079]2268 </if>
[19960]2269 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
2270 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2271 <arg value="/f"/>
2272 <arg value="win32.mak"/>
2273 <arg value="clean"/>
2274 <arg value="GSDLHOME=${gs2build.home}"/>
2275 </exec>
[15124]2276 </target>
[19843]2277
[19931]2278 <target name="configure-build-src" depends="init" if="collection.building.enabled"
2279 description="Configure the build-src component">
2280 <exec executable="${build.src.home}/configure" os="${os.unix}"
2281 dir="${build.src.home}" failonerror="true">
2282 <arg value="--prefix=${gs2build.home}"/>
[23611]2283 <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
[19931]2284 </exec>
2285 </target>
[19910]2286
[19931]2287 <!-- common-src is done separately and needs to be compiled first -->
2288 <target name="compile-build-src" depends="init" if="collection.building.enabled">
2289
2290 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[23611]2291 <arg line="${ldlpath.arg}"/>
[22845]2292 </exec>
2293
2294 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[19931]2295 <arg value="install"/>
2296 </exec>
[19910]2297
[19931]2298 <!-- run the setup script -->
[20826]2299 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
[19910]2300 <!--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-->
[19931]2301 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[19910]2302 <arg value="/f"/>
2303 <arg value="win32.mak"/>
[19934]2304 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]2305 </exec>
[19931]2306 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[19910]2307 <arg value="/f"/>
2308 <arg value="win32.mak"/>
2309 <arg value="install"/>
[19934]2310 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]2311 </exec>
[15124]2312 </target>
2313
2314
[15799]2315 <!-- ======================== TESTING Targets ========================= -->
[15124]2316
2317 <target name="test" description="Run the (incomplete) JUnit test suite "
2318 depends="init">
2319 <mkdir dir="${basedir}/test"/>
2320 <junit printsummary="withOutAndErr"
2321 errorproperty="test.failed"
2322 failureproperty="test.failed"
2323 fork="${junit.fork}">
2324 <formatter type="plain"/>
2325 <classpath>
[16936]2326 <pathelement location="${build.home}/gsdl3test.jar"/>
2327 <path refid="compile.classpath"/>
[15124]2328 </classpath>
2329 <test name="${testcase}" if="testcase"/>
2330 <batchtest todir="${basedir}/test" unless="testcase">
[18505]2331 <fileset dir="${build.home}" includes="**/*Test.class" />
[15124]2332 </batchtest>
2333 </junit>
2334 <echo>
2335 *********************************************
[15799]2336 Test output can be found in directory 'test'
[15124]2337 *********************************************
2338 </echo>
2339 </target>
[15799]2340
[20950]2341 <!-- ======================== FLAX Targets ========================= -->
2342 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2343 <echo>checking out flax ...</echo>
2344 <mkdir dir="${basedir}/src/java/org/flax"/>
2345 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
[22198]2346 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
[20950]2347 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2348 <mkdir dir="${web.home}/interfaces/flax"/>
2349 <mkdir dir="${web.home}/sites/flax"/>
2350 <mkdir dir="${basedir}/flax-resources"/>
2351 <mkdir dir="${basedir}/flax-lib"/>
[21272]2352 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2353 <arg value="src/java/org/flax"/></exec>
2354 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2355 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
[22198]2356 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2357 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2358 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
[21272]2359 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2360 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2361 <arg value="${web.home}/interfaces/flax"/></exec>
2362 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2363 <arg value="${web.home}/sites/flax"/></exec>
2364 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2365 <arg value="flax-resources"/></exec>
2366 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2367 <arg value="flax-lib"/></exec>
[25901]2368 <antcall target="flax-copy-del-files" />
[20950]2369 </target>
[23442]2370
[25901]2371 <target name="flax-copy-del-files" description="copy some flax files into the appropriate greenstone3 directories and delete some unwanted greenstone stuff">
[23442]2372 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2373 <copy todir="${web.home}/WEB-INF/lib">
[25901]2374 <fileset dir="${basedir}/flax-lib">
2375 <include name="*.jar"/>
2376 </fileset>
[23442]2377 </copy>
[25904]2378 <!--<delete dir="${web.home}/sites/gateway"/>
2379 <delete dir="${web.home}/sites/localsite"/>-->
[23442]2380 </target>
[20950]2381
2382 <target name="update-flax" description="update flax from repository">
2383 <echo>updating flax ...</echo>
[21272]2384 <exec executable="svn"><arg value="update"/>
2385 <arg value="src/java/org/flax"/></exec>
2386 <exec executable="svn"><arg value="update"/>
[22198]2387 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2388 <exec executable="svn"><arg value="update"/>
[21272]2389 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2390 <exec executable="svn"><arg value="update"/>
2391 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2392 <exec executable="svn"><arg value="update"/>
2393 <arg value="${web.home}/interfaces/flax"/></exec>
2394 <exec executable="svn"><arg value="update"/>
[24366]2395 <arg value="${web.home}/web/sites/flax"/></exec>
2396 <exec executable="svn"><arg value="update"/>
[21272]2397 <arg value="flax-resources"/></exec>
2398 <exec executable="svn"><arg value="update"/>
2399 <arg value="flax-lib"/></exec>
[24098]2400 <antcall target="compile-core" />
[20950]2401 </target>
2402
[25901]2403 <!-- ========================End of FLAX Targets ========================= -->
[20963]2404
[19354]2405 <target name="compile-javadocs">
2406 <javadoc packagenames="org.greenstone.*"
2407 sourcepath="src/java"
2408 defaultexcludes="yes"
2409 destdir="docs/javadoc"
2410 author="true"
2411 version="true"
2412 use="true"
2413 windowtitle="Greenstone3 API">
2414 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2415 </javadoc>
2416 </target>
2417
[20089]2418<!-- ========== Some distribution targets ======================== -->
[19972]2419 <target name="remove-source">
[23809]2420 <if><bool><isset property="with.gli.and.gems"/></bool>
[19975]2421 <delete includeEmptyDirs="true">
2422 <fileset dir="." defaultexcludes="false">
2423 <patternset refid="greenstone3.source.component"/>
2424 </fileset>
2425 </delete>
[23809]2426
2427 <else>
2428 <delete includeEmptyDirs="true">
2429 <fileset dir="." defaultexcludes="false">
2430 <patternset refid="greenstone3.source.no.gli.component"/>
2431 </fileset>
2432 </delete>
2433 </else>
2434 </if>
[19972]2435 </target>
2436
[19903]2437 <target name="dist-tidy"
2438 description="'tidies-up' a greenstone3 installation for distribution.">
2439
2440 <!-- delete unneeded things -->
2441 <delete dir="${packages.home}/axis"/>
2442 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2443 <delete file="README-SVN.txt"/>
[20215]2444 <delete file="build.properties.in"/>
[19903]2445
[19961]2446 <!-- delete source files -->
[19972]2447 <antcall target="remove-source"/>
[19903]2448
2449 <!-- create empty directories -->
2450 <mkdir dir="${web.home}/applet"/>
2451 <mkdir dir="${web.home}/logs"/>
[25446]2452 <mkdir dir="${web.home}/logs/tmp"/>
[19903]2453
2454 <!-- os specific tidy-ups -->
[20051]2455 <!-- linux, mac -->
2456 <if><bool><istrue value="${current.os.isunix}"/></bool>
[19903]2457 <delete><fileset dir="." includes="*.bat"/></delete>
[23809]2458 <if><bool><isset property="with.gli.and.gems"/></bool>
2459 <delete><fileset dir="gli" includes="*.bat"/></delete>
2460 </if>
[19903]2461 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2462 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
[19946]2463 <delete file="${basedir}/gs2build/win32cfg.h"/>
[19939]2464 <delete file="${basedir}/gs2build/win32.mak"/>
[20051]2465 <delete dir="${basedir}/winutil"/>
[19903]2466 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2467
[20051]2468 <!-- windows -->
2469 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2470 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
[23809]2471 <if><bool><isset property="with.gli.and.gems"/></bool>
2472 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2473 </if>
[20051]2474 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2475 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2476 </if></else></if>
2477
[19903]2478 </target>
2479
[20089]2480 <!-- fix up executable permissions for binary release -->
2481 <target name="fix-execute-permissions">
2482 <echo>Setting binaries to executable</echo>
[20127]2483 <chmod perm="775">
2484 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2485 </chmod>
[20089]2486 </target>
2487
2488 <!-- fix up executable permissions for source code release -->
2489 <target name="fix-execute-permissions-source">
[20127]2490 <chmod perm="775">
2491 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2492 </chmod>
[20089]2493 </target>
2494
2495
[19931]2496 <!-- ============= tweaks for making compilation static ========== -->
2497 <target name="tweak-makefiles" depends="init" if="compile.static">
2498 <antcall target="rtftohtml-add-static" />
2499 </target>
2500
2501 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2502 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2503 </target>
2504
[26115]2505 <target name="run-collection-tests">
2506 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
2507 <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>
2508 </if>
2509 <for param="testjar">
2510 <path>
2511 <fileset dir="${basedir}" includes="web/sites/*/collect/*/tests/tests.jar"/>
2512 </path>
2513 <sequential>
2514 <echo>Testing @{testjar}</echo>
2515 <java classname="org.junit.runner.JUnitCore" fork="true">
2516 <arg value="gstests.TestClass"/>
2517 <jvmarg value="-DSERVERURL=http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet} "/>
2518 <classpath>
2519 <fileset dir="${basedir}/ext/testing/lib/java">
2520 <include name="*.jar"/>
2521 </fileset>
2522 <files includes="@{testjar}"/>
2523 </classpath>
2524 </java>
2525 </sequential>
2526 </for>
2527 </target>
2528
2529 <target name="build-collection-tests">
2530 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
2531 <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>
2532 </if>
2533 <for param="compiledir">
2534 <path>
2535 <dirset dir="${basedir}" includes="web/sites/*/collect/*/tests/src"/>
2536 </path>
2537 <sequential>
2538 <echo>Compiling @{compiledir}</echo>
2539 <if><bool><not><available file="@{compiledir}/../build" type="dir"/></not></bool>
2540 <mkdir dir="@{compiledir}/../build"/>
2541 </if>
2542 <javac
2543 srcdir="@{compiledir}"
2544 destdir="@{compiledir}/../build"
2545 debug="${compile.debug}"
2546 deprecation="${compile.deprecation}"
2547 optimize="${compile.optimize}">
2548 <classpath>
2549 <fileset dir="${basedir}/ext/testing/lib/java">
2550 <include name="*.jar"/>
2551 </fileset>
2552 </classpath>
2553 <include name="gstests/*.java"/>
2554 </javac>
2555 <jar destfile="@{compiledir}/../tests.jar">
2556 <fileset dir="@{compiledir}/../build">
2557 <include name="gstests/**"/>
2558 </fileset>
2559 <manifest>
2560 <attribute name="Built-By" value="${user.name}" />
2561 </manifest>
2562 </jar>
2563 </sequential>
2564 </for>
2565 </target>
[26002]2566</project>
Note: See TracBrowser for help on using the repository browser.