source: main/trunk/greenstone3/build.xml@ 22870

Last change on this file since 22870 was 22870, checked in by sjm84, 14 years ago

Fixed a small typo in previous commit

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