source: greenstone3/trunk/build.xml@ 20122

Last change on this file since 20122 was 20122, checked in by oranfry, 15 years ago

fixup to fix-execute-permissions target

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