source: greenstone3/trunk/build.xml@ 20085

Last change on this file since 20085 was 20085, checked in by kjdon, 15 years ago

tidied up some targets. indentation. using else on a condition instead of having two conditions. added a check for env.GSDL3HOME so that people have to run gs3-setup before runnign ant.

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