source: main/branches/64_bit_Greenstone/greenstone3/build.xml@ 23606

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

Merging the latest Greenstone 3 trunk changes into the 64-bit branch

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