source: greenstone3/trunk/build.xml@ 20242

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

only complain about errors if we actually set some

File size: 76.0 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 tomcat is present in the 'packages' directory, and if so, figures
491 out its major version number (5, 6, etc.)
492 then it checks if your java is new enough to run that tomcat and if not fails with an explanation
493 -->
494 <condition property="packages.tomcat.ispresent" value="true" else="false">
495 <available file="packages/tomcat"/>
496 </condition>
497
498 <if><bool><istrue value="${packages.tomcat.ispresent}"/></bool>
499 <exec os="${os.unix}" outputproperty="packages.tomcat.detected.version" errorproperty="packages.tomcat.detection.errors" dir="packages/tomcat/bin" executable="sh">
500 <arg value="-c"/>
501 <arg value="./catalina.sh version | grep '^Server version: ' | sed 's@[^0-9]*\([0-9]\).*@\1@g'"/>
502 </exec>
503 <!--
504 totally untested, so commented out for now
505 <exec os="${os.windows}" outputproperty="packages.tomcat.detected.version" dir="packages/tomcat/bin" executable="cmd.exe">
506 <arg value="/c"/>
507 <arg value="catalina.bat version | grep '^Server version: ' | sed 's@[^0-9]*\([0-9]\).*@\1@g'"/>
508 </exec>
509 -->
510 <property name="packages.tomcat.detected.version" value="unknown"/>
511 </if>
512
513 <echo>packages.tomcat.ispresent: ${packages.tomcat.ispresent}</echo>
514 <echo>packages.tomcat.detected.version: ${packages.tomcat.detected.version}</echo>
515 <echo>packages.tomcat.detection.error: ${packages.tomcat.detection.errors}</echo>
516
517
518 <if>
519 <bool>
520 <or>
521 <and>
522 <istrue value="${packages.tomcat.ispresent}"/>
523 <equals arg1="${packages.tomcat.detected.version}" arg2="6"/>
524 <equals arg1="1.4" arg2="${ant.java.version}"/>
525 </and>
526 <and>
527 <isset property="packages.tomcat.detection.errors"/>
528 <not><equals arg1="${packages.tomcat.detection.errors}" arg2=""/></not>
529 </and>
530 </or>
531 </bool>
532 <fail>Your java version (1.4) is too old to work with the bundled version of Apache Tomcat. Please upgrade your java to version 1.5 or greater. Alternatively, you may remove the bundled Apache Tomcat from the 'packages' folder and then run 'ant prepare-tomcat'.</fail>
533 </if>
534
535 </target>
536
537 <target name="setup-proxy" depends="init" if="proxy.present">
538 <condition property="ask.user">
539 <or>
540 <equals arg1="" arg2="${proxy.user}"/>
541 <equals arg1="" arg2="${proxy.password}"/>
542 </or>
543 </condition>
544
545 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
546 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
547 </target>
548
549 <!-- ========== Web app Targets ================================ -->
550
551 <target name="prepare-web" depends="init">
552 <mkdir dir="${web.home}/applet"/>
553 <mkdir dir="${web.home}/logs"/>
554 </target>
555
556 <!-- 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 -->
557 <target name="configure-java-version" depends="init"
558 description="Activates or deactivates some jar libraries as needed depending on your java version">
559
560 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
561 <condition property="need.xalan.jar">
562 <or>
563 <equals arg1="1.5" arg2="${ant.java.version}"/>
564 <equals arg1="1.6" arg2="${ant.java.version}"/>
565 </or>
566 </condition>
567
568 <!-- if they have xalan.jar but dont need it -->
569 <if>
570 <bool>
571 <and>
572 <isset property="have.xalan.jar"/>
573 <not><isset property="need.xalan.jar"/></not>
574 </and>
575 </bool>
576 <antcall target="deactivate-xalan-jar"/>
577 </if>
578
579 <!-- if they need xalan.jar but dont have it -->
580 <if>
581 <bool>
582 <and>
583 <not><isset property="have.xalan.jar"/></not>
584 <isset property="need.xalan.jar"/>
585 </and>
586 </bool>
587 <antcall target="activate-xalan-jar"/>
588 </if>
589
590 </target>
591
592 <target name="activate-xalan-jar">
593 <echo>activating xalan.jar</echo>
594 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
595 <if>
596 <bool>
597 <and>
598 <isset property="current.os.ismac"/>
599 <available file="${catalina.home}/common/endorsed" type="dir"/>
600 </and>
601 </bool>
602 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
603 </if>
604 </target>
605
606 <target name="deactivate-xalan-jar">
607 <echo>deactivating xalan.jar</echo>
608 <delete file="${web.lib}/xalan.jar"/>
609 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
610 </target>
611
612
613 <target name="prepare-collections" depends="init">
614 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
615 <property name="index.zip" value="index.zip"/>
616
617 <echo message="installing collections..."/>
618 <antcall target="gs2mgdemo-install"/>
619 <antcall target="gs2mgppdemo-install"/>
620 <antcall target="gberg-install"/>
621 </target>
622
623 <target name="gs2mgdemo-prepare" if="collect.dir">
624 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
625
626 <condition property="gs2mgdemo.present">
627 <and>
628 <available file="${gs2mgdemo.dir}/${index.zip}"/>
629 </and>
630 </condition>
631 </target>
632
633 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
634 <echo> installing gs2mgdemo</echo>
635 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
636 <echo>collection gs2mgdemo installed</echo>
637 </target>
638
639 <target name="gs2mgppdemo-prepare" if="collect.dir">
640 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
641
642 <condition property="gs2mgppdemo.present">
643 <and>
644 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
645 </and>
646 </condition>
647 </target>
648
649 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
650 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
651 <echo>collection gs2mgppdemo installed</echo>
652 </target>
653
654 <target name="gberg-prepare" if="collect.dir">
655 <property name="gberg.dir" value="${collect.dir}/gberg"/>
656 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
657 </target>
658
659 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
660 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
661 <echo>collection gberg installed</echo>
662 </target>
663
664 <target name="configure-web" depends="init"
665 description="Configure only the web app config files">
666 <!-- we want a unix path in the global.properties file -->
667 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
668 <path path="${web.home}"/>
669 </pathconvert>
670 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
671 <filter token="gsdl3version" value="${app.version}"/>
672 <filter token="tomcat.server" value="${tomcat.server}"/>
673 <filter token="tomcat.port" value="${tomcat.port}"/>
674 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
675 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
676 <chmod file="${web.classes}/global.properties" perm="600"/>
677 <chmod file="${web.classes}/log4j.properties" perm="600"/>
678 </target>
679
680 <target name="compile-web" depends="init">
681 <javac srcdir="${web.classes}"
682 destdir="${web.classes}"
683 debug="${compile.debug}"
684 deprecation="${compile.deprecation}"
685 optimize="${compile.optimize}">
686 <classpath><path refid="compile.classpath"/></classpath>
687 </javac>
688 </target>
689
690 <target name="compile-classpath-jars" depends="init">
691 <if><bool><available file="admin/cp.mf"/></bool>
692 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
693 </if>
694 <if><bool><available file="${lib.java}/cp.mf"/></bool>
695 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
696 </if>
697 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
698 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
699 </if>
700 <if><bool><available file="${web.lib}/cp.mf"/></bool>
701 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
702 </if>
703 <jar destfile="cp.jar">
704 <manifest>
705 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
706 </manifest>
707 </jar>
708 </target>
709
710 <target name="clean-classpath-jars" depends="init">
711 <delete file="admin/cp.jar"/>
712 <delete file="${lib.java}/cp.jar"/>
713 <delete file="${lib.jni}/cp.jar"/>
714 <delete file="${web.lib}/cp.jar"/>
715 <delete file="cp.jar"/>
716 </target>
717
718
719 <target name="svnupdate-web" unless="nosvn.mode">
720 <svn>
721 <update dir="${web.home}" revision="${branch.revision}"/>
722 </svn>
723 </target>
724
725 <target name="update-web" depends="init,svnupdate-web,configure-web"
726 description="update only the web stuff (config files)"/>
727
728 <!-- ======================= Tomcat Targets ========================== -->
729
730 <!-- this target downloads and installs Tomcat -->
731 <!-- we download tomcat (version 6 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
732 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
733 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">
734 <if>
735 <bool>
736 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
737 </bool>
738
739 <!-- check that packages dir is there -->
740 <mkdir dir="${packages.home}"/>
741 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
742 dest="${packages.home}/${tomcat.version}.zip"
743 usetimestamp="true"/>
744 <unzip src="${packages.home}/${tomcat.version}.zip"
745 dest="${packages.home}"/>
746
747 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
748 we would need to have the tomcat compat package to work with Java 1.4-->
749 <if>
750 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
751 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
752 dest="${packages.home}/${tomcat.version}-compat.zip"
753 usetimestamp="true"/>
754 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
755 dest="${packages.home}"/>
756 </if>
757
758 <!-- delete any existing tomcat -->
759 <delete dir="${packages.home}/tomcat"/>
760 <move todir="${packages.home}/tomcat">
761 <fileset dir="${packages.home}/${tomcat.version}"/>
762 </move>
763 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
764 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
765 overwrite="true"/>
766 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
767 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
768 overwrite="true"/>
769 <!-- make sure we have execute permission for the .sh files -->
770 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
771 includes="*.sh"/>
772
773 <echo file="${packages.home}/tomcat/.flagfile">
774 the timestamp of this file is the time that tomcat was extracted from the zip files.
775 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
776 </echo>
777
778 <!-- this is not strictly a prepare tomcat thing, but if one changes
779 Java, then they need to change tomcat as well, so might as well call
780 it here -->
781 <antcall target="configure-java-version"/>
782 <else>
783 <echo>Tomcat has been prepared, will not prepare</echo>
784 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
785 </else>
786
787 </if>
788
789 </target>
790
791 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
792
793 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
794 <!-- re-setup the server.xml file -->
795 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
796 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
797 <filterset>
798 <filter token="port" value="${tomcat.port}"/>
799 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
800 </filterset>
801 </copy>
802 <!-- set up the greenstone3 context -->
803 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
804 <filterset>
805 <filter token="gsdl3webhome" value="${web.home}"/>
806 </filterset>
807 </copy>
808 </target>
809
810 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
811 <!-- re-setup the server.xml file -->
812 <!-- need to edit the config file, or do we get the user to do this???-->
813 </target>
814
815 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
816 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
817 <property name="tomcat.path" refid="local.tomcat.path"/>
818 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
819 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
820 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
821 <env key="GSDL3HOME" value="${basedir}"/>
822 <env key="PATH" path="${tomcat.path}"/>
823 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
824 <env key="CATALINA_HOME" value="${catalina.home}"/>
825 <env key="CLASSPATH" path="${tomcat.classpath}"/>
826 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
827 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here??-->
828 <env key="WNHOME" path="${wn.home}"/>
829 </exec>
830 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
831 <env key="GSDLOS" value="windows"/>
832 <env key="GSDL3HOME" value="${basedir}"/>
833 <env key="Path" path="${tomcat.path}"/>
834 <env key="PATH" path="${tomcat.path}"/>
835 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
836 <env key="CATALINA_HOME" value="${catalina.home}"/>
837 <env key="CLASSPATH" path="${tomcat.classpath}"/>
838 </exec>
839 <!-- wait for the server to startup in case other targets need it running -->
840 <waitfor maxwait="5" maxwaitunit="second">
841 <and>
842 <socket server="${tomcat.server}" port="${tomcat.port}"/>
843 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
844 </and>
845 </waitfor>
846 </target>
847
848 <!-- windows: do we want to launch a webrowser?? -->
849 <!-- shouldn't this test whether anything is running first? -->
850 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
851 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
852 <env key="CATALINA_HOME" value="${catalina.home}"/>
853 </exec>
854 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
855 <env key="CATALINA_HOME" value="${catalina.home}"/>
856 </exec>
857 </target>
858
859 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
860
861 <target name="setup-catalina-ant-tasks">
862 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
863 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
864 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
865 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
866 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
867 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
868 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
869 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
870 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
871 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
872 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
873 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
874 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
875 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
876 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
877 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
878 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
879 </target>
880
881
882 <!-- ======================= ant Targets ============================ -->
883 <target name="prepare-ant" depends="init">
884 <if>
885 <bool>
886 <not><available file="${packages.home}/ant/.flagfile"/></not>
887 </bool>
888
889 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
890 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
891 usetimestamp="true"/>
892 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
893 dest="${packages.home}"/>
894 <move todir="${packages.home}/ant">
895 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
896 </move>
897 <echo file="${packages.home}/ant/.flagfile">
898 the timestamp of this file is the time that ant was extracted from the zip files.
899 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
900 </echo>
901
902 <else>
903 <echo>Ant has been prepared, will not prepare</echo>
904 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
905 </else>
906
907 </if>
908 </target>
909
910 <!-- ======================= Axis Targets ============================ -->
911
912 <target name="prepare-axis" depends="init">
913
914 <if>
915 <bool>
916 <not><available file="${packages.home}/axis/.flagfile"/></not>
917 </bool>
918
919 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
920 dest="${packages.home}/${axis.zip.version}"
921 usetimestamp="true"/>
922 <unzip src="${packages.home}/${axis.zip.version}"
923 dest="${packages.home}"/>
924 <move todir="${packages.home}/axis">
925 <fileset dir="${packages.home}/${axis.dir.version}"/>
926 </move>
927 <!-- install axis into greenstone web app -->
928 <copy todir="${web.lib}">
929 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
930 <include name="*.jar"/>
931 </fileset>
932 </copy>
933 <copy todir="${web.home}">
934 <fileset dir="${packages.home}/axis/webapps/axis/">
935 <include name="*.jsp"/>
936 <include name="*.jws"/>
937 </fileset>
938 </copy>
939 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
940 <copy todir="${web.classes}">
941 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
942 <include name="*.properties"/>
943 </fileset>
944 </copy>
945 <echo file="${packages.home}/axis/.flagfile">
946 the timestamp of this file is the time that axis was extracted from the zip files.
947 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
948 </echo>
949
950 <else>
951 <echo>Axis has been prepared, will not prepare</echo>
952 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
953 </else>
954
955 </if>
956 </target>
957
958 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
959 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
960
961 <target name="deploy-site">
962 <java classname="org.apache.axis.client.AdminClient">
963 <classpath refid="compile.classpath"/>
964 <arg value="-l"/>
965 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
966 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
967 </java>
968 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
969 </target>
970
971 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
972 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
973 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
974 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
975 tofile="${basedir}/resources/soap/undeploy.wsdd"
976 filtering="true"
977 overwrite="true"/>
978 <java classname="org.apache.axis.client.AdminClient">
979 <classpath refid="compile.classpath"/>
980 <arg value="-l"/>
981 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
982 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
983 </java>
984 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
985 </target>
986
987 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
988 with the default servicename of localsite-->
989 <target name="deploy-localsite" depends="init"
990 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
991 <antcall target="start-tomcat"/>
992 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
993 <antcall target="create-deployment-files">
994 <param name="axis.sitename" value="localsite"/>
995 <param name="axis.servicesname" value="${base.webservice.name}"/>
996 <param name="axis.siteuri" value="localsite"/>
997 </antcall>
998 <antcall target="deploy-site">
999 <param name="axis.sitename" value="localsite"/>
1000 <param name="axis.servicesname" value="${base.webservice.name}"/>
1001 <param name="axis.siteuri" value="localsite"/>
1002 </antcall>
1003 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
1004 </target>
1005
1006 <target name="get-sitename" unless="axis.sitename">
1007 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
1008Press Enter for default:localsite</input>
1009 </target>
1010
1011 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1012 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1013To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1014Or press Enter for undeploying the default:localsite /&gt;</input>
1015 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1016 </target>
1017
1018 <target name="get-webservices" unless="axis.servicesname">
1019 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1020Choose from: ${web.services.list}
1021Or press Enter for default:${base.webservice.name} /&gt;</input>
1022 <echo>${axis.servicesname}</echo>
1023 </target>
1024
1025 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1026 <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>
1027 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1028 </target>
1029
1030 <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">
1031 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1032 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1033 </condition>
1034
1035 <!--everything else defaults to java:RPC at present-->
1036 <condition property="soap.method" value="provider='java:RPC'">
1037 <not>
1038 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1039 </not>
1040 </condition>
1041 </target>
1042
1043 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1044 <filter token="sitename" value="${axis.sitename}"/>
1045 <filter token="siteuri" value="${axis.siteuri}"/>
1046 <filter token="servicesname" value="${axis.servicesname}"/>
1047 <filter token="soapmethod" value="${soap.method}"/>
1048 <copy file="${basedir}/resources/soap/site.wsdd.template"
1049 tofile="${basedir}/resources/soap/deploy.wsdd"
1050 filtering="true"
1051 overwrite="true"/>
1052 <!-- create the java files and compile them -->
1053 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1054 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1055 filtering="true"
1056 overwrite="true"/>
1057 <mkdir dir="${build.home}"/>
1058 <javac srcdir="${src.home}"
1059 destdir="${build.home}"
1060 debug="${compile.debug}"
1061 deprecation="${compile.deprecation}"
1062 optimize="${compile.optimize}">
1063 <classpath refid="compile.classpath"/>
1064 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1065 </javac>
1066 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1067 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1068 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1069 overwrite="true" />
1070 </target>
1071
1072
1073 <!-- ====================== Core targets ============================== -->
1074 <!-- core targets refer to the core gsdl3 java src -->
1075
1076 <target name="prepare-core"/>
1077
1078 <target name="configure-core"/>
1079
1080 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1081 description="Update only the Greenstone core" />
1082
1083 <target name="svnupdate-core" unless="nosvn.mode">
1084 <svn>
1085 <update dir="." revision="${branch.revision}"/>
1086 </svn>
1087 </target>
1088
1089 <target name="clean-core"
1090 description="Clean only the Greenstone core">
1091 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1092 <delete dir="${build.home}"/>
1093 </target>
1094
1095 <target name="compile-core" depends="init"
1096 description="Compile only the Greenstone core">
1097 <mkdir dir="${build.home}"/>
1098 <javac srcdir="${src.home}"
1099 destdir="${build.home}"
1100 debug="${compile.debug}"
1101 deprecation="${compile.deprecation}"
1102 optimize="${compile.optimize}">
1103 <classpath>
1104 <path refid="compile.classpath"/>
1105 </classpath>
1106 </javac>
1107 <jar destfile="${build.home}/gsdl3.jar">
1108 <fileset dir="${build.home}">
1109 <include name="org/greenstone/gsdl3/**"/>
1110 <include name="org/flax/**"/>
1111 <exclude name="**/Test.class"/>
1112 </fileset>
1113 <manifest>
1114 <attribute name="Built-By" value="${user.name}" />
1115 </manifest>
1116 </jar>
1117 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1118 <!-- copy the localsite server in case we need it -->
1119 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1120
1121 <!-- Greenstone Administrator Interface -->
1122 <jar destfile="${build.home}/GAI.jar">
1123 <fileset dir="${build.home}">
1124 <include name="org/greenstone/admin/**"/>
1125 </fileset>
1126 <manifest>
1127 <attribute name="Built-By" value="${user.name}" />
1128 </manifest>
1129 </jar>
1130 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1131 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1132 <jar destfile="${build.home}/phind.jar">
1133 <fileset dir="${build.home}">
1134 <include name="org/greenstone/applet/phind/**"/>
1135 </fileset>
1136 <manifest>
1137 <attribute name="Built-By" value="${user.name}" />
1138 </manifest>
1139 </jar>
1140 <mkdir dir="${web.applet}"/>
1141 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1142 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1143 <if>
1144 <bool><istrue value="${tomcat.islocal}"/></bool>
1145 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1146 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1147 </if>
1148
1149
1150 <!-- skip anttasks for now
1151 <jar destfile="${build.home}/anttasks.jar">
1152 <fileset dir="${build.home}">
1153 <include name="org/greenstone/anttasks/**"/>
1154 </fileset>
1155 <manifest>
1156 <attribute name="Built-By" value="${user.name}" />
1157 </manifest>
1158 </jar>
1159 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1160 <jar destfile="${build.home}/gsdl3test.jar">
1161 <fileset dir="${build.home}">
1162 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1163 <include name="org/greenstone/testing/**"/>
1164 </fileset>
1165 <manifest>
1166 <attribute name="Built-By" value="${user.name}" />
1167 </manifest>
1168 </jar>
1169 <jar destfile="${build.home}/server.jar">
1170 <fileset dir="${build.home}">
1171 <include name="org/greenstone/server/**"/>
1172 </fileset>
1173 <fileset file="${basedir}/resources/java/server.properties"/>
1174 <manifest>
1175 <attribute name="Built-By" value="${user.name}"/>
1176 </manifest>
1177 </jar>
1178 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1179 </target>
1180
1181 <!-- ================== Packages targets ================================ -->
1182 <!-- these targets refer to the greenstone source packages - these need
1183 updating less often, so are in separate targets to the core -->
1184 <target name="prepare-packages" depends="init"/>
1185
1186 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1187 description="Update only the source packages"/>
1188
1189 <target name="svnupdate-packages" unless="nosvn.mode">
1190 <svn>
1191 <update dir="${src.packages.home}" revision="${branch.revision}"/>
1192 </svn>
1193 </target>
1194
1195
1196 <target name="configure-packages" depends="init,configure-javagdbm"
1197 description="Configure only the packages."/>
1198
1199 <target name="configure-javagdbm">
1200 <echo>
1201 Configuring JavaGDBM
1202 </echo>
1203
1204 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1205 <arg value="--prefix=${basedir}"/>
1206 <arg value="--libdir=${lib.jni}"/>
1207 <arg value="--with-gdbm=${gdbm.home}"/>
1208 </exec>
1209 </target>
1210
1211 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1212
1213 <target name="clean-javagdbm" depends="init">
1214 <exec executable="make" os="${os.unix}"
1215 dir="${javagdbm.home}" failonerror="true">
1216 <arg value="clean"/>
1217 </exec>
1218 </target>
1219
1220 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1221
1222 <target name="distclean-javagdbm" depends="init">
1223 <exec executable="make" os="${os.unix}"
1224 dir="${javagdbm.home}" failonerror="true">
1225 <arg value="distclean"/>
1226 </exec>
1227 </target>
1228
1229 <target name="compile-packages" description="Compile only the source packages">
1230
1231 <!-- unix: -->
1232 <echo>compile javagdbm</echo>
1233 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1234 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1235 <arg value="install"/>
1236 </exec>
1237
1238 <!-- windows: just the java stuff. -->
1239 <echo>Windows: compile javagdbm (java only)</echo>
1240 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1241 <arg value="compile"/>
1242 <arg value="javaonly"/>
1243 </exec>
1244
1245 <!-- install the jar file -->
1246 <echo>Install the javagdbm jar file</echo>
1247 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1248
1249
1250 <!-- Search4j -->
1251 <antcall target="compile-search4j"/>
1252 </target>
1253
1254 <target name="compile-search4j">
1255
1256 <!-- windows -->
1257 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1258 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1259 <arg value="/f"/>
1260 <arg value="win32.mak"/>
1261 <arg value='BINDIR="${basedir}\bin"'/>
1262 </exec>
1263 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1264 <arg value="/f"/>
1265 <arg value="win32.mak"/>
1266 <arg value="install"/>
1267 <arg value='BINDIR="${basedir}\bin"'/>
1268 </exec>
1269
1270 <!-- unix -->
1271 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1272 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1273 <arg value="--bindir=${basedir}/bin"/>
1274 <arg value="${static.arg}"/>
1275 </exec>
1276 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1277 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1278 <arg value="install"/>
1279 </exec>
1280
1281 <!-- else warn -->
1282 <else>
1283 <fail>this target does not support the current os</fail>
1284
1285 </else></if></else></if>
1286
1287 </target>
1288
1289 <target name="install-auxiliary-jar-files" depends="init">
1290 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1291 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1292 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1293 </target>
1294
1295 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1296
1297 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1298 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1299 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1300 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1301 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1302 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1303 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1304 </target>
1305 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1306 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1307 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1308 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1309 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1310 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1311 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1312 </target>
1313 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1314 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1315 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1316 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1317 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1318 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1319 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1320 </target>
1321
1322 <!-- ========common-src targets =================================-->
1323 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1324 collection building is not enabled -->
1325
1326 <target name="update-common-src" depends="init" if="collection.building.disabled">
1327 </target>
1328
1329 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1330 <svn>
1331 <update dir="${common.src.home}" revision="${branch.revision}"/>
1332 </svn>
1333 </target>
1334
1335 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1336 <antcall target="checkout-common-src"/>
1337 <antcall target="unzip-windows-packages"/>
1338 </target>
1339
1340 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1341 <echo>checking out common-src</echo>
1342 <svn>
1343 <checkout url="${svn.root}/gsdl/trunk/common-src" destPath="common-src" revision="${branch.revision}"/>
1344 </svn>
1345 </target>
1346
1347 <target name="configure-common-src" depends="init">
1348 <exec executable="${common.src.home}/configure" os="${os.unix}"
1349 dir="${common.src.home}" failonerror="true">
1350 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1351 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1352 <arg line="${static.arg}"/>
1353 </exec>
1354 </target>
1355
1356 <target name="clean-common-src" depends="init">
1357 <!-- unix: -->
1358 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1359 <arg value="clean"/>
1360 </exec>
1361 <!-- windows: -->
1362 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1363 <arg value="/f"/>
1364 <arg value="win32.mak"/>
1365 <arg value="clean"/>
1366 <arg value="GSDLHOME=${gs2build.home}"/>
1367 </exec>
1368 </target>
1369 <target name="distclean-common-src" depends="init">
1370 <!-- unix: -->
1371 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1372 <arg value="distclean"/>
1373 </exec>
1374 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1375 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1376 <arg value="/f"/>
1377 <arg value="win32.mak"/>
1378 <arg value="clean"/>
1379 <arg value="GSDLHOME=${gs2build.home}"/>
1380 </exec>
1381 </target>
1382 <target name="compile-common-src" depends="init">
1383 <!-- unix: -->
1384 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1385 </exec>
1386 <!-- windows: -->
1387 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1388 <arg value="/f"/>
1389 <arg value="win32.mak"/>
1390 <arg value="GSDLHOME=${gs2build.home}"/>
1391 </exec>
1392 </target>
1393
1394 <!-- ======= collection-building targets ===========================-->
1395
1396 <target name="update-collection-building" if="collection.building.enabled"
1397 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"
1398 description="Update (SVN update, configure, compile etc) only the collection building components"/>
1399
1400 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1401 description="SVN update the collection building components">
1402 </target>
1403
1404 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1405 </target>
1406
1407 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1408 description="Configure the collection building components">
1409 </target>
1410
1411 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1412 description="Clean only the collection building components"
1413 if="collection.building.enabled"/>
1414
1415 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1416 description="Distclean only the collection building components"
1417 if="collection.building.enabled"/>
1418
1419 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1420 description="Compile only the collection building components">
1421 <!-- make install for common-src -->
1422 <!-- unix: -->
1423 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1424 <arg value="install"/>
1425 </exec>
1426
1427 <!-- windows: -->
1428 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1429 <arg value="/f"/>
1430 <arg value="win32.mak"/>
1431 <arg value="install"/>
1432 </exec>
1433
1434 <!-- install gs2build indexers for windows -->
1435 <if>
1436 <bool><istrue value="${current.os.iswindows}"/></bool>
1437 <copy todir="${gs2build.home}/bin/windows">
1438 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1439 <include name="*.*"/>
1440 </fileset>
1441 </copy>
1442 </if>
1443
1444 <!-- LuceneWrapper jar file not installed by default -->
1445 <mkdir dir="${gs2build.home}/bin/java"/>
1446 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1447
1448 </target>
1449
1450 <!-- ============== gli targets ================================= -->
1451 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1452 <svn>
1453 <update dir="${gli.home}" revision="${branch.revision}"/>
1454
1455 <!-- some files from cgi-bin: necessary for remote GLI server -->
1456 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gliserver.pl" destPath="${web.home}/WEB-INF/cgi/gliserver.pl" revision="${branch.revision}"/>
1457 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gsdlCGI.pm" destPath="${web.home}/WEB-INF/cgi/gsdlCGI.pm" revision="${branch.revision}"/>
1458 </svn>
1459 </target>
1460
1461 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1462 <!-- checkout -->
1463 <if><bool><not><istrue value="${nosvn.mode}"/></not></bool>
1464 <svn>
1465 <checkout url="${svn.root}/gli/${branch.path}" destPath="gli" revision="${branch.revision}"/>
1466
1467 <!-- some files from cgi-bin: necessary for remote GLI server -->
1468 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gliserver.pl" destPath="${web.home}/WEB-INF/cgi/gliserver.pl" revision="${branch.revision}"/>
1469 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gsdlCGI.pm" destPath="${web.home}/WEB-INF/cgi/gsdlCGI.pm" revision="${branch.revision}"/>
1470 </svn>
1471 </if>
1472 </target>
1473
1474 <target name="clean-gli" depends="init" if="collection.building.enabled">
1475 <!-- gli -->
1476 <property name="gli.home" value="${basedir}/gli"/>
1477 <!-- linux -->
1478 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1479 resolveExecutable="true"/>
1480 <!-- windows -->
1481 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1482 resolveExecutable="true"/>
1483 </target>
1484
1485 <target name="compile-gli" depends="init" if="collection.building.enabled">
1486 <!-- gli -->
1487 <property name="gli.home" value="${basedir}/gli"/>
1488
1489 <!-- linux -->
1490 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1491 <!--remote gli-->
1492 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1493 resolveExecutable="true"/>
1494 <!-- windows -->
1495 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1496 <!--remote gli-->
1497 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1498 resolveExecutable="true"/>
1499 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1500 </target>
1501
1502 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1503 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1504 <env key="gsdl3path" path="${basedir}"/>
1505 <env key="gsdlpath" path="${gs2build.home}"/>
1506 </exec>
1507 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1508 <env key="gsdl3path" path="${basedir}"/>
1509 <env key="gsdlpath" path="${gs2build.home}"/>
1510 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
1511 </exec>
1512 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1513 <env key="GSDL3PATH" path="${basedir}"/>
1514 <env key="GSDLPATH" path="${gs2build.home}"/>
1515 </exec>
1516 <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.
1517 </echo>
1518 </target>
1519
1520 <!-- ================ gs2build targets =========================== -->
1521
1522 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1523 <echo>svn updating gs2build</echo>
1524 <svn>
1525 <update dir="{gs2build.home}" revision="${branch.revision}"/>
1526 </svn>
1527 </target>
1528
1529 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1530 <antcall target="checkout-gs2build"/>
1531 <antcall target="unzip-windows-packages"/>
1532 <antcall target="checkout-winbin"/>
1533 <antcall target="get-windows-binaries"/>
1534 <antcall target="delete-winbin"/>
1535 </target>
1536
1537 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1538 <echo>checking out gs2build</echo>
1539 <svn>
1540 <checkout url="${svn.root}/gs2build" destPath="gs2build" revision="${branch.revision}"/>
1541 </svn>
1542 </target>
1543
1544 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1545 unless="nosvn.mode">
1546 <svn>
1547 <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin" revision="${branch.revision}"/>
1548 </svn>
1549 </target>
1550
1551 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1552 <svn>
1553 <update dir="winbin" revision="${branch.revision}"/>
1554 </svn>
1555 </target>
1556
1557 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1558 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1559 <fileset dir="${basedir}/winbin/bin"/>
1560 </move>
1561 </target>
1562
1563 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1564 <delete dir="${basedir}/winbin"/>
1565 </target>
1566
1567 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
1568 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
1569 dest="${common.src.home}/packages/windows/crypt"/>
1570 <unzip src="${common.src.home}/packages/windows/expat/expat.zip"
1571 dest="${common.src.home}/packages/windows/expat"/>
1572 <untar compression="gzip"
1573 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
1574 dest="${common.src.home}/packages/sqlite"/>
1575 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
1576 dest="${common.src.home}/indexers/packages/windows/iconv"/>
1577 </target>
1578
1579 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1580 <!-- we want a windows path in the setup.bat file -->
1581 <pathconvert targetos="windows" property="gs2build.home.windows">
1582 <path path="${gs2build.home}"/>
1583 </pathconvert>
1584 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1585 <filterset>
1586 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1587 </filterset>
1588 </move>
1589 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1590 </target>
1591
1592
1593 <target name="clean-build-src" depends="init" if="collection.building.enabled">
1594 <!-- unix: -->
1595 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1596 <arg value="clean"/>
1597 </exec>
1598 <!-- windows: -->
1599 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1600 <arg value="/f"/>
1601 <arg value="win32.mak"/>
1602 <arg value="clean"/>
1603 <arg value="GSDLHOME=${gs2build.home}"/>
1604 </exec>
1605 </target>
1606
1607
1608 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
1609 <!-- unix: -->
1610 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1611 <arg value="distclean"/>
1612 </exec>
1613 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1614 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1615 <arg value="/f"/>
1616 <arg value="win32.mak"/>
1617 <arg value="clean"/>
1618 <arg value="GSDLHOME=${gs2build.home}"/>
1619 </exec>
1620 </target>
1621
1622 <target name="configure-build-src" depends="init" if="collection.building.enabled"
1623 description="Configure the build-src component">
1624 <exec executable="${build.src.home}/configure" os="${os.unix}"
1625 dir="${build.src.home}" failonerror="true">
1626 <arg value="--prefix=${gs2build.home}"/>
1627 <arg line="${static.arg}"/>
1628 </exec>
1629 </target>
1630
1631 <!-- common-src is done separately and needs to be compiled first -->
1632 <target name="compile-build-src" depends="init" if="collection.building.enabled">
1633
1634 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true"/>
1635 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
1636 <arg value="install"/>
1637 </exec>
1638
1639 <!-- run the setup script -->
1640 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>-->
1641 <!--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-->
1642 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1643 <arg value="/f"/>
1644 <arg value="win32.mak"/>
1645 <arg value="GSDLHOME=${gs2build.home}"/>
1646 </exec>
1647 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1648 <arg value="/f"/>
1649 <arg value="win32.mak"/>
1650 <arg value="install"/>
1651 <arg value="GSDLHOME=${gs2build.home}"/>
1652 </exec>
1653 </target>
1654
1655
1656 <!-- ======================== TESTING Targets ========================= -->
1657
1658 <target name="test" description="Run the (incomplete) JUnit test suite "
1659 depends="init">
1660 <mkdir dir="${basedir}/test"/>
1661 <junit printsummary="withOutAndErr"
1662 errorproperty="test.failed"
1663 failureproperty="test.failed"
1664 fork="${junit.fork}">
1665 <formatter type="plain"/>
1666 <classpath>
1667 <pathelement location="${build.home}/gsdl3test.jar"/>
1668 <path refid="compile.classpath"/>
1669 </classpath>
1670 <test name="${testcase}" if="testcase"/>
1671 <batchtest todir="${basedir}/test" unless="testcase">
1672 <fileset dir="${build.home}" includes="**/*Test.class" />
1673 </batchtest>
1674 </junit>
1675 <echo>
1676 *********************************************
1677 Test output can be found in directory 'test'
1678 *********************************************
1679 </echo>
1680 </target>
1681
1682 <!-- ======================== FLAX Targets ========================= -->
1683 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
1684 <echo>checking out flax ...</echo>
1685 <mkdir dir="${basedir}/src/java/org/flax"/>
1686 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1687 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
1688 <mkdir dir="${web.home}/interfaces/flax"/>
1689 <mkdir dir="${web.home}/sites/flax"/>
1690 <mkdir dir="${basedir}/flax-resources"/>
1691 <mkdir dir="${basedir}/flax-lib"/>
1692 <svn>
1693 <checkout url="${flax.checkout.path}/src/java/org/flax/"
1694 destPath="${basedir}/src/java/org/flax"/>
1695 <checkout url="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax/"
1696 destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1697 <checkout url="${flax.checkout.path}/web/WEB-INF/classes/flax/"
1698 destPath="${web.home}/WEB-INF/classes/flax"/>
1699 <checkout url="${flax.checkout.path}/web/interfaces/flax/"
1700 destPath="${web.home}/interfaces/flax"/>
1701 <checkout url="${flax.checkout.path}/web/sites/flax/"
1702 destPath="${web.home}/sites/flax"/>
1703 <checkout url="${flax.checkout.path}/flax-resources"
1704 destPath="${basedir}/flax-resources"/>
1705 <checkout url="${flax.checkout.path}/lib"
1706 destPath="${basedir}/flax-lib"/>
1707 </svn>
1708 <echo>prepare flax files...</echo>
1709 <move file="${web.home}/WEB-INF/web.xml" tofile="${web.home}/WEB-INF/web.xml.greenstone3backup"/>
1710 <antcall target="flax-copy-files" />
1711 <antcall target="unzip-flax-resources" />
1712 </target>
1713
1714 <target name="update-flax" description="update flax from repository">
1715 <echo>updating flax ...</echo>
1716 <svn>
1717 <update dir="${basedir}/src/java/org/flax"/>
1718 <update dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1719 <update dir="${web.home}/WEB-INF/classes/flax"/>
1720 <update dir="${web.home}/interfaces/flax"/>
1721 <update dir="${web.home}/sites/flax"/>
1722 </svn>
1723 <antcall target="flax-copy-files" />
1724 </target>
1725
1726 <target name="unzip-flax-resources" >
1727 <property name="classes.dir" value="${web.home}/WEB-INF/classes/flax"/>
1728 <unzip dest="${classes.dir}">
1729 <fileset dir="${classes.dir}">
1730 <include name="*.zip"/>
1731 </fileset>
1732 </unzip>
1733 <delete>
1734 <fileset dir="${classes.dir}" includes="*.zip"/>
1735 </delete>
1736 </target>
1737
1738 <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
1739 <echo>copying flax files ...</echo>
1740 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
1741 <!-- A configuration file containing web service binding information for the axis engine -->
1742 <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
1743 <copy file="${basedir}/flax-resources/flax-build.xml" todir="${basedir}" overwrite="true" />
1744 <copy file="${basedir}/flax-lib/opennlp-tools-1.3.0.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />
1745 </target>
1746
1747
1748
1749
1750 <target name="compile-javadocs">
1751 <javadoc packagenames="org.greenstone.*"
1752 sourcepath="src/java"
1753 defaultexcludes="yes"
1754 destdir="docs/javadoc"
1755 author="true"
1756 version="true"
1757 use="true"
1758 windowtitle="Greenstone3 API">
1759 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
1760 </javadoc>
1761 </target>
1762
1763<!-- ========== Some distribution targets ======================== -->
1764 <target name="remove-source">
1765 <delete includeEmptyDirs="true">
1766 <fileset dir="." defaultexcludes="false">
1767 <patternset refid="greenstone3.source.component"/>
1768 </fileset>
1769 </delete>
1770 </target>
1771
1772 <target name="dist-tidy"
1773 description="'tidies-up' a greenstone3 installation for distribution.">
1774
1775 <!-- delete unneeded things -->
1776 <delete dir="${packages.home}/axis"/>
1777 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
1778 <delete file="README-SVN.txt"/>
1779 <delete file="build.properties.in"/>
1780
1781 <!-- delete source files -->
1782 <antcall target="remove-source"/>
1783
1784 <!-- create empty directories -->
1785 <mkdir dir="${web.home}/applet"/>
1786 <mkdir dir="${web.home}/logs"/>
1787
1788 <!-- os specific tidy-ups -->
1789 <!-- linux, mac -->
1790 <if><bool><istrue value="${current.os.isunix}"/></bool>
1791 <delete><fileset dir="." includes="*.bat"/></delete>
1792 <delete><fileset dir="gli" includes="*.bat"/></delete>
1793 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
1794 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
1795 <delete file="${basedir}/gs2build/win32cfg.h"/>
1796 <delete file="${basedir}/gs2build/win32.mak"/>
1797 <delete dir="${basedir}/winutil"/>
1798 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
1799
1800 <!-- windows -->
1801 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
1802 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
1803 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
1804 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
1805 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
1806 </if></else></if>
1807
1808 </target>
1809
1810 <!-- fix up executable permissions for binary release -->
1811 <target name="fix-execute-permissions">
1812 <echo>Setting binaries to executable</echo>
1813 <chmod perm="775">
1814 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
1815 </chmod>
1816 </target>
1817
1818 <!-- fix up executable permissions for source code release -->
1819 <target name="fix-execute-permissions-source">
1820 <chmod perm="775">
1821 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
1822 </chmod>
1823 </target>
1824
1825
1826 <!-- ============= tweaks for making compilation static ========== -->
1827 <target name="tweak-makefiles" depends="init" if="compile.static">
1828 <antcall target="rtftohtml-add-static" />
1829 </target>
1830
1831 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
1832 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
1833 </target>
1834
1835</project>
Note: See TracBrowser for help on using the repository browser.