source: greenstone3/trunk/build.xml@ 20160

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

changes to the code for fixing execute permissions

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