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

Last change on this file since 22405 was 22405, checked in by ak19, 14 years ago

New version of axis (1.4): since Fedora needs axis.jar v 1.3 and GS3 previously had axis.jar v.1.2.1, got the latest 1.* version which is 1.4, and have tested it with Fedora and Greenstone by deploying web services and using the gs3democlient.

File size: 79.3 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"/>
25 <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
[19930]26
[15799]27 <!-- ===================== Property Definitions =========================== -->
28
29 <!--
[15124]30
31 Each of the following properties are used in the build script.
32 Values for these properties are set by the first place they are
33 defined, from the following list:
34
35 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
36
37 * Definitions from a "build.properties" file in the top level
[15799]38 source directory of this application.
[15124]39
40 * Definitions from a "build.properties" file in the user's
[15799]41 home directory.
[15124]42
43 * Default definitions in this build.xml file.
44
45 You will note below that property values can be composed based on the
46 contents of previously defined properties. This is a powerful technique
47 that helps you minimize the number of changes required when your development
48 environment is modified. Note that property composition is allowed within
49 "build.properties" files as well as in the "build.xml" script.
50
[15799]51 -->
[18227]52
53 <!-- create build.properties if it has not been created yet -->
54 <if>
55 <bool><not><available file="build.properties"/></not></bool>
56 <copy file="build.properties.in" tofile="build.properties"/>
57 </if>
58
[18515]59 <!-- create the packages dir if it has not been created yet -->
60 <mkdir dir="packages"/>
[15799]61
[15859]62 <!--the first three properties have to be put on the top to be used by build.properties-->
[19960]63 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
[15124]64 <property name="src.packages.home" value="${basedir}/src/packages"/>
[15859]65 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
[19878]66
[15124]67 <property file="build.properties"/>
[16962]68 <if><bool><available file="${user.home}/build.properties"/></bool>
69 <property file="${user.home}/build.properties"/>
70 </if>
[15124]71
[20464]72 <!-- now we've read in properties, apply defaults -->
73 <property name="disable.collection.building" value="false"/>
74
[15124]75 <!-- get properties from the environment -->
76 <property environment="env"/>
[15799]77
[20127]78 <!-- get the filesets defining components and executables -->
[19975]79 <import file="resources/xml/components.xml"/>
[20127]80 <import file="resources/xml/executables.xml"/>
[15799]81
82 <!-- version properties for external packages -->
[20079]83 <!-- for Java versions < 1.4, we print out the message that Java is too old.
84 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 6.0-->
85 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-6.0.20">
86 <equals arg1="1.4" arg2="${ant.java.version}"/>
87 </condition>
88 <condition property="tomcat.version.major" value="5" else="6">
89 <equals arg1="1.4" arg2="${ant.java.version}"/>
90 </condition>
[22320]91 <condition property="privileged.attribute" value="privileged='true'" else="">
92 <equals arg1="6" arg2="${tomcat.version.major}"/>
93 </condition>
[20233]94
[22405]95 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
96 <property name="axis.dir.version" value="axis-1_4"/>
[18179]97 <property name="sqlite.targz.version" value="sqlite-amalgamation-3.5.9.tar.gz"/>
[15799]98
[15124]99 <property name="build.home" value="${basedir}/build"/>
100 <property name="src.home" value="${basedir}/src/java"/>
101 <property name="packages.home" value="${basedir}/packages"/>
102 <!-- this may be set in build.properties, eg if you move the web dir to
103 tomcats webapps directory -->
104 <property name="web.home" value="${basedir}/web"/>
105 <!-- jar files needed by applets go here -->
106 <property name="web.applet" value="${web.home}/applet"/>
[20085]107
[15124]108 <!-- jar files needed by the servlet (and extra ones) go here -->
109 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
110 <!-- other files needed by the servlet go here -->
111 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
112 <!--- flax: the WordNet home -->
113 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
114
115 <!-- jni libraries and java wrappers go here -->
116 <property name="lib.jni" value="${basedir}/lib/jni"/>
[19878]117
118 <!-- other jar files needed for installation (but not runtime) go here -->
[18110]119 <property name="lib.java" value="${basedir}/lib/java"/>
[15799]120
[15124]121 <property name="javadocs" value="${basedir}/docs/javadoc"/>
122
123 <property name="app.name" value="greenstone3"/>
124 <property name="app.path" value="/${app.name}"/>
125
[18124]126 <property name="admin.dir" value="${basedir}/admin"/>
[15124]127
128 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
129 <property name="app.version" value="trunk"/>
130 <property name="branch.path" value="trunk"/>
131 <property name="branch.revision" value="HEAD"/>
132
133 <!--constants -->
134 <property name="svn.root" value="http://svn.greenstone.org"/>
135
[19878]136 <!-- catalina home is set to tomcat basedir if already installed, otherwise
[15124]137 use greenstone's tomcat -->
[20085]138 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
[15124]139 <and>
140 <isset property="tomcat.installed.path"/>
141 <not>
[16936]142 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]143 </not>
144 </and>
145 </condition>
[19878]146
[15124]147 <property name="os.linux" value="Linux"/>
148 <property name="os.mac" value="Mac OS X"/>
149 <property name="os.solaris" value="SunOS"/>
150 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
[22056]151 <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]152
153 <!-- this is true for linux and macs -->
154 <condition property="current.os.isunix">
155 <os family="unix"/>
156 </condition>
157
158 <condition property="current.os.isunixnotmac">
159 <and>
160 <os family="unix"/>
161 <not>
[19933]162 <os family="mac"/>
[15124]163 </not>
164 </and>
165 </condition>
[19878]166
[15124]167 <condition property="current.os.ismac">
168 <os family="mac"/>
169 </condition>
170
171 <condition property="current.os.iswindows">
172 <os family="windows"/>
173 </condition>
174
[19933]175 <!-- is there a better way to do this?? what about solaris?? -->
176 <condition property="os.bin.dir" value="windows">
177 <os family="windows"/>
178 </condition>
179 <condition property="os.bin.dir" value="darwin">
180 <os family="mac"/>
181 </condition>
182 <condition property="os.bin.dir" value="linux">
183 <and>
184 <os family="unix"/>
185 <not>
186 <os family="mac"/>
187 </not>
188 </and>
189 </condition>
190
191
[19878]192 <condition property="collection.building.disabled">
[20464]193 <and>
194 <isset property="disable.collection.building"/>
195 <istrue value="${disable.collection.building}"/>
196 </and>
[19878]197 </condition>
198
[15124]199 <condition property="collection.building.enabled">
200 <not>
[20464]201 <istrue value="${disable.collection.building}"/>
[15124]202 </not>
203 </condition>
[19878]204
[15124]205 <condition property="collection.building.enabled.windows">
206 <and>
[20464]207 <istrue value="${collection.building.enabled}"/>
[15124]208 <isset property="current.os.iswindows"/>
209 </and>
210 </condition>
211
212 <condition property="collection.building.enabled.unix">
213 <and>
[20464]214 <istrue value="${collection.building.enabled}"/>
[15124]215 <isset property="current.os.isunix"/>
216 </and>
217 </condition>
218
[20085]219 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
[19931]220 <isset property="compile.static"/>
221 </condition>
[22184]222
223 <condition property="gs2.opt.args" value= " " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
224 <istrue value="${with.jni}"/>
225 </condition>
226 <condition property="gs2.compile.target" value="with-jni" else="without-jni">
227 <istrue value="${with.jni}"/>
228 </condition>
229 <condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
230 <istrue value="${with.jni}"/>
231 </condition>
232 <condition property="gs2.windows.enablejni" value="1" else="0">
233 <istrue value="${with.jni}"/>
234 </condition>
[19931]235
[15799]236 <!-- where is search4j tool -->
[20085]237 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
[15799]238 <isset property="current.os.iswindows"/>
[15136]239 </condition>
240
[15799]241
[15124]242 <!-- ============= Base dirs for each package and component ============ -->
243 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
244 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
245 <property name="gli.home" value="${basedir}/gli"/>
246 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
247
[21347]248 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
[20464]249 <istrue value="${disable.collection.building}"/>
[19871]250 </condition>
[19931]251
252 <property name="build.src.home" value="${gs2build.home}/build-src"/>
[19871]253 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
254 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
255 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
256 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
257
[15799]258 <!-- ==================== Compilation Control Options ==================== -->
[15124]259
[15799]260 <!--
[15124]261
262 These properties control option settings on the Javac compiler when it
263 is invoked using the <javac> task.
264
265 compile.debug Should compilation include the debug option?
266
267 compile.deprecation Should compilation include the deprecation option?
268
269 compile.optimize Should compilation include the optimize option?
270
[15799]271 -->
[15124]272
273 <property name="compile.debug" value="true"/>
274 <property name="compile.deprecation" value="true"/>
275 <property name="compile.optimize" value="true"/>
276
[15799]277 <!--
[15124]278
279 Rather than relying on the CLASSPATH environment variable, Ant includes
280 features that makes it easy to dynamically construct the classpath you
281 need for each compilation. The example below constructs the compile
282 classpath to include the servlet.jar file, as well as the other components
283 that Tomcat makes available to web applications automatically, plus anything
284 that you explicitly added.
285
[15799]286 -->
[20079]287
288 <!-- All elements that Tomcat 5 exposes to applications -->
289 <path id="tomcat5">
[20085]290 <pathelement location="${catalina.home}/common/classes"/>
291 <fileset dir="${catalina.home}/common/endorsed">
292 <include name="*.jar"/>
293 </fileset>
294 <fileset dir="${catalina.home}/common/lib">
295 <include name="*.jar"/>
296 </fileset>
297 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
298 <pathelement location="${catalina.home}/shared/classes"/>
299 <fileset dir="${catalina.home}/shared/lib">
300 <include name="*.jar"/>
301 </fileset>
[20079]302 </path>
303
304 <!-- All elements that Tomcat 6 exposes to applications -->
305 <path id="tomcat6">
[20085]306 <fileset dir="${catalina.home}/lib">
307 <include name="*.jar"/>
308 </fileset>
[20079]309 </path>
310
[15124]311 <path id="compile.classpath">
312 <!-- Include all jar files and libraries in our jni lib directory -->
313 <pathelement location="${lib.jni}"/>
314 <fileset dir="${lib.jni}">
315 <include name="*.jar"/>
316 </fileset>
317 <!-- Include all jar files in our web lib directory -->
318 <pathelement location="${web.lib}"/>
319 <fileset dir="${web.lib}">
320 <include name="*.jar"/>
321 </fileset>
322
[18110]323 <pathelement location="${lib.java}"/>
324 <fileset dir="${lib.java}">
325 <include name="*.jar"/>
326 </fileset>
[15124]327
328 <!-- include the jar files from the source packages -->
329 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
330 so we add them in by name -->
[22184]331 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
[15124]332 <pathelement location="${lib.jni}/mg.jar"/>
333 <pathelement location="${lib.jni}/mgpp.jar"/>
334
[20085]335 <!-- Include all elements that Tomcat exposes to applications -->
336 <path refid="tomcat${tomcat.version.major}"/>
337
[15124]338 </path>
339
340 <path id="local.tomcat.classpath">
341 <!-- explicitly include the jni java wrappers in the classpath -->
342 <pathelement location="${lib.jni}"/>
343 <fileset dir="${lib.jni}">
344 <include name="*.jar"/>
345 </fileset>
346 </path>
347
348 <path id="local.tomcat.path">
349 <pathelement location="${basedir}/bin/script"/>
350 <pathelement location="${basedir}/bin"/>
351 <pathelement location="${lib.jni}"/>
352 <pathelement path="${env.PATH}"/>
353 <pathelement path="${env.Path}"/>
354 <pathelement path="${wn.home}/bin"/>
355 </path>
356
357 <target name="test-setup">
358 <echo>ant java version=${ant.java.version}</echo>
359 <echo>is unix : ${current.os.isunix}</echo>
360 <echo>is mac : ${current.os.ismac}</echo>
361 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
362 <echo>is windows : ${current.os.iswindows}</echo>
363 <echo>os.unix: ${os.unix}</echo>
364 </target>
[20085]365
[15799]366 <!-- ==================== Primary and Global Targets ============================= -->
[15124]367
[19873]368 <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]369 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.">
370
371 <!-- make sure .sh files are executable -->
372 <chmod dir="${basedir}" perm="ugo+rx"
373 includes="*.sh"/>
374 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
375 includes="*.sh,*.pl"/>
376 </target>
[16936]377
[19871]378 <!-- 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]379 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
[19843]380 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
381
[19931]382 <target name="install-common-src" depends="init"
383 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
[19894]384 <antcall target="configure-common-src"/>
385 <antcall target="compile-common-src"/>
386 <antcall target="install-auxiliary-jar-files"/>
387 <antcall target="install-jni-files"/>
388 </target>
[19878]389
[19894]390 <target name="install-collection-building" depends="init" if="collection.building.enabled"
391 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
392 <antcall target="configure-collection-building"/>
[19931]393 <antcall target="tweak-makefiles" />
[19894]394 <antcall target="compile-collection-building"/>
395 </target>
396
[19878]397
[20209]398 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
[19878]399 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
400
401 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
[15124]402 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
403
404 <target name="configure" depends="init,configure-tomcat,configure-web"
[19878]405 description="Configure the installation (not the C++ code). Includes setting up config files. Should be re-run if you change the build.properties file."/>
[15124]406
[20209]407 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
[19878]408 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
[15124]409
[20209]410 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
[19878]411 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
[15799]412
[19878]413 <target name="update" depends="init,svnupdate,clean,install"
414 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]415
416 <target name="start" depends="init,start-tomcat"
417 description="Startup the Tomcat server." >
[15799]418 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
[16936]419 <echo>Tomcat: ${catalina.home}</echo>
420 <echo>Java : ${java.home}</echo>
421 <echo>URL : http://${tomcat.server}:${tomcat.port}${app.path}/</echo>
[15799]422 <!-- assuming that index.html is not needed here -->
[15124]423 </target>
424
425 <target name="stop" depends="init,stop-tomcat"
426 description="Shutdown the Tomcat server."/>
427
428 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
429
430
[15799]431 <!-- =========== Help targets =================================== -->
[15124]432
433 <property name="install-command" value="ant [options] prepare install"/>
434
435 <target name="usage" description="Print a help message">
436 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
437 <echo message=" Execute 'ant -help' for Ant help."/>
438 <echo>To install Greenstone3, run '${install-command}'.
[15799]439 There are properties defined in build.properties. The install process will ask you if these properties are set correctly. To avoid this prompt, use the '-Dproperties.accepted=yes' option.
440 To log the output, use the '-logfile build.log' option.
441 The README.txt file has more information about the ant targets and install process.
[15124]442 </echo>
443 </target>
444
445 <target name="help" depends="usage" description="Print a help message"/>
446
447 <target name="debug" depends="init" description="Display all the currently used properties">
448 <echoproperties/>
449 </target>
450
[15799]451 <!-- ====== initialization and setup targets ================== -->
[15124]452
453 <target name="accept-properties" unless="properties.accepted">
454 <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]455 tomcat.server=${tomcat.server}
456 tomcat.port=${tomcat.port}
457 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
458 proxy.host=${proxy.host}
459 proxy.port=${proxy.port}
[19878]460 disable.collection.building=${disable.collection.building}
[19910]461 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
[15124]462 </input>
463 <condition property="do.abort">
464 <equals arg1="n" arg2="${properties.ok}"/>
465 </condition>
466 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
467 </target>
[20085]468
[15124]469 <!-- this sets up some initial properties -->
470 <target name="init">
471
[20085]472 <!-- has the gs3-setup script been run?? -->
473 <condition property="gs3-setup-not-done">
474 <not>
475 <isset property="env.GSDL3HOME"/>
476 </not>
477 </condition>
478
[20092]479 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
[20085]480
[15124]481 <condition property="java.too.old">
482 <or>
[16936]483 <equals arg1="1.1" arg2="${ant.java.version}"/>
484 <equals arg1="1.2" arg2="${ant.java.version}"/>
485 <equals arg1="1.3" arg2="${ant.java.version}"/>
[15124]486 </or>
487 </condition>
[20208]488 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
[15124]489
490 <available file="${basedir}/gli" property="gli.present"/>
[19878]491 <available file="${basedir}/common-src" property="common.src.present"/>
[15124]492 <available file="${basedir}/gs2build" property="gs2build.present"/>
493
494 <condition property="tomcat.islocal">
495 <or>
[16936]496 <not><isset property="tomcat.installed.path"/></not>
497 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]498 </or>
499 </condition>
500
[15799]501 <echo>tomcat.port = ${tomcat.port}</echo>
[15124]502
503 <condition property="proxy.present">
504 <and>
[16936]505 <isset property="proxy.host"/>
506 <not><equals arg1="" arg2="${proxy.host}"/></not>
[15124]507 </and>
508 </condition>
509
[20235]510 <!--
[20290]511 the next block checks if the bundled tomcat is present in the 'packages' directory,
512 and checks for the lethal combination of tomcat 6 and java 1.4. Test for
513 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
514 download, as there is no other surefire way to check tomcat version under java 1.4
[20235]515 -->
516 <condition property="packages.tomcat.ispresent" value="true" else="false">
517 <available file="packages/tomcat"/>
518 </condition>
[20290]519 <condition property="packages.tomcat.istomcat6" value="true" else="false">
520 <available file="packages/tomcat/tomcat6.txt"/>
521 </condition>
[20235]522 <if>
523 <bool>
[20290]524 <and>
525 <istrue value="${packages.tomcat.ispresent}"/>
526 <istrue value="${packages.tomcat.istomcat6}"/>
527 <equals arg1="1.4" arg2="${ant.java.version}"/>
528 </and>
[20235]529 </bool>
[20290]530 <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]531 </if>
532
[15124]533 </target>
534
535 <target name="setup-proxy" depends="init" if="proxy.present">
536 <condition property="ask.user">
537 <or>
[16936]538 <equals arg1="" arg2="${proxy.user}"/>
539 <equals arg1="" arg2="${proxy.password}"/>
[15124]540 </or>
541 </condition>
[19878]542
[15124]543 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
544 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
545 </target>
546
[15799]547 <!-- ========== Web app Targets ================================ -->
548
[20089]549 <target name="prepare-web" depends="init">
[15124]550 <mkdir dir="${web.home}/applet"/>
551 <mkdir dir="${web.home}/logs"/>
552 </target>
553
[15136]554 <!-- 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 -->
[15124]555 <target name="configure-java-version" depends="init"
[15139]556 description="Activates or deactivates some jar libraries as needed depending on your java version">
[15136]557
[15799]558 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
[15124]559 <condition property="need.xalan.jar">
[15799]560 <or>
[16936]561 <equals arg1="1.5" arg2="${ant.java.version}"/>
562 <equals arg1="1.6" arg2="${ant.java.version}"/>
[15799]563 </or>
564 </condition>
[15136]565
[15799]566 <!-- if they have xalan.jar but dont need it -->
567 <if>
568 <bool>
[16936]569 <and>
570 <isset property="have.xalan.jar"/>
571 <not><isset property="need.xalan.jar"/></not>
572 </and>
[15799]573 </bool>
574 <antcall target="deactivate-xalan-jar"/>
575 </if>
[15136]576
[15799]577 <!-- if they need xalan.jar but dont have it -->
578 <if>
579 <bool>
[16936]580 <and>
581 <not><isset property="have.xalan.jar"/></not>
582 <isset property="need.xalan.jar"/>
583 </and>
[15799]584 </bool>
585 <antcall target="activate-xalan-jar"/>
586 </if>
[15136]587
[15124]588 </target>
589
[15139]590 <target name="activate-xalan-jar">
[15799]591 <echo>activating xalan.jar</echo>
[15124]592 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
[20085]593 <if>
594 <bool>
595 <and>
596 <isset property="current.os.ismac"/>
597 <available file="${catalina.home}/common/endorsed" type="dir"/>
598 </and>
599 </bool>
600 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
[15799]601 </if>
[15124]602 </target>
[15035]603
[15139]604 <target name="deactivate-xalan-jar">
[15799]605 <echo>deactivating xalan.jar</echo>
[15124]606 <delete file="${web.lib}/xalan.jar"/>
[20089]607 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
[15124]608 </target>
609
[15837]610
[16936]611 <target name="prepare-collections" depends="init">
612 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
[17008]613 <property name="index.zip" value="index.zip"/>
[15799]614
[16936]615 <echo message="installing collections..."/>
616 <antcall target="gs2mgdemo-install"/>
617 <antcall target="gs2mgppdemo-install"/>
618 <antcall target="gberg-install"/>
619 </target>
[15837]620
[16936]621 <target name="gs2mgdemo-prepare" if="collect.dir">
622 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
[15799]623
[16936]624 <condition property="gs2mgdemo.present">
625 <and>
[15837]626 <available file="${gs2mgdemo.dir}/${index.zip}"/>
[16936]627 </and>
628 </condition>
629 </target>
[15799]630
[17008]631 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
[16936]632 <echo> installing gs2mgdemo</echo>
[17008]633 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
[16936]634 <echo>collection gs2mgdemo installed</echo>
635 </target>
[15799]636
[16936]637 <target name="gs2mgppdemo-prepare" if="collect.dir">
638 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
[15837]639
[16936]640 <condition property="gs2mgppdemo.present">
641 <and>
[15837]642 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
[16936]643 </and>
644 </condition>
645 </target>
[15799]646
[16936]647 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
[17008]648 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
[16936]649 <echo>collection gs2mgppdemo installed</echo>
650 </target>
[15799]651
[16936]652 <target name="gberg-prepare" if="collect.dir">
653 <property name="gberg.dir" value="${collect.dir}/gberg"/>
[17008]654 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
[16936]655 </target>
[15799]656
[16936]657 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
[19878]658 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
[16936]659 <echo>collection gberg installed</echo>
660 </target>
[15799]661
[15124]662 <target name="configure-web" depends="init"
663 description="Configure only the web app config files">
664 <!-- we want a unix path in the global.properties file -->
665 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
666 <path path="${web.home}"/>
667 </pathconvert>
668 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
669 <filter token="gsdl3version" value="${app.version}"/>
670 <filter token="tomcat.server" value="${tomcat.server}"/>
671 <filter token="tomcat.port" value="${tomcat.port}"/>
672 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
673 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
674 <chmod file="${web.classes}/global.properties" perm="600"/>
675 <chmod file="${web.classes}/log4j.properties" perm="600"/>
676 </target>
677
678 <target name="compile-web" depends="init">
679 <javac srcdir="${web.classes}"
680 destdir="${web.classes}"
681 debug="${compile.debug}"
682 deprecation="${compile.deprecation}"
683 optimize="${compile.optimize}">
[16936]684 <classpath><path refid="compile.classpath"/></classpath>
[15124]685 </javac>
686 </target>
687
[20209]688 <target name="compile-classpath-jars" depends="init">
689 <if><bool><available file="admin/cp.mf"/></bool>
690 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
691 </if>
692 <if><bool><available file="${lib.java}/cp.mf"/></bool>
693 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
694 </if>
695 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
696 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
697 </if>
698 <if><bool><available file="${web.lib}/cp.mf"/></bool>
699 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
700 </if>
701 <jar destfile="cp.jar">
702 <manifest>
[20211]703 <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]704 </manifest>
705 </jar>
706 </target>
707
708 <target name="clean-classpath-jars" depends="init">
709 <delete file="admin/cp.jar"/>
710 <delete file="${lib.java}/cp.jar"/>
711 <delete file="${lib.jni}/cp.jar"/>
712 <delete file="${web.lib}/cp.jar"/>
713 <delete file="cp.jar"/>
714 </target>
715
716
[15799]717 <target name="svnupdate-web" unless="nosvn.mode">
[20930]718 <exec executable="svn">
719 <arg value="update"/>
720 <arg value="${web.home}"/>
721 <arg value="-r"/><arg value="${branch.revision}"/>
722 </exec>
[15799]723 </target>
[15124]724
725 <target name="update-web" depends="init,svnupdate-web,configure-web"
726 description="update only the web stuff (config files)"/>
727
[15799]728 <!-- ======================= Tomcat Targets ========================== -->
[15124]729
730 <!-- this target downloads and installs Tomcat -->
[20089]731 <!-- we download tomcat (version 6 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
732 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
733 description="downloads the appropriate version of Tomcat (Tomcat 5 if using Java 1.4, Tomcat 6 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/6 then you need to run prepare-tomcat">
[16951]734 <if>
735 <bool>
736 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
737 </bool>
738
739 <!-- check that packages dir is there -->
740 <mkdir dir="${packages.home}"/>
741 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
742 dest="${packages.home}/${tomcat.version}.zip"
743 usetimestamp="true"/>
744 <unzip src="${packages.home}/${tomcat.version}.zip"
745 dest="${packages.home}"/>
[20085]746
747 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
748 we would need to have the tomcat compat package to work with Java 1.4-->
749 <if>
750 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
751 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
752 dest="${packages.home}/${tomcat.version}-compat.zip"
753 usetimestamp="true"/>
754 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
755 dest="${packages.home}"/>
756 </if>
757
[16951]758 <!-- delete any existing tomcat -->
759 <delete dir="${packages.home}/tomcat"/>
760 <move todir="${packages.home}/tomcat">
761 <fileset dir="${packages.home}/${tomcat.version}"/>
762 </move>
763 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
764 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
765 overwrite="true"/>
766 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
767 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
768 overwrite="true"/>
769 <!-- make sure we have execute permission for the .sh files -->
770 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
771 includes="*.sh"/>
772
773 <echo file="${packages.home}/tomcat/.flagfile">
774 the timestamp of this file is the time that tomcat was extracted from the zip files.
775 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
776 </echo>
777
[20089]778 <!-- this is not strictly a prepare tomcat thing, but if one changes
779 Java, then they need to change tomcat as well, so might as well call
780 it here -->
781 <antcall target="configure-java-version"/>
[16951]782 <else>
783 <echo>Tomcat has been prepared, will not prepare</echo>
784 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
785 </else>
786
787 </if>
788
[15124]789 </target>
790
791 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
792
793 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
794 <!-- re-setup the server.xml file -->
[20079]795 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
796 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
[15124]797 <filterset>
[16936]798 <filter token="port" value="${tomcat.port}"/>
799 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
[15124]800 </filterset>
801 </copy>
802 <!-- set up the greenstone3 context -->
803 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
804 <filterset>
[16936]805 <filter token="gsdl3webhome" value="${web.home}"/>
[22320]806 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
[15124]807 </filterset>
808 </copy>
809 </target>
810
811 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
812 <!-- re-setup the server.xml file -->
813 <!-- need to edit the config file, or do we get the user to do this???-->
814 </target>
[15799]815
[20089]816 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
[15799]817 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
[15124]818 <property name="tomcat.path" refid="local.tomcat.path"/>
819 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
[21351]820 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]821 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
822 <env key="GSDL3HOME" value="${basedir}"/>
823 <env key="PATH" path="${tomcat.path}"/>
824 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
825 <env key="CATALINA_HOME" value="${catalina.home}"/>
826 <env key="CLASSPATH" path="${tomcat.classpath}"/>
827 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
[22184]828 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
[15124]829 <env key="WNHOME" path="${wn.home}"/>
830 </exec>
[21351]831 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
[15124]832 <env key="GSDLOS" value="windows"/>
833 <env key="GSDL3HOME" value="${basedir}"/>
834 <env key="Path" path="${tomcat.path}"/>
835 <env key="PATH" path="${tomcat.path}"/>
836 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
[16628]837 <env key="CATALINA_HOME" value="${catalina.home}"/>
[15124]838 <env key="CLASSPATH" path="${tomcat.classpath}"/>
839 </exec>
840 <!-- wait for the server to startup in case other targets need it running -->
841 <waitfor maxwait="5" maxwaitunit="second">
842 <and>
[16936]843 <socket server="${tomcat.server}" port="${tomcat.port}"/>
844 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
[15124]845 </and>
846 </waitfor>
847 </target>
848
849 <!-- windows: do we want to launch a webrowser?? -->
850 <!-- shouldn't this test whether anything is running first? -->
851 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
[21351]852 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]853 <env key="CATALINA_HOME" value="${catalina.home}"/>
854 </exec>
[21351]855 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
[16628]856 <env key="CATALINA_HOME" value="${catalina.home}"/>
857 </exec>
[15124]858 </target>
859
860 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
861
862 <target name="setup-catalina-ant-tasks">
863 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
864 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
865 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
866 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
867 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
868 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
869 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
870 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
871 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
872 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
873 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
874 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
875 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
876 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
877 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
878 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
879 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
880 </target>
881
882
[15799]883 <!-- ======================= ant Targets ============================ -->
[15124]884 <target name="prepare-ant" depends="init">
[16951]885 <if>
886 <bool>
887 <not><available file="${packages.home}/ant/.flagfile"/></not>
888 </bool>
889
890 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
891 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
892 usetimestamp="true"/>
893 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
894 dest="${packages.home}"/>
895 <move todir="${packages.home}/ant">
896 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
897 </move>
898 <echo file="${packages.home}/ant/.flagfile">
899 the timestamp of this file is the time that ant was extracted from the zip files.
900 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
901 </echo>
902
903 <else>
904 <echo>Ant has been prepared, will not prepare</echo>
905 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
906 </else>
907
908 </if>
[15124]909 </target>
910
[20079]911 <!-- ======================= Axis Targets ============================ -->
912
[15124]913 <target name="prepare-axis" depends="init">
[16951]914
915 <if>
916 <bool>
917 <not><available file="${packages.home}/axis/.flagfile"/></not>
918 </bool>
919
920 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
921 dest="${packages.home}/${axis.zip.version}"
922 usetimestamp="true"/>
923 <unzip src="${packages.home}/${axis.zip.version}"
924 dest="${packages.home}"/>
925 <move todir="${packages.home}/axis">
926 <fileset dir="${packages.home}/${axis.dir.version}"/>
927 </move>
928 <!-- install axis into greenstone web app -->
929 <copy todir="${web.lib}">
930 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
931 <include name="*.jar"/>
932 </fileset>
933 </copy>
934 <copy todir="${web.home}">
935 <fileset dir="${packages.home}/axis/webapps/axis/">
936 <include name="*.jsp"/>
937 <include name="*.jws"/>
938 </fileset>
939 </copy>
940 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
941 <copy todir="${web.classes}">
942 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
943 <include name="*.properties"/>
944 </fileset>
945 </copy>
946 <echo file="${packages.home}/axis/.flagfile">
947 the timestamp of this file is the time that axis was extracted from the zip files.
948 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
949 </echo>
950
951 <else>
952 <echo>Axis has been prepared, will not prepare</echo>
953 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
954 </else>
955
956 </if>
[15124]957 </target>
958
[15229]959 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
[15124]960 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
[15799]961
962 <target name="deploy-site">
[15124]963 <java classname="org.apache.axis.client.AdminClient">
964 <classpath refid="compile.classpath"/>
965 <arg value="-l"/>
966 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]967 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
968 </java>
969 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
[15124]970 </target>
971
[15229]972 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
[15124]973 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
[15229]974 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
975 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
976 tofile="${basedir}/resources/soap/undeploy.wsdd"
977 filtering="true"
978 overwrite="true"/>
[15124]979 <java classname="org.apache.axis.client.AdminClient">
980 <classpath refid="compile.classpath"/>
981 <arg value="-l"/>
982 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]983 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
[15124]984 </java>
[15229]985 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
[15799]986 </target>
[15124]987
[16936]988 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
989 with the default servicename of localsite-->
[15124]990 <target name="deploy-localsite" depends="init"
991 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
992 <antcall target="start-tomcat"/>
[15235]993 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
[15229]994 <antcall target="create-deployment-files">
995 <param name="axis.sitename" value="localsite"/>
[15235]996 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]997 <param name="axis.siteuri" value="localsite"/>
998 </antcall>
[15124]999 <antcall target="deploy-site">
1000 <param name="axis.sitename" value="localsite"/>
[15235]1001 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]1002 <param name="axis.siteuri" value="localsite"/>
[15124]1003 </antcall>
[15369]1004 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
[15124]1005 </target>
[15799]1006
[16936]1007 <target name="get-sitename" unless="axis.sitename">
[15229]1008 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
[15235]1009Press Enter for default:localsite</input>
[15124]1010 </target>
1011
[15229]1012 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1013 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1014To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
[20209]1015Or press Enter for undeploying the default:localsite /&gt;</input>
[15229]1016 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
[15124]1017 </target>
1018
[15229]1019 <target name="get-webservices" unless="axis.servicesname">
[15235]1020 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
[15229]1021Choose from: ${web.services.list}
[20209]1022Or press Enter for default:${base.webservice.name} /&gt;</input>
[15229]1023 <echo>${axis.servicesname}</echo>
1024 </target>
1025
1026 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
[15235]1027 <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]1028 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1029 </target>
1030
1031 <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">
1032 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
[15235]1033 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15124]1034 </condition>
[15229]1035
1036 <!--everything else defaults to java:RPC at present-->
1037 <condition property="soap.method" value="provider='java:RPC'">
1038 <not>
[15235]1039 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15229]1040 </not>
1041 </condition>
[16936]1042 </target>
[15799]1043
[16936]1044 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
[15124]1045 <filter token="sitename" value="${axis.sitename}"/>
1046 <filter token="siteuri" value="${axis.siteuri}"/>
[15229]1047 <filter token="servicesname" value="${axis.servicesname}"/>
1048 <filter token="soapmethod" value="${soap.method}"/>
[15124]1049 <copy file="${basedir}/resources/soap/site.wsdd.template"
[15229]1050 tofile="${basedir}/resources/soap/deploy.wsdd"
1051 filtering="true"
1052 overwrite="true"/>
[15124]1053 <!-- create the java files and compile them -->
[15229]1054 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1055 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1056 filtering="true"
1057 overwrite="true"/>
[15124]1058 <mkdir dir="${build.home}"/>
1059 <javac srcdir="${src.home}"
1060 destdir="${build.home}"
1061 debug="${compile.debug}"
1062 deprecation="${compile.deprecation}"
1063 optimize="${compile.optimize}">
1064 <classpath refid="compile.classpath"/>
[15229]1065 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
[15124]1066 </javac>
1067 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
[15799]1068 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1069 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1070 overwrite="true" />
[15124]1071 </target>
[15799]1072
[15124]1073
[15799]1074 <!-- ====================== Core targets ============================== -->
1075 <!-- core targets refer to the core gsdl3 java src -->
[15124]1076
[19878]1077 <target name="prepare-core"/>
[15124]1078
1079 <target name="configure-core"/>
1080
1081 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1082 description="Update only the Greenstone core" />
1083
[15799]1084 <target name="svnupdate-core" unless="nosvn.mode">
[20930]1085 <exec executable="svn">
1086 <arg value="update"/>
1087 <arg value="${basedir}"/>
1088 <arg value="-r"/><arg value="${branch.revision}"/>
1089 </exec>
[15124]1090 </target>
1091
1092 <target name="clean-core"
1093 description="Clean only the Greenstone core">
[19878]1094 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
[15124]1095 <delete dir="${build.home}"/>
1096 </target>
1097
[15799]1098 <target name="compile-core" depends="init"
[15124]1099 description="Compile only the Greenstone core">
1100 <mkdir dir="${build.home}"/>
1101 <javac srcdir="${src.home}"
1102 destdir="${build.home}"
1103 debug="${compile.debug}"
1104 deprecation="${compile.deprecation}"
1105 optimize="${compile.optimize}">
1106 <classpath>
[16936]1107 <path refid="compile.classpath"/>
[15124]1108 </classpath>
1109 </javac>
1110 <jar destfile="${build.home}/gsdl3.jar">
1111 <fileset dir="${build.home}">
[16936]1112 <include name="org/greenstone/gsdl3/**"/>
[15124]1113 <include name="org/flax/**"/>
[16936]1114 <exclude name="**/Test.class"/>
[15124]1115 </fileset>
1116 <manifest>
[16936]1117 <attribute name="Built-By" value="${user.name}" />
[15124]1118 </manifest>
1119 </jar>
1120 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
[22101]1121
1122 <jar destfile="${build.home}/gutil.jar">
1123 <fileset dir="${build.home}">
1124 <include name="org/greenstone/util/**"/>
1125 </fileset>
1126 <manifest>
1127 <attribute name="Built-By" value="${user.name}" />
1128 </manifest>
1129 </jar>
1130 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1131
[15124]1132 <!-- copy the localsite server in case we need it -->
[15235]1133 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
[15124]1134
[17918]1135 <!-- Greenstone Administrator Interface -->
[15124]1136 <jar destfile="${build.home}/GAI.jar">
1137 <fileset dir="${build.home}">
[16936]1138 <include name="org/greenstone/admin/**"/>
[15124]1139 </fileset>
1140 <manifest>
[16936]1141 <attribute name="Built-By" value="${user.name}" />
[15124]1142 </manifest>
1143 </jar>
[17917]1144 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
[18124]1145 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
[15124]1146 <jar destfile="${build.home}/phind.jar">
1147 <fileset dir="${build.home}">
[16936]1148 <include name="org/greenstone/applet/phind/**"/>
[15124]1149 </fileset>
1150 <manifest>
[16936]1151 <attribute name="Built-By" value="${user.name}" />
[15124]1152 </manifest>
1153 </jar>
1154 <mkdir dir="${web.applet}"/>
1155 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1156 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
[18515]1157 <if>
1158 <bool><istrue value="${tomcat.islocal}"/></bool>
[20085]1159 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1160 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
[18515]1161 </if>
1162
1163
[17116]1164 <!-- skip anttasks for now
[15124]1165 <jar destfile="${build.home}/anttasks.jar">
1166 <fileset dir="${build.home}">
[16936]1167 <include name="org/greenstone/anttasks/**"/>
[15124]1168 </fileset>
1169 <manifest>
[16936]1170 <attribute name="Built-By" value="${user.name}" />
[15124]1171 </manifest>
1172 </jar>
[17116]1173 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
[15124]1174 <jar destfile="${build.home}/gsdl3test.jar">
1175 <fileset dir="${build.home}">
[16936]1176 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1177 <include name="org/greenstone/testing/**"/>
[15124]1178 </fileset>
1179 <manifest>
[16936]1180 <attribute name="Built-By" value="${user.name}" />
[15124]1181 </manifest>
1182 </jar>
1183 <jar destfile="${build.home}/server.jar">
1184 <fileset dir="${build.home}">
[16936]1185 <include name="org/greenstone/server/**"/>
[15124]1186 </fileset>
1187 <fileset file="${basedir}/resources/java/server.properties"/>
1188 <manifest>
[16936]1189 <attribute name="Built-By" value="${user.name}"/>
[15124]1190 </manifest>
1191 </jar>
1192 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1193 </target>
[15799]1194
1195 <!-- ================== Packages targets ================================ -->
[15124]1196 <!-- these targets refer to the greenstone source packages - these need
1197 updating less often, so are in separate targets to the core -->
[19871]1198 <target name="prepare-packages" depends="init"/>
[15124]1199
1200 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1201 description="Update only the source packages"/>
1202
[15799]1203 <target name="svnupdate-packages" unless="nosvn.mode">
[20930]1204 <exec executable="svn">
1205 <arg value="update"/>
1206 <arg value="${src.packages.home}"/>
1207 <arg value="-r"/><arg value="${branch.revision}"/>
1208 </exec>
[15124]1209 </target>
[19931]1210
[15124]1211
[19871]1212 <target name="configure-packages" depends="init,configure-javagdbm"
[15124]1213 description="Configure only the packages."/>
1214
[22184]1215 <target name="configure-javagdbm" if="with.jni">
[15124]1216 <echo>
1217 Configuring JavaGDBM
1218 </echo>
[18417]1219
[19904]1220 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15124]1221 <arg value="--prefix=${basedir}"/>
1222 <arg value="--libdir=${lib.jni}"/>
[19873]1223 <arg value="--with-gdbm=${gdbm.home}"/>
[15124]1224 </exec>
1225 </target>
1226
[19871]1227 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
[15124]1228
1229 <target name="clean-javagdbm" depends="init">
1230 <exec executable="make" os="${os.unix}"
[19904]1231 dir="${javagdbm.home}" failonerror="true">
[15124]1232 <arg value="clean"/>
1233 </exec>
1234 </target>
1235
[19871]1236 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
[15185]1237
[15799]1238 <target name="distclean-javagdbm" depends="init">
1239 <exec executable="make" os="${os.unix}"
[19904]1240 dir="${javagdbm.home}" failonerror="true">
[15799]1241 <arg value="distclean"/>
1242 </exec>
1243 </target>
1244
1245 <target name="compile-packages" description="Compile only the source packages">
[22184]1246 <!-- javagdbm -->
1247 <antcall target="compile-javagdbm"/>
1248 <!-- Search4j -->
1249 <antcall target="compile-search4j"/>
1250 </target>
1251
1252 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
[15799]1253
[19878]1254 <!-- unix: -->
[15799]1255 <echo>compile javagdbm</echo>
[19904]1256 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1257 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15799]1258 <arg value="install"/>
1259 </exec>
[15098]1260
[15799]1261 <!-- windows: just the java stuff. -->
1262 <echo>Windows: compile javagdbm (java only)</echo>
[19904]1263 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
[15799]1264 <arg value="compile"/>
1265 <arg value="javaonly"/>
1266 </exec>
[15124]1267
[15799]1268 <!-- install the jar file -->
1269 <echo>Install the javagdbm jar file</echo>
1270 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1271 </target>
1272
[17491]1273 <target name="compile-search4j">
[17509]1274
[19996]1275 <!-- windows -->
[19997]1276 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[19996]1277 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1278 <arg value="/f"/>
1279 <arg value="win32.mak"/>
1280 <arg value='BINDIR="${basedir}\bin"'/>
1281 </exec>
1282 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1283 <arg value="/f"/>
1284 <arg value="win32.mak"/>
1285 <arg value="install"/>
1286 <arg value='BINDIR="${basedir}\bin"'/>
1287 </exec>
[17509]1288
[19996]1289 <!-- unix -->
[19997]1290 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
[19996]1291 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1292 <arg value="--bindir=${basedir}/bin"/>
1293 <arg value="${static.arg}"/>
1294 </exec>
1295 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1296 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1297 <arg value="install"/>
1298 </exec>
[17509]1299
[19996]1300 <!-- else warn -->
1301 <else>
1302 <fail>this target does not support the current os</fail>
[17509]1303
[19996]1304 </else></if></else></if>
1305
[17491]1306 </target>
1307
[19871]1308 <target name="install-auxiliary-jar-files" depends="init">
[22184]1309
1310 <if>
1311 <bool><available file="${mg.home}/mg.jar"/></bool>
1312 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1313 </if>
1314
1315 <if>
[22199]1316 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
[22184]1317 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1318 </if>
1319
[19871]1320 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1321 </target>
1322
[22184]1323 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos" if="with.jni"/>
[15124]1324
[15799]1325 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
[15124]1326 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1327 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
[15799]1328 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
[15124]1329 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1330 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
[15799]1331 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1332 </target>
1333 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
[15124]1334 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1335 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
[15799]1336 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
[15124]1337 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1338 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
[15799]1339 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1340 </target>
1341 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
[15124]1342 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1343 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
[15799]1344 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
[15124]1345 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1346 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
[15799]1347 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1348 </target>
1349
[19871]1350 <!-- ========common-src targets =================================-->
1351 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1352 collection building is not enabled -->
1353
1354 <target name="update-common-src" depends="init" if="collection.building.disabled">
1355 </target>
[19931]1356
[19871]1357 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
[20930]1358 <exec executable="svn">
1359 <arg value="update"/>
1360 <arg value="${common.src.home}"/>
1361 <arg value="-r"/><arg value="${branch.revision}"/>
1362 </exec>
[19871]1363 </target>
1364
[19878]1365 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
[19871]1366 <antcall target="checkout-common-src"/>
1367 <antcall target="unzip-windows-packages"/>
1368 </target>
1369
1370 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1371 <echo>checking out common-src</echo>
[20930]1372 <exec executable="svn">
1373 <arg value="checkout"/>
[21196]1374 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
[20930]1375 <arg value="common-src"/>
1376 <arg value="-r"/><arg value="${branch.revision}"/>
1377 </exec>
[19871]1378 </target>
1379
[19931]1380 <target name="configure-common-src" depends="init">
[19871]1381 <exec executable="${common.src.home}/configure" os="${os.unix}"
[19904]1382 dir="${common.src.home}" failonerror="true">
[19931]1383 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
[19933]1384 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
[22184]1385 <arg line="${gs2.opt.args}"/>
[19931]1386 <arg line="${static.arg}"/>
[19871]1387 </exec>
1388 </target>
1389
[19931]1390 <target name="clean-common-src" depends="init">
[19871]1391 <!-- unix: -->
[19904]1392 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]1393 <arg value="clean"/>
1394 </exec>
1395 <!-- windows: -->
[19904]1396 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
[19871]1397 <arg value="/f"/>
1398 <arg value="win32.mak"/>
1399 <arg value="clean"/>
[19960]1400 <arg value="GSDLHOME=${gs2build.home}"/>
[19871]1401 </exec>
1402 </target>
[19931]1403 <target name="distclean-common-src" depends="init">
[19960]1404 <!-- unix: -->
[19904]1405 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]1406 <arg value="distclean"/>
1407 </exec>
[19960]1408 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1409 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1410 <arg value="/f"/>
1411 <arg value="win32.mak"/>
1412 <arg value="clean"/>
1413 <arg value="GSDLHOME=${gs2build.home}"/>
1414 </exec>
[19871]1415 </target>
[19931]1416 <target name="compile-common-src" depends="init">
[19871]1417 <!-- unix: -->
[19904]1418 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]1419 <arg value="${gs2.compile.target}"/>
[19871]1420 </exec>
1421 <!-- windows: -->
[19904]1422 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
[19871]1423 <arg value="/f"/>
1424 <arg value="win32.mak"/>
[19934]1425 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]1426 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1427 <arg value="USE_SQLITE=0"/> <!-- Why is this not on by default? -->
[19871]1428 </exec>
1429 </target>
1430
[19843]1431 <!-- ======= collection-building targets ===========================-->
[15124]1432
[19843]1433 <target name="update-collection-building" if="collection.building.enabled"
[19931]1434 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]1435 description="Update (SVN update, configure, compile etc) only the collection building components"/>
[15124]1436
[19843]1437 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1438 description="SVN update the collection building components">
1439 </target>
[15124]1440
[19843]1441 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
[15124]1442 </target>
1443
[19931]1444 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1445 description="Configure the collection building components">
[19843]1446 </target>
[15098]1447
[19948]1448 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
[19843]1449 description="Clean only the collection building components"
1450 if="collection.building.enabled"/>
[18495]1451
[19948]1452 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
[19843]1453 description="Distclean only the collection building components"
1454 if="collection.building.enabled"/>
1455
[19931]1456 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
[19843]1457 description="Compile only the collection building components">
[19931]1458 <!-- make install for common-src -->
1459 <!-- unix: -->
1460 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]1461 <arg value="${gs2.install.target}"/>
[19931]1462 </exec>
1463
1464 <!-- windows: -->
1465 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1466 <arg value="/f"/>
1467 <arg value="win32.mak"/>
[21370]1468 <arg value="install"/>
[22184]1469 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1470 <arg value="USE_SQLITE=0"/> <!-- why is this not on by default? -->
[19931]1471 </exec>
1472
1473 <!-- install gs2build indexers for windows -->
1474 <if>
1475 <bool><istrue value="${current.os.iswindows}"/></bool>
1476 <copy todir="${gs2build.home}/bin/windows">
1477 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1478 <include name="*.*"/>
1479 </fileset>
1480 </copy>
1481 </if>
1482
1483 <!-- LuceneWrapper jar file not installed by default -->
1484 <mkdir dir="${gs2build.home}/bin/java"/>
1485 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1486
[15124]1487 </target>
[19843]1488
1489 <!-- ============== gli targets ================================= -->
[15799]1490 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
[19929]1491
[20930]1492 <exec executable="svn">
1493 <arg value="update"/>
1494 <arg value="${gli.home}"/>
1495 <arg value="-r"/><arg value="${branch.revision}"/>
1496 </exec>
1497
[21196]1498 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]1499 <arg value="export"/>
1500 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]1501 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gliserver.pl"/>
[20930]1502 </exec>
[21196]1503 <exec executable="svn" dir="web/WEB-INF/cgi">
1504 <arg value="export"/>
1505 <arg value="-r"/><arg value="${branch.revision}"/>
1506 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gsdlCGI.pm"/>
1507 </exec>
[20930]1508
[15124]1509 </target>
1510
[19843]1511 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
[19911]1512 <!-- checkout -->
1513 <if><bool><not><istrue value="${nosvn.mode}"/></not></bool>
[19929]1514
[20930]1515 <exec executable="svn">
1516 <arg value="checkout"/>
[21196]1517 <arg value="${svn.root}/main/${branch.path}/gli"/>
[20930]1518 <arg value="-r"/><arg value="${branch.revision}"/>
1519 </exec>
1520
[21196]1521 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]1522 <arg value="export"/>
1523 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]1524 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gliserver.pl"/>
[20930]1525 </exec>
[21196]1526 <exec executable="svn" dir="web/WEB-INF/cgi">
1527 <arg value="export"/>
1528 <arg value="-r"/><arg value="${branch.revision}"/>
1529 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gsdlCGI.pm"/>
1530 </exec>
[20930]1531
[19911]1532 </if>
[15124]1533 </target>
[19843]1534
1535 <target name="clean-gli" depends="init" if="collection.building.enabled">
1536 <!-- gli -->
1537 <property name="gli.home" value="${basedir}/gli"/>
1538 <!-- linux -->
1539 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
[20826]1540 resolveExecutable="true" failonerror="true"/>
[19843]1541 <!-- windows -->
1542 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
[20826]1543 resolveExecutable="true" failonerror="true"/>
[19843]1544 </target>
1545
1546 <target name="compile-gli" depends="init" if="collection.building.enabled">
1547 <!-- gli -->
1548 <property name="gli.home" value="${basedir}/gli"/>
[15098]1549
[19843]1550 <!-- linux -->
[20826]1551 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
[19843]1552 <!--remote gli-->
1553 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
[20826]1554 resolveExecutable="true" failonerror="true"/>
[19843]1555 <!-- windows -->
[20826]1556 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
[19843]1557 <!--remote gli-->
1558 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
[20826]1559 resolveExecutable="true" failonerror="true"/>
[19843]1560 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1561 </target>
[15124]1562
[19843]1563 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
[21351]1564 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
[19843]1565 <env key="gsdl3path" path="${basedir}"/>
[19871]1566 <env key="gsdlpath" path="${gs2build.home}"/>
[19843]1567 </exec>
[21351]1568 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
[19843]1569 <env key="gsdl3path" path="${basedir}"/>
[19871]1570 <env key="gsdlpath" path="${gs2build.home}"/>
[19873]1571 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
[19843]1572 </exec>
[21351]1573 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
[19843]1574 <env key="GSDL3PATH" path="${basedir}"/>
[19871]1575 <env key="GSDLPATH" path="${gs2build.home}"/>
[19843]1576 </exec>
1577 <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.
1578 </echo>
1579 </target>
1580
1581 <!-- ================ gs2build targets =========================== -->
1582
1583 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1584 <echo>svn updating gs2build</echo>
[20930]1585 <exec executable="svn">
1586 <arg value="update"/>
1587 <arg value="${gs2build.home}"/>
1588 <arg value="-r"/><arg value="${branch.revision}"/>
1589 </exec>
[15799]1590 </target>
[19843]1591
[15124]1592 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1593 <antcall target="checkout-gs2build"/>
1594 <antcall target="unzip-windows-packages"/>
1595 <antcall target="checkout-winbin"/>
1596 <antcall target="get-windows-binaries"/>
1597 <antcall target="delete-winbin"/>
1598 </target>
1599
[19843]1600 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1601 <echo>checking out gs2build</echo>
[20930]1602 <exec executable="svn">
1603 <arg value="checkout"/>
[21196]1604 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
[20930]1605 <arg value="-r"/><arg value="${branch.revision}"/>
1606 </exec>
1607
[21196]1608
[19843]1609 </target>
1610
[15124]1611 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
[15799]1612 unless="nosvn.mode">
[20930]1613
1614 <exec executable="svn">
1615 <arg value="checkout"/>
[21196]1616 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
[20930]1617 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]1618 <arg value="winbin"/>
[20930]1619 </exec>
1620
[15124]1621 </target>
1622
[15799]1623 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
[20930]1624 <exec executable="svn">
1625 <arg value="update"/>
1626 <arg value="winbin"/>
1627 <arg value="-r"/><arg value="${branch.revision}"/>
1628 </exec>
1629
[15799]1630 </target>
[15124]1631
1632 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1633 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1634 <fileset dir="${basedir}/winbin/bin"/>
1635 </move>
1636 </target>
[19843]1637
[15124]1638 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1639 <delete dir="${basedir}/winbin"/>
1640 </target>
1641
[19871]1642 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
1643 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
1644 dest="${common.src.home}/packages/windows/crypt"/>
1645 <unzip src="${common.src.home}/packages/windows/expat/expat.zip"
1646 dest="${common.src.home}/packages/windows/expat"/>
[18179]1647 <untar compression="gzip"
[19871]1648 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
1649 dest="${common.src.home}/packages/sqlite"/>
1650 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
1651 dest="${common.src.home}/indexers/packages/windows/iconv"/>
[15799]1652 </target>
[19878]1653
[15124]1654 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1655 <!-- we want a windows path in the setup.bat file -->
1656 <pathconvert targetos="windows" property="gs2build.home.windows">
1657 <path path="${gs2build.home}"/>
1658 </pathconvert>
1659 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1660 <filterset>
[16620]1661 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
[15799]1662 </filterset>
[15124]1663 </move>
1664 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1665 </target>
1666
[19843]1667
[19948]1668 <target name="clean-build-src" depends="init" if="collection.building.enabled">
[19871]1669 <!-- unix: -->
[19948]1670 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]1671 <arg value="clean"/>
1672 </exec>
1673 <!-- windows: -->
[19948]1674 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[15799]1675 <arg value="/f"/>
1676 <arg value="win32.mak"/>
1677 <arg value="clean"/>
[19960]1678 <arg value="GSDLHOME=${gs2build.home}"/>
[15124]1679 </exec>
1680 </target>
1681
[19948]1682
1683 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
[19960]1684 <!-- unix: -->
[19948]1685 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]1686 <arg value="distclean"/>
1687 </exec>
[19960]1688 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1689 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1690 <arg value="/f"/>
1691 <arg value="win32.mak"/>
1692 <arg value="clean"/>
1693 <arg value="GSDLHOME=${gs2build.home}"/>
1694 </exec>
[15124]1695 </target>
[19843]1696
[19931]1697 <target name="configure-build-src" depends="init" if="collection.building.enabled"
1698 description="Configure the build-src component">
1699 <exec executable="${build.src.home}/configure" os="${os.unix}"
1700 dir="${build.src.home}" failonerror="true">
1701 <arg value="--prefix=${gs2build.home}"/>
[22184]1702 <arg line="${gs2.opt.args}"/>
[19931]1703 <arg line="${static.arg}"/>
1704 </exec>
1705 </target>
[19910]1706
[19931]1707 <!-- common-src is done separately and needs to be compiled first -->
1708 <target name="compile-build-src" depends="init" if="collection.building.enabled">
1709
1710 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true"/>
1711 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
1712 <arg value="install"/>
1713 </exec>
[19910]1714
[19931]1715 <!-- run the setup script -->
[20826]1716 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
[19910]1717 <!--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]1718 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[19910]1719 <arg value="/f"/>
1720 <arg value="win32.mak"/>
[19934]1721 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]1722 </exec>
[19931]1723 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[19910]1724 <arg value="/f"/>
1725 <arg value="win32.mak"/>
1726 <arg value="install"/>
[19934]1727 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]1728 </exec>
[15124]1729 </target>
1730
1731
[15799]1732 <!-- ======================== TESTING Targets ========================= -->
[15124]1733
1734 <target name="test" description="Run the (incomplete) JUnit test suite "
1735 depends="init">
1736 <mkdir dir="${basedir}/test"/>
1737 <junit printsummary="withOutAndErr"
1738 errorproperty="test.failed"
1739 failureproperty="test.failed"
1740 fork="${junit.fork}">
1741 <formatter type="plain"/>
1742 <classpath>
[16936]1743 <pathelement location="${build.home}/gsdl3test.jar"/>
1744 <path refid="compile.classpath"/>
[15124]1745 </classpath>
1746 <test name="${testcase}" if="testcase"/>
1747 <batchtest todir="${basedir}/test" unless="testcase">
[18505]1748 <fileset dir="${build.home}" includes="**/*Test.class" />
[15124]1749 </batchtest>
1750 </junit>
1751 <echo>
1752 *********************************************
[15799]1753 Test output can be found in directory 'test'
[15124]1754 *********************************************
1755 </echo>
1756 </target>
[15799]1757
[20950]1758 <!-- ======================== FLAX Targets ========================= -->
1759 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
1760 <echo>checking out flax ...</echo>
1761 <mkdir dir="${basedir}/src/java/org/flax"/>
1762 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
[22198]1763 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
[20950]1764 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
1765 <mkdir dir="${web.home}/interfaces/flax"/>
1766 <mkdir dir="${web.home}/sites/flax"/>
1767 <mkdir dir="${basedir}/flax-resources"/>
1768 <mkdir dir="${basedir}/flax-lib"/>
[21272]1769 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
1770 <arg value="src/java/org/flax"/></exec>
1771 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
1772 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
[22198]1773 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
1774 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
1775 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
[21272]1776 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
1777 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
1778 <arg value="${web.home}/interfaces/flax"/></exec>
1779 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
1780 <arg value="${web.home}/sites/flax"/></exec>
1781 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
1782 <arg value="flax-resources"/></exec>
1783 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
1784 <arg value="flax-lib"/></exec>
[20950]1785 <move file="${web.home}/WEB-INF/web.xml" tofile="${web.home}/WEB-INF/web.xml.greenstone3backup"/>
1786 <antcall target="flax-copy-files" />
1787 </target>
1788
1789 <target name="update-flax" description="update flax from repository">
1790 <echo>updating flax ...</echo>
[21272]1791 <exec executable="svn"><arg value="update"/>
1792 <arg value="src/java/org/flax"/></exec>
1793 <exec executable="svn"><arg value="update"/>
[22198]1794 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
1795 <exec executable="svn"><arg value="update"/>
[21272]1796 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
1797 <exec executable="svn"><arg value="update"/>
1798 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
1799 <exec executable="svn"><arg value="update"/>
1800 <arg value="${web.home}/interfaces/flax"/></exec>
1801 <exec executable="svn"><arg value="update"/>
1802 <arg value="flax-resources"/></exec>
1803 <exec executable="svn"><arg value="update"/>
1804 <arg value="flax-lib"/></exec>
[20950]1805 <antcall target="flax-copy-files" />
1806 </target>
1807
1808 <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
1809 <echo>copying flax files ...</echo>
1810 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
1811 <!-- A configuration file containing web service binding information for the axis engine -->
1812 <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
1813 <!-- A static web service wsdl file which is queried by soap client. The reason this file is used (instead of the dynamically generated version) is in case any redirects are used in the Apache configuration (e.g., flax.nzdl.org:80 redirects to harakeke:8080) -->
1814 <copy file="${basedir}/flax-resources/FlaxWebService.wsdl" tofile="${web.home}/FlaxWebService.wsdl" filtering="true" overwrite="true">
1815 <filterset>
1816 <filter token="flaxpublicserver" value="${tomcat.server}"/>
1817 <filter token="flaxpublicport" value="${tomcat.port}"/>
1818 </filterset>
1819 </copy>
1820 <copy file="${basedir}/flax-lib/opennlp-tools-1.3.0.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />
[22344]1821 <copy file="${basedir}/flax-lib/cos.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />
[20950]1822 </target>
1823
[20963]1824
[19354]1825 <target name="compile-javadocs">
1826 <javadoc packagenames="org.greenstone.*"
1827 sourcepath="src/java"
1828 defaultexcludes="yes"
1829 destdir="docs/javadoc"
1830 author="true"
1831 version="true"
1832 use="true"
1833 windowtitle="Greenstone3 API">
1834 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
1835 </javadoc>
1836 </target>
1837
[20089]1838<!-- ========== Some distribution targets ======================== -->
[19972]1839 <target name="remove-source">
[19975]1840 <delete includeEmptyDirs="true">
1841 <fileset dir="." defaultexcludes="false">
1842 <patternset refid="greenstone3.source.component"/>
1843 </fileset>
1844 </delete>
[19972]1845 </target>
1846
[19903]1847 <target name="dist-tidy"
1848 description="'tidies-up' a greenstone3 installation for distribution.">
1849
1850 <!-- delete unneeded things -->
1851 <delete dir="${packages.home}/axis"/>
1852 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
1853 <delete file="README-SVN.txt"/>
[20215]1854 <delete file="build.properties.in"/>
[19903]1855
[19961]1856 <!-- delete source files -->
[19972]1857 <antcall target="remove-source"/>
[19903]1858
1859 <!-- create empty directories -->
1860 <mkdir dir="${web.home}/applet"/>
1861 <mkdir dir="${web.home}/logs"/>
1862
1863 <!-- os specific tidy-ups -->
[20051]1864 <!-- linux, mac -->
1865 <if><bool><istrue value="${current.os.isunix}"/></bool>
[19903]1866 <delete><fileset dir="." includes="*.bat"/></delete>
1867 <delete><fileset dir="gli" includes="*.bat"/></delete>
1868 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
1869 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
[19946]1870 <delete file="${basedir}/gs2build/win32cfg.h"/>
[19939]1871 <delete file="${basedir}/gs2build/win32.mak"/>
[20051]1872 <delete dir="${basedir}/winutil"/>
[19903]1873 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
1874
[20051]1875 <!-- windows -->
1876 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
1877 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
1878 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
1879 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
1880 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
1881 </if></else></if>
1882
[19903]1883 </target>
1884
[20089]1885 <!-- fix up executable permissions for binary release -->
1886 <target name="fix-execute-permissions">
1887 <echo>Setting binaries to executable</echo>
[20127]1888 <chmod perm="775">
1889 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
1890 </chmod>
[20089]1891 </target>
1892
1893 <!-- fix up executable permissions for source code release -->
1894 <target name="fix-execute-permissions-source">
[20127]1895 <chmod perm="775">
1896 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
1897 </chmod>
[20089]1898 </target>
1899
1900
[19931]1901 <!-- ============= tweaks for making compilation static ========== -->
1902 <target name="tweak-makefiles" depends="init" if="compile.static">
1903 <antcall target="rtftohtml-add-static" />
1904 </target>
1905
1906 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
1907 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
1908 </target>
1909
[15028]1910</project>
[22184]1911
Note: See TracBrowser for help on using the repository browser.