source: greenstone3/tags/3.04/build.xml@ 20979

Last change on this file since 20979 was 20955, checked in by xiao, 14 years ago

Modified FLAX targets

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