source: greenstone3/trunk/build.xml@ 20079

Last change on this file since 20079 was 20079, checked in by ak19, 15 years ago

Changes made to work on Vista which requires Tomcat 6 for Remote Greenstone3 to work and which, in turn, requires Java 5.

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