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

Last change on this file since 23443 was 23443, checked in by xiao, 14 years ago

modified target flax-copy-files

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