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

Last change on this file since 22940 was 22940, checked in by sjm84, 13 years ago

Several small fixes for using the gnome-lib extension for static compilation

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