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

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

Added additional properties that are used when the release-kit wants to create a static build using the support library

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