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

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

Added a path environment variable to the build- and common-src configure scripts

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