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

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

More refactoring on the support-lib part of the Greenstone3 build.xml file

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