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

Last change on this file since 23669 was 23669, checked in by xiao, 13 years ago

modified flax-copy-files target not to do tomcat.server/port replacements in FlaxWebService.wsdl as it disrupts what is being done by release-kits; will come up a solution with svn-install later

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