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

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

Xiaofeng found out that FailOnError attribute is incompatible with Spawn attribute, so removed the recently added FailOnError wherever it was combined with Spawn.

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