source: main/tags/stable4flax/greenstone3/build.xml@ 25905

Last change on this file since 25905 was 25905, checked in by xiao, 12 years ago

modified flax targets to reflect flax2 release

File size: 98.9 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="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
26
27
28 <!-- ===================== Property Definitions =========================== -->
29
30 <!--
31
32 Each of the following properties are used in the build script.
33 Values for these properties are set by the first place they are
34 defined, from the following list:
35
36 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
37
38 * Definitions from a "build.properties" file in the top level
39 source directory of this application.
40
41 * Definitions from a "build.properties" file in the user's
42 home directory.
43
44 * Default definitions in this build.xml file.
45
46 You will note below that property values can be composed based on the
47 contents of previously defined properties. This is a powerful technique
48 that helps you minimize the number of changes required when your development
49 environment is modified. Note that property composition is allowed within
50 "build.properties" files as well as in the "build.xml" script.
51
52 -->
53
54 <!-- create build.properties if it has not been created yet -->
55 <if>
56 <bool><not><available file="build.properties"/></not></bool>
57 <copy file="build.properties.in" tofile="build.properties"/>
58 </if>
59
60 <!-- create the packages dir if it has not been created yet -->
61 <mkdir dir="packages"/>
62
63 <!--the first three properties have to be put on the top to be used by build.properties-->
64 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
65 <property name="src.packages.home" value="${basedir}/src/packages"/>
66 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
67
68 <property file="build.properties"/>
69 <if><bool><available file="${user.home}/build.properties"/></bool>
70 <property file="${user.home}/build.properties"/>
71 </if>
72
73 <!-- now we've read in properties, apply defaults -->
74 <property name="disable.collection.building" value="false"/>
75
76 <!-- get properties from the environment -->
77 <property environment="env"/>
78
79 <!-- get the filesets defining components and executables -->
80 <import file="resources/xml/components.xml"/>
81 <import file="resources/xml/executables.xml"/>
82
83 <!-- version properties for external packages -->
84 <!-- for Java versions < 1.4, we print out the message that Java is too old.
85 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 7.0-->
86 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-7.0.26">
87 <equals arg1="1.4" arg2="${ant.java.version}"/>
88 </condition>
89 <condition property="tomcat.version.major" value="5" else="7">
90 <equals arg1="1.4" arg2="${ant.java.version}"/>
91 </condition>
92 <condition property="privileged.attribute" value="privileged='true'" else="">
93 <equals arg1="7" arg2="${tomcat.version.major}"/>
94 </condition>
95
96 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
97 <property name="axis.dir.version" value="axis-1_4"/>
98 <property name="sqlite.targz.version" value="sqlite-autoconf-3070602.tar.gz"/>
99
100 <property name="build.home" value="${basedir}/build"/>
101 <property name="src.home" value="${basedir}/src/java"/>
102 <property name="packages.home" value="${basedir}/packages"/>
103 <!-- this may be set in build.properties, eg if you move the web dir to
104 tomcats webapps directory -->
105 <property name="web.home" value="${basedir}/web"/>
106 <!-- jar files needed by applets go here -->
107 <property name="web.applet" value="${web.home}/applet"/>
108
109 <!-- jar files needed by the servlet (and extra ones) go here -->
110 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
111 <!-- other files needed by the servlet go here -->
112 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
113 <!--- flax: the WordNet home -->
114 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
115
116 <!-- jni libraries and java wrappers go here -->
117 <property name="lib.jni" value="${basedir}/lib/jni"/>
118
119 <!-- other jar files needed for installation (but not runtime) go here -->
120 <property name="lib.java" value="${basedir}/lib/java"/>
121
122 <property name="javadocs" value="${basedir}/docs/javadoc"/>
123
124 <property name="app.name" value="greenstone3"/>
125 <property name="app.path" value="/${app.name}"/>
126
127 <property name="admin.dir" value="${basedir}/admin"/>
128
129 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
130 <property name="app.version" value="trunk"/>
131 <property name="branch.path" value="trunk"/>
132 <property name="branch.revision" value="HEAD"/>
133
134 <!--constants -->
135 <property name="svn.root" value="http://svn.greenstone.org"/>
136
137 <!-- catalina home is set to tomcat basedir if already installed, otherwise
138 use greenstone's tomcat -->
139 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
140 <and>
141 <isset property="tomcat.installed.path"/>
142 <not>
143 <equals arg1="" arg2="${tomcat.installed.path}"/>
144 </not>
145 </and>
146 </condition>
147
148 <property name="os.linux" value="Linux"/>
149 <property name="os.mac" value="Mac OS X"/>
150 <property name="os.solaris" value="SunOS"/>
151 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
152 <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!!!-->
153
154 <!-- this is true for linux and macs -->
155 <condition property="current.os.isunix">
156 <os family="unix"/>
157 </condition>
158
159 <condition property="current.os.isunixnotmac">
160 <and>
161 <os family="unix"/>
162 <not>
163 <os family="mac"/>
164 </not>
165 </and>
166 </condition>
167
168 <condition property="current.os.ismac">
169 <os family="mac"/>
170 </condition>
171
172 <condition property="current.os.iswindows">
173 <os family="windows"/>
174 </condition>
175
176 <!-- is there a better way to do this?? what about solaris?? -->
177 <condition property="os.bin.dir" value="windows">
178 <os family="windows"/>
179 </condition>
180 <condition property="os.bin.dir" value="darwin">
181 <os family="mac"/>
182 </condition>
183 <condition property="os.bin.dir" value="linux">
184 <and>
185 <os family="unix"/>
186 <not>
187 <os family="mac"/>
188 </not>
189 </and>
190 </condition>
191
192
193 <condition property="collection.building.disabled">
194 <and>
195 <isset property="disable.collection.building"/>
196 <istrue value="${disable.collection.building}"/>
197 </and>
198 </condition>
199
200 <condition property="collection.building.enabled">
201 <not>
202 <istrue value="${disable.collection.building}"/>
203 </not>
204 </condition>
205
206 <condition property="collection.building.enabled.windows">
207 <and>
208 <istrue value="${collection.building.enabled}"/>
209 <isset property="current.os.iswindows"/>
210 </and>
211 </condition>
212
213 <condition property="collection.building.enabled.unix">
214 <and>
215 <istrue value="${collection.building.enabled}"/>
216 <isset property="current.os.isunix"/>
217 </and>
218 </condition>
219
220 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
221 <isset property="compile.static"/>
222 </condition>
223
224 <!-- If building a release then we want to adjust environment variables so that the support library can be see during compilation -->
225 <if><bool><isset property="use.support.lib"/></bool>
226 <property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
227
228 <if><bool><isset property="env.CFLAGS"/></bool>
229 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CFLAGS}&quot;"/>
230 <else>
231 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
232 </else>
233 </if>
234
235 <if><bool><isset property="env.CPPFLAGS"/></bool>
236 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CPPFLAGS}&quot;"/>
237 <else>
238 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
239 </else>
240 </if>
241
242 <if><bool><isset property="env.CXXFLAGS"/></bool>
243 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CXXFLAGS}&quot;"/>
244 <else>
245 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
246 </else>
247 </if>
248
249 <if><bool><isset property="env.LDFLAGS"/></bool>
250 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib ${env.LDFLAGS}&quot;"/>
251 <else>
252 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib&quot;"/>
253 </else>
254 </if>
255
256 <if><bool><isset property="env.PATH"/></bool>
257 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin:${env.PATH}&quot;"/>
258 <else>
259 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin&quot;"/>
260 </else>
261 </if>
262
263 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
264 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig:${env.PKG_CONFIG_PATH}&quot;"/>
265 <else>
266 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig&quot;"/>
267 </else>
268 </if>
269
270 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
271 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
272 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}&quot;"/>
273 <else>
274 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
275 </else>
276 </if>
277 <else>
278 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
279 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
280 <else>
281 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
282 </else>
283 </if>
284 </else>
285 </if>
286
287 <else>
288 <if><bool><isset property="env.CFLAGS"/></bool>
289 <property name="cflags.arg" value="CFLAGS=&quot;${env.CFLAGS}&quot;"/>
290 <else>
291 <property name="cflags.arg" value=" "/>
292 </else>
293 </if>
294
295 <if><bool><isset property="env.CPPFLAGS"/></bool>
296 <property name="cppflags.arg" value="CPPFLAGS=&quot;${env.CPPFLAGS}&quot;"/>
297 <else>
298 <property name="cppflags.arg" value=" "/>
299 </else>
300 </if>
301
302 <if><bool><isset property="env.CXXFLAGS"/></bool>
303 <property name="cxxflags.arg" value="CXXFLAGS=&quot;${env.CXXFLAGS}&quot;"/>
304 <else>
305 <property name="cxxflags.arg" value=" "/>
306 </else>
307 </if>
308
309 <if><bool><isset property="env.LDFLAGS"/></bool>
310 <property name="ldflags.arg" value="LDFLAGS=&quot;${env.LDFLAGS}&quot;"/>
311 <else>
312 <property name="ldflags.arg" value=" "/>
313 </else>
314 </if>
315
316 <if><bool><isset property="env.PATH"/></bool>
317 <property name="path.arg" value="PATH=&quot;${env.PATH}&quot;"/>
318 <else>
319 <property name="path.arg" value=" "/>
320 </else>
321 </if>
322
323 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
324 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${env.PKG_CONFIG_PATH}&quot;"/>
325 <else>
326 <property name="pcpath.arg" value=" "/>
327 </else>
328 </if>
329
330 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
331 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
332 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
333 <else>
334 <property name="ldlpath.arg" value=" "/>
335 </else>
336 </if>
337 <else>
338 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
339 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
340 <else>
341 <property name="ldlpath.arg" value=" "/>
342 </else>
343 </if>
344 </else>
345 </if>
346 </else>
347 </if>
348 <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
349
350 <condition property="gs2.opt.args" value= " " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
351 <istrue value="${with.jni}"/>
352 </condition>
353 <condition property="gs2.compile.target" value="with-jni" else="without-jni">
354 <istrue value="${with.jni}"/>
355 </condition>
356 <condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
357 <istrue value="${with.jni}"/>
358 </condition>
359 <condition property="gs2.windows.enablejni" value="1" else="0">
360 <istrue value="${with.jni}"/>
361 </condition>
362 <condition property="gs2.windows.enablemg" value="1" else="0">
363 <istrue value="${with.jni}"/>
364 </condition>
365 <condition property="gs2.windows.enablemgpp" value="1" else="0">
366 <istrue value="${with.jni}"/>
367 </condition>
368 <!-- Should accent folding not also be set here ?? -->
369 <condition property="gs2.windows.usegdbm" value="1" else="0">
370 <istrue value="${with.jni}"/>
371 </condition>
372 <condition property="gs2.windows.usesqlite" value="1" else="0">
373 <istrue value="${with.jni}"/>
374 </condition>
375
376 <!-- where is search4j tool -->
377 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
378 <isset property="current.os.iswindows"/>
379 </condition>
380
381
382 <!-- ============= Base dirs for each package and component ============ -->
383 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
384 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
385 <property name="gli.home" value="${basedir}/gli"/>
386 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
387
388 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
389 <istrue value="${disable.collection.building}"/>
390 </condition>
391
392 <property name="build.src.home" value="${gs2build.home}/build-src"/>
393 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
394 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
395 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
396 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
397
398 <!-- ==================== Compilation Control Options ==================== -->
399
400 <!--
401
402 These properties control option settings on the Javac compiler when it
403 is invoked using the <javac> task.
404
405 compile.debug Should compilation include the debug option?
406
407 compile.deprecation Should compilation include the deprecation option?
408
409 compile.optimize Should compilation include the optimize option?
410
411 -->
412
413 <property name="compile.debug" value="true"/>
414 <property name="compile.deprecation" value="true"/>
415 <property name="compile.optimize" value="true"/>
416
417 <!--
418
419 Rather than relying on the CLASSPATH environment variable, Ant includes
420 features that makes it easy to dynamically construct the classpath you
421 need for each compilation. The example below constructs the compile
422 classpath to include the servlet.jar file, as well as the other components
423 that Tomcat makes available to web applications automatically, plus anything
424 that you explicitly added.
425
426 -->
427
428 <!-- All elements that Tomcat 5 exposes to applications -->
429 <path id="tomcat5">
430 <pathelement location="${catalina.home}/common/classes"/>
431 <fileset dir="${catalina.home}/common/endorsed">
432 <include name="*.jar"/>
433 </fileset>
434 <fileset dir="${catalina.home}/common/lib">
435 <include name="*.jar"/>
436 </fileset>
437 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
438 <pathelement location="${catalina.home}/shared/classes"/>
439 <fileset dir="${catalina.home}/shared/lib">
440 <include name="*.jar"/>
441 </fileset>
442 </path>
443
444 <!-- All elements that Tomcat 7 exposes to applications -->
445 <path id="tomcat7">
446 <fileset dir="${catalina.home}/lib">
447 <include name="*.jar"/>
448 </fileset>
449 </path>
450
451 <path id="compile.classpath">
452 <!-- Include all jar files and libraries in our jni lib directory -->
453 <pathelement location="${lib.jni}"/>
454 <fileset dir="${lib.jni}">
455 <include name="*.jar"/>
456 </fileset>
457 <!-- Include all jar files in our web lib directory -->
458 <pathelement location="${web.lib}"/>
459 <fileset dir="${web.lib}">
460 <include name="*.jar"/>
461 </fileset>
462
463 <pathelement location="${lib.java}"/>
464 <fileset dir="${lib.java}">
465 <include name="*.jar"/>
466 </fileset>
467
468 <!-- include the jar files from the source packages -->
469 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
470 so we add them in by name -->
471 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
472 <pathelement location="${lib.jni}/mg.jar"/>
473 <pathelement location="${lib.jni}/mgpp.jar"/>
474
475 <!-- Include all elements that Tomcat exposes to applications -->
476 <path refid="tomcat${tomcat.version.major}"/>
477
478 </path>
479
480 <path id="local.tomcat.classpath">
481 <!-- explicitly include the jni java wrappers in the classpath -->
482 <pathelement location="${lib.jni}"/>
483 <fileset dir="${lib.jni}">
484 <include name="*.jar"/>
485 </fileset>
486
487 <pathelement location="${web.lib}"/>
488 <fileset dir="${web.lib}">
489 <include name="derby.jar"/>
490 </fileset>
491 </path>
492
493 <path id="local.tomcat.path">
494 <pathelement location="${basedir}/bin/script"/>
495 <pathelement location="${basedir}/bin"/>
496 <pathelement location="${lib.jni}"/>
497 <pathelement path="${env.PATH}"/>
498 <pathelement path="${env.Path}"/>
499 <pathelement path="${wn.home}/bin"/>
500 </path>
501
502 <target name="test-setup">
503 <echo>ant java version=${ant.java.version}</echo>
504 <echo>is unix : ${current.os.isunix}</echo>
505 <echo>is mac : ${current.os.ismac}</echo>
506 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
507 <echo>is windows : ${current.os.iswindows}</echo>
508 <echo>os.unix: ${os.unix}</echo>
509 </target>
510
511 <!-- ==================== Primary and Global Targets ============================= -->
512
513 <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"
514 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.">
515
516 <!-- make sure .sh files are executable -->
517 <chmod dir="${basedir}" perm="ugo+rx"
518 includes="*.sh"/>
519 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
520 includes="*.sh,*.pl"/>
521 </target>
522
523 <!-- 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 -->
524 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
525 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
526
527 <target name="install-common-src" depends="init"
528 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
529 <antcall target="configure-common-src"/>
530 <antcall target="compile-common-src"/>
531 <antcall target="install-auxiliary-jar-files"/>
532 <antcall target="install-jni-files"/>
533 </target>
534
535 <target name="install-collection-building" depends="init" if="collection.building.enabled"
536 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
537 <antcall target="configure-collection-building"/>
538 <antcall target="tweak-makefiles" />
539 <antcall target="compile-collection-building"/>
540 </target>
541
542
543 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
544 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
545
546 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
547 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
548
549 <target name="configure" depends="init,configure-tomcat,configure-web"
550 description="Configure the installation (not the C++ code). Includes setting up config files. Should be re-run if you change the build.properties file, including if you change the port number."/>
551
552 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
553 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
554
555 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
556 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
557
558 <target name="update" depends="init,svnupdate,clean,install"
559 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'"/>
560
561
562 <target name="perl-for-building" depends="init">
563 <!-- uses perl.path if set in build.properties, otherwise try for
564 environment variable PERLPATH, and failing that assumes 'perl'
565 is on environment PATH -->
566 <!-- if, outside build.properties, we only set perl.path if we have gs2build/build-src (collection building), then we won't set perl.path in a (flax) binary, since it doesn't have build-src -->
567 <if><bool><available file="${gs2build.home}"/></bool>
568
569 <if><bool><not><isset property="perl.path"/></not></bool>
570
571 <if>
572 <bool>
573 <and>
574 <isset property="env.PERLPATH"/>
575 <not><equals arg1="${env.PERLPATH}" arg2=""/></not>
576 </and>
577 </bool>
578 <property name="perl.path" value="${env.PERLPATH}"/>
579 <else>
580 <echo>
581 Using PATH environment variable to locate Perl.
582 </echo>
583 <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
584 <arg value="perl" />
585 </exec>
586
587 <exec executable="${gs2build.home}/bin/windows/which" os="${os.windows}" spawn="false" outputproperty="full.perl.path">
588 <arg value="perl" />
589 </exec>
590
591 <stringutil string="${full.perl.path}" property="partial.perl.path">
592 <replace regex="\/[^\/]*$" replacement="/" />
593 </stringutil>
594 <stringutil string="${partial.perl.path}" property="perl.path">
595 <replace regex="\\[^\\]*$" replacement="\\" />
596 </stringutil>
597 <if><bool><istrue value="${current.os.isunix}"/></bool>
598
599 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
600 <echo>
601 Non-standard location of Perl found: ${full.perl.path}
602 Set the environment variable PERLPATH or the perl.path property in
603 build.properties to explicitly control the version of Perl used.
604 </echo>
605 </if>
606 </if>
607 </else>
608 </if>
609 </if>
610
611 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
612 <if><bool><isset property="perl.path"/></bool>
613 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
614 <else>
615 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
616 </else>
617 </if>
618
619 <!-- gs2build not available, perl.path -->
620 <else>
621 <property name="perl.path" value=""/>
622 </else>
623 </if>
624 </target>
625
626 <target name="get-default-servlet-url">
627 <echo>http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}</echo>
628 </target>
629
630 <target name="start" depends="init,configure-web,start-tomcat"
631 description="Startup the Tomcat server." >
632 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
633 <echo>Tomcat: ${catalina.home}</echo>
634 <echo>Java : ${java.home}</echo>
635 <if><bool><available file="${build.src.home}"/></bool>
636 <echo>Perl : ${full.perl.path}</echo>
637 </if>
638 <if><bool><isset property="install.flax"/></bool>
639 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/flax"/>
640 <else>
641 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/"/>
642 </else>
643 </if>
644 <echo>URL : ${url}</echo>
645 <!-- assuming that index.html is not needed here -->
646 </target>
647
648 <target name="stop" depends="init,stop-tomcat"
649 description="Shutdown the Tomcat server."/>
650
651 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
652
653
654 <!-- =========== Help targets =================================== -->
655
656 <property name="install-command" value="ant [options] prepare install"/>
657
658 <target name="usage" description="Print a help message">
659 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
660 <echo message=" Execute 'ant -help' for Ant help."/>
661 <echo>
662 To install Greenstone3, run '${install-command}'.
663 There are properties defined in build.properties. The install
664 process will ask you if these properties are set correctly.
665 To avoid this prompt, use the '-Dproperties.accepted=yes'
666 option.
667 To log the output, use the '-logfile build.log' option.
668 The README.txt file has more information about the ant targets
669 and install process.
670 </echo>
671 </target>
672
673 <target name="help" depends="usage" description="Print a help message"/>
674
675 <target name="debug" depends="init" description="Display all the currently used properties">
676 <echoproperties/>
677 </target>
678
679 <!-- ====== initialization and setup targets ================== -->
680
681 <target name="accept-properties" unless="properties.accepted">
682 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
683 tomcat.server=${tomcat.server}
684 tomcat.port=${tomcat.port}
685 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
686 proxy.host=${proxy.host}
687 proxy.port=${proxy.port}
688 disable.collection.building=${disable.collection.building}
689 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
690 </input>
691 <condition property="do.abort">
692 <equals arg1="n" arg2="${properties.ok}"/>
693 </condition>
694 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
695 </target>
696
697 <!-- this sets up some initial properties -->
698 <target name="init">
699
700 <!-- has the gs3-setup script been run?? -->
701 <condition property="gs3-setup-not-done">
702 <not>
703 <isset property="env.GSDL3HOME"/>
704 </not>
705 </condition>
706
707 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
708
709 <condition property="java.too.old">
710 <or>
711 <equals arg1="1.1" arg2="${ant.java.version}"/>
712 <equals arg1="1.2" arg2="${ant.java.version}"/>
713 <equals arg1="1.3" arg2="${ant.java.version}"/>
714 </or>
715 </condition>
716 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
717
718 <available file="${basedir}/gli" property="gli.present"/>
719 <available file="${basedir}/common-src" property="common.src.present"/>
720 <available file="${basedir}/gs2build" property="gs2build.present"/>
721
722 <condition property="tomcat.islocal">
723 <or>
724 <not><isset property="tomcat.installed.path"/></not>
725 <equals arg1="" arg2="${tomcat.installed.path}"/>
726 </or>
727 </condition>
728
729 <echo>tomcat.port = ${tomcat.port}</echo>
730
731 <condition property="proxy.present">
732 <and>
733 <isset property="proxy.host"/>
734 <not><equals arg1="" arg2="${proxy.host}"/></not>
735 </and>
736 </condition>
737
738 <!--
739 the next block checks if the bundled tomcat is present in the 'packages' directory,
740 and checks for the lethal combination of tomcat 7 and java 1.4. Test for
741 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
742 download, as there is no other surefire way to check tomcat version under java 1.4
743 -->
744 <condition property="packages.tomcat.ispresent" value="true" else="false">
745 <available file="packages/tomcat"/>
746 </condition>
747 <condition property="packages.tomcat.istomcat7" value="true" else="false">
748 <available file="packages/tomcat/tomcat7.txt"/>
749 </condition>
750 <if>
751 <bool>
752 <and>
753 <istrue value="${packages.tomcat.ispresent}"/>
754 <istrue value="${packages.tomcat.istomcat7}"/>
755 <equals arg1="1.4" arg2="${ant.java.version}"/>
756 </and>
757 </bool>
758 <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>
759 </if>
760
761 </target>
762
763 <target name="setup-proxy" depends="init" if="proxy.present">
764 <condition property="ask.user">
765 <or>
766 <equals arg1="" arg2="${proxy.user}"/>
767 <equals arg1="" arg2="${proxy.password}"/>
768 </or>
769 </condition>
770
771 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
772 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
773 </target>
774
775 <!-- ========== Web app Targets ================================ -->
776
777 <target name="prepare-web" depends="init">
778 <mkdir dir="${web.home}/applet"/>
779 <mkdir dir="${web.home}/logs"/>
780 <mkdir dir="${web.home}/logs/tmp"/>
781 </target>
782
783 <!-- 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.
784 The test for whether we need it assumes we won't be trying to compile GS3 against Java versions less than 1.4. -->
785 <target name="configure-java-version" depends="init"
786 description="Activates or deactivates some jar libraries as needed depending on your java version">
787
788 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
789 <condition property="need.xalan.jar">
790 <or>
791 <not><equals arg1="1.4" arg2="${ant.java.version}"/></not>
792 </or>
793 </condition>
794
795 <!-- if they have xalan.jar but dont need it -->
796 <if>
797 <bool>
798 <and>
799 <isset property="have.xalan.jar"/>
800 <not><isset property="need.xalan.jar"/></not>
801 </and>
802 </bool>
803 <antcall target="deactivate-xalan-jar"/>
804 </if>
805
806 <!-- if they need xalan.jar but dont have it -->
807 <if>
808 <bool>
809 <and>
810 <not><isset property="have.xalan.jar"/></not>
811 <isset property="need.xalan.jar"/>
812 </and>
813 </bool>
814 <antcall target="activate-xalan-jar"/>
815 </if>
816
817 </target>
818
819 <target name="activate-xalan-jar">
820 <echo>activating xalan.jar</echo>
821 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
822 <if>
823 <bool>
824 <and>
825 <isset property="current.os.ismac"/>
826 <available file="${catalina.home}/common/endorsed" type="dir"/>
827 </and>
828 </bool>
829 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
830 </if>
831 </target>
832
833 <target name="deactivate-xalan-jar">
834 <echo>deactivating xalan.jar</echo>
835 <delete file="${web.lib}/xalan.jar"/>
836 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
837 </target>
838
839
840 <target name="prepare-collections" depends="init"
841 description="Unpack all the collections from their svn zipped versions">
842 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
843 <property name="index.zip" value="index.zip"/>
844
845 <echo message="installing collections..."/>
846 <antcall target="gs2mgdemo-install"/>
847 <antcall target="gs2mgppdemo-install"/>
848 <antcall target="gberg-install"/>
849 <antcall target="lucene-jdbm-demo-install"/>
850 </target>
851
852 <target name="gs2mgdemo-prepare" if="collect.dir">
853 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
854
855 <condition property="gs2mgdemo.present">
856 <and>
857 <available file="${gs2mgdemo.dir}/${index.zip}"/>
858 </and>
859 </condition>
860 </target>
861
862 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
863 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
864 <echo>collection gs2mgdemo installed</echo>
865 </target>
866
867 <target name="gs2mgppdemo-prepare" if="collect.dir">
868 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
869
870 <condition property="gs2mgppdemo.present">
871 <and>
872 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
873 </and>
874 </condition>
875 </target>
876
877 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
878 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
879 <echo>collection gs2mgppdemo installed</echo>
880 </target>
881
882 <target name="gberg-prepare" if="collect.dir">
883 <property name="gberg.dir" value="${collect.dir}/gberg"/>
884 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
885 </target>
886
887 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
888 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
889 <echo>collection gberg installed</echo>
890 </target>
891
892 <target name="lucene-jdbm-demo-prepare" if="collect.dir">
893 <property name="lucene-jdbm-demo.dir" value="${collect.dir}/lucene-jdbm-demo"/>
894 <available file="${lucene-jdbm-demo.dir}/${index.zip}" property="lucene-jdbm-demo.present"/>
895 </target>
896
897 <target name="lucene-jdbm-demo-install" if="lucene-jdbm-demo.present" depends="lucene-jdbm-demo-prepare">
898 <unzip dest="${lucene-jdbm-demo.dir}" src="${lucene-jdbm-demo.dir}/${index.zip}"/>
899 <echo>collection lucene-jdbm-demo installed</echo>
900 </target>
901
902 <target name="configure-web" depends="init,perl-for-building"
903 description="Configure only the web app config files">
904 <!-- we want a unix path in the global.properties file -->
905 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
906 <path path="${web.home}"/>
907 </pathconvert>
908 <stringutil string="${perl.path}" property="escaped.perl.path">
909 <replace regex="\\" replacement="\\\\" />
910 </stringutil>
911
912 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
913 <filter token="gsdl3version" value="${app.version}"/>
914 <filter token="tomcat.server" value="${tomcat.server}"/>
915 <filter token="tomcat.port" value="${tomcat.port}"/>
916 <filter token="perlpath" value="${escaped.perl.path}"/>
917 <filter token="disable.collection.building" value="${disable.collection.building}"/>
918 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
919 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
920 <chmod file="${web.classes}/global.properties" perm="600"/>
921 <chmod file="${web.classes}/log4j.properties" perm="600"/>
922 </target>
923
924 <target name="compile-web" depends="init">
925 <javac srcdir="${web.classes}"
926 destdir="${web.classes}"
927 debug="${compile.debug}"
928 deprecation="${compile.deprecation}"
929 optimize="${compile.optimize}">
930 <classpath><path refid="compile.classpath"/></classpath>
931 </javac>
932 </target>
933
934 <target name="compile-classpath-jars" depends="init">
935 <if><bool><available file="admin/cp.mf"/></bool>
936 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
937 </if>
938 <if><bool><available file="${lib.java}/cp.mf"/></bool>
939 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
940 </if>
941 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
942 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
943 </if>
944 <if><bool><available file="${web.lib}/cp.mf"/></bool>
945 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
946 </if>
947 <jar destfile="cp.jar">
948 <manifest>
949 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
950 </manifest>
951 </jar>
952 </target>
953
954 <target name="clean-classpath-jars" depends="init">
955 <delete file="admin/cp.jar"/>
956 <delete file="${lib.java}/cp.jar"/>
957 <delete file="${lib.jni}/cp.jar"/>
958 <delete file="${web.lib}/cp.jar"/>
959 <delete file="cp.jar"/>
960 </target>
961
962
963 <target name="svnupdate-web" unless="nosvn.mode">
964 <exec executable="svn">
965 <arg value="update"/>
966 <arg value="${web.home}"/>
967 <arg value="-r"/><arg value="${branch.revision}"/>
968 </exec>
969 </target>
970
971 <target name="update-web" depends="init,svnupdate-web,configure-web"
972 description="update only the web stuff (config files)"/>
973
974 <!-- ======================= Tomcat Targets ========================== -->
975
976 <!-- this target downloads and installs Tomcat -->
977 <!-- we download tomcat (version 7 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
978 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
979 description="downloads the appropriate version of Tomcat (Tomcat 5 if using Java 1.4, Tomcat 7 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/7 then you need to run prepare-tomcat">
980 <if>
981 <bool>
982 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
983 </bool>
984
985 <!-- check that packages dir is there -->
986 <mkdir dir="${packages.home}"/>
987 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
988 dest="${packages.home}/${tomcat.version}.zip"
989 usetimestamp="true"/>
990 <unzip src="${packages.home}/${tomcat.version}.zip"
991 dest="${packages.home}"/>
992
993 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
994 we would need to have the tomcat compat package to work with Java 1.4-->
995 <if>
996 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
997 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
998 dest="${packages.home}/${tomcat.version}-compat.zip"
999 usetimestamp="true"/>
1000 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
1001 dest="${packages.home}"/>
1002 </if>
1003
1004 <!-- delete any existing tomcat -->
1005 <delete dir="${packages.home}/tomcat"/>
1006 <move todir="${packages.home}/tomcat">
1007 <fileset dir="${packages.home}/${tomcat.version}"/>
1008 </move>
1009 <!--
1010 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
1011 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
1012 overwrite="true"/>
1013 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
1014 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
1015 overwrite="true"/>
1016 -->
1017 <!-- make sure we have execute permission for the .sh files -->
1018 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
1019 includes="*.sh"/>
1020
1021 <echo file="${packages.home}/tomcat/.flagfile">
1022 the timestamp of this file is the time that tomcat was extracted from the zip files.
1023 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
1024 </echo>
1025
1026 <!-- this is not strictly a prepare tomcat thing, but if one changes
1027 Java, then they need to change tomcat as well, so might as well call
1028 it here -->
1029 <antcall target="configure-java-version"/>
1030 <else>
1031 <echo>Tomcat has been prepared, will not prepare</echo>
1032 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
1033 </else>
1034
1035 </if>
1036
1037 </target>
1038
1039 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1040
1041 <target name="configure-tomcat-local" depends="init,perl-for-building" if="tomcat.islocal">
1042 <!-- re-setup the server.xml file -->
1043 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
1044 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
1045 <filterset>
1046 <filter token="port" value="${tomcat.port}"/>
1047 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
1048 </filterset>
1049 </copy>
1050 <!-- set up the greenstone3 context -->
1051 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
1052 <filterset>
1053 <filter token="gsdl3webhome" value="${web.home}"/>
1054 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
1055 </filterset>
1056 </copy>
1057
1058 <!-- set up the greenstone3 web.xml file -->
1059 <copy file="${basedir}/resources/tomcat/web.xml" tofile="${packages.home}/tomcat/conf/web.xml" overwrite="true">
1060 <filterset>
1061 <filter token="perlpath" value="${perl.path}"/>
1062 </filterset>
1063 </copy>
1064 </target>
1065
1066 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
1067 <!-- re-setup the server.xml file -->
1068 <!-- need to edit the config file, or do we get the user to do this???-->
1069 </target>
1070
1071
1072
1073<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
1074 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
1075 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
1076 <property name="tomcat.path" refid="local.tomcat.path"/>
1077 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
1078
1079 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
1080 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
1081
1082 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1083 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1084 <env key="GSDL3HOME" value="${basedir}"/>
1085 <env key="PATH" path="${tomcat.path}"/>
1086 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1087 <env key="CATALINA_HOME" value="${catalina.home}"/>
1088 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1089 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
1090 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
1091 <env key="WNHOME" path="${wn.home}"/>
1092 </exec>
1093 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
1094 <env key="GSDLOS" value="windows"/>
1095 <env key="GSDL3HOME" value="${basedir}"/>
1096 <env key="Path" path="${tomcat.path}"/>
1097 <env key="PATH" path="${tomcat.path}"/>
1098 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1099 <env key="CATALINA_HOME" value="${catalina.home}"/>
1100 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1101 </exec>
1102 <!-- wait for the server to startup in case other targets need it running -->
1103 <waitfor maxwait="5" maxwaitunit="second">
1104 <and>
1105 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1106 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
1107 </and>
1108 </waitfor>
1109 </target>
1110
1111 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
1112 <target name="reconfigure" description="Reconfigure the message router">
1113 <waitfor maxwait="5" maxwaitunit="second">
1114 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
1115 </waitfor>
1116 </target>
1117
1118 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
1119 <target name="reconfigure-collection" description="Reconfigure the collection">
1120 <waitfor maxwait="5" maxwaitunit="second">
1121 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
1122 </waitfor>
1123 </target>
1124
1125 <!-- windows: do we want to launch a webrowser?? -->
1126 <!-- shouldn't this test whether anything is running first?
1127 It's safer to always attempt to stop tomcat: that way we won't be dependent on the right time
1128 to check whether the server is stopped or still running before attempting to start again.
1129 This target, which was recently called force-stop-tomcat for a while but is back to being
1130 called stop-tomcat, now hides the Java exception output that appears whenever tomcat is already
1131 stopped as happens when stop-tomcat is called consecutively. -->
1132 <target name="force-stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
1133 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1134 <env key="CATALINA_HOME" value="${catalina.home}"/>
1135 <arg line=">/dev/null 2>&amp;1"/>
1136 </exec>
1137 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
1138 <env key="CATALINA_HOME" value="${catalina.home}"/>
1139 <arg line=">nul 2>&amp;1"/>
1140 </exec>
1141 </target>
1142
1143 <!-- Can also try the "socket" condition in place of the "http" condition
1144 And also use a <waitfor> in place of <condition>, such as:
1145 <waitfor maxwait="5" maxwaitunit="second" timeoutproperty="tomcat.isstopped"><http url="..."/></waitfor>
1146 The http URL resolves to host:port/greenstone3
1147 Condition uses <http/> rather than <socket/> for testing, since if the server was stopped, the socket
1148 might still be in use for some moments. We test the URL with the http condition since it's likelier to
1149 fail sooner if the server has indeed been stopped. -->
1150 <target name="check-tomcat-running">
1151 <condition property="tomcat.isrunning">
1152 <http url="http://${tomcat.server}:${tomcat.port}${app.path}"/>
1153 </condition>
1154 </target>
1155
1156 <!-- stop-tomcat checks if the tomcat server is already running. If it appears to be running
1157 (regardless of whether tomcat was just starting to shut down), this target calls force-stop-tomcat
1158 to issue the shutdown command to tomcat. Then it waits for at most 15 seconds for the server to
1159 actually stop by checking the socket at which tomcat listens every second, printing a warning
1160 at the end of the max wait time of 15 seconds if tomcat was still running. -->
1161 <target name="stop-tomcat" description="Shutdown only Tomcat if running" depends="check-tomcat-running" if="tomcat.isrunning">
1162 <antcall target="force-stop-tomcat"/>
1163
1164 <property name="wait.numchecks" value="15"/>
1165 <echo>Waiting for the server to shutdown... (${wait.numchecks} seconds max)</echo>
1166 <waitfor maxwait="${wait.numchecks}" maxwaitunit="second" checkevery="1" checkeveryunit="second" timeoutproperty="tomcat.timedout">
1167 <not><socket server="${tomcat.server}" port="${tomcat.port}"/></not>
1168 </waitfor>
1169
1170 <if>
1171 <bool>
1172 <isset property="${tomcat.timedout}"/>
1173 </bool>
1174 <property name="tomcat.isrunning" value="true"/>
1175 <echo>WARNING: Checked the socket ${wait.numchecks} times, but port ${tomcat.port} is still busy.</echo>
1176 <else>
1177 <echo>Tomcat is stopped.</echo>
1178 <property name="tomcat.isrunning" value="false"/>
1179 </else>
1180 </if>
1181 </target>
1182
1183 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
1184
1185 <target name="setup-catalina-ant-tasks">
1186 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
1187 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
1188 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1189 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
1190 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1191 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
1192 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1193 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
1194 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1195 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
1196 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1197 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
1198 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1199 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
1200 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1201 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
1202 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1203 </target>
1204
1205 <!-- http://blog.andrewbeacock.com/2007/11/how-to-truncate-log-file-using-ubuntu.html
1206 Doing "cat </dev/null > packages/tomcat/logs/catalina.out" doesn't work as an ant target.
1207 It seems to have a problem with cat or </dev/null, with or without the < sign. -->
1208 <target name="clean-logs" description="Empties catalina.out, greenstone.log and contents of web/logs/tmp">
1209 <echo>Truncating catalina.out and greenstone.log, and emptying ${web.home}/logs/tmp</echo>
1210 <exec executable="truncate" os="${os.unix}" dir="${catalina.home}/logs" spawn="false">
1211 <arg value="-s0"/>
1212 <arg value="catalina.out"/>
1213 </exec>
1214 <exec executable="truncate" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1215 <arg value="-s0"/>
1216 <arg value="greenstone.log"/>
1217 </exec>
1218
1219 <exec executable="cmd" os="${os.windows}" dir="${catalina.home}/logs" spawn="false">
1220 <arg line="/c echo. > catalina.out"/>
1221 </exec>
1222 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1223 <arg line="/c echo. > greenstone.log"/>
1224 </exec>
1225
1226 <if>
1227 <bool><available file="${web.home}/logs/tmp" type="dir"/></bool>
1228 <delete>
1229 <fileset dir="${web.home}/logs/tmp" includes="**/*"/>
1230 </delete>
1231 </if>
1232 </target>
1233
1234 <!-- ======================= ant Targets ============================ -->
1235 <target name="prepare-ant" depends="init">
1236 <if>
1237 <bool>
1238 <not><available file="${packages.home}/ant/.flagfile"/></not>
1239 </bool>
1240
1241 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1242 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1243 usetimestamp="true"/>
1244 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1245 dest="${packages.home}"/>
1246 <move todir="${packages.home}/ant">
1247 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1248 </move>
1249 <echo file="${packages.home}/ant/.flagfile">
1250 the timestamp of this file is the time that ant was extracted from the zip files.
1251 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1252 </echo>
1253
1254 <else>
1255 <echo>Ant has been prepared, will not prepare</echo>
1256 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1257 </else>
1258
1259 </if>
1260 </target>
1261
1262 <!-- ======================= Admin Targets ============================ -->
1263
1264 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1265 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1266 But you can do: echo mypassword | ant config-admin -->
1267 <target name="config-admin" description="Reset admin password">
1268 <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-8 characters):&gt;">
1269 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1270 </input>
1271 <!--<echo>PWD: ${admin.password}</echo>-->
1272 <antcall target="update-userdb">
1273 <param name="user.username" value="admin"/>
1274 <param name="user.password" value="${admin.password}"/>
1275 <param name="user.groups" value=""/>
1276 <param name="user.status" value=""/>
1277 <param name="user.comment" value="Password updated."/>
1278 <param name="user.email" value=""/>
1279 </antcall>
1280 </target>
1281
1282 <target name="config-user" description="Add or modify users" depends="get-user-data,update-userdb"/>
1283
1284 <target name="get-user-data" description="Get user details">
1285 <input addproperty="user.username" message="Username:&gt;"/>
1286 <input addproperty="user.password" defaultvalue="" message="Password (3-8 characters):&gt;">
1287 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1288 </input>
1289 <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list):&gt;"/>
1290 <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
1291 <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
1292 <input addproperty="user.email" defaultvalue="" message="Email:&gt;"/>
1293 </target>
1294
1295<!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1296 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1297 But you can do: echo mypassword | ant config-admin -->
1298 <target name="update-userdb" description="Add or modify users" depends="check-tomcat-running">
1299
1300 <!-- stop tomcat if running, since derby db is embedded and only allows connections from one jvm instance at a time
1301 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
1302 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
1303 <if>
1304 <bool>
1305 <istrue value="${tomcat.isrunning}"/>
1306 </bool>
1307 <antcall target="stop-tomcat"/>
1308 </if>
1309
1310 <!--<echo>${admin.password}</echo>--> <!-- for testing -->
1311 <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
1312 <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
1313 <arg file="${web.home}/sites/localsite/etc/usersDB"/>
1314 <arg value="${user.username}"/>
1315 <arg value="password=${user.password}"/>
1316 <arg value="groups=${user.groups}"/>
1317 <arg value="status=${user.status}"/>
1318 <arg value="comment=${user.comment}"/>
1319 <arg value="email=${user.email}"/>
1320 </java>
1321
1322 <!-- run tomcat again if it used to be running -->
1323 <if>
1324 <bool>
1325 <istrue value="${tomcat.isrunning}"/>
1326 </bool>
1327 <antcall target="start-tomcat"/>
1328 </if>
1329 </target>
1330
1331
1332 <!-- ======================= Axis Targets ============================ -->
1333
1334 <target name="prepare-axis" depends="init">
1335
1336 <if>
1337 <bool>
1338 <not><available file="${packages.home}/axis/.flagfile"/></not>
1339 </bool>
1340
1341 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1342 dest="${packages.home}/${axis.zip.version}"
1343 usetimestamp="true"/>
1344 <unzip src="${packages.home}/${axis.zip.version}"
1345 dest="${packages.home}"/>
1346 <move todir="${packages.home}/axis">
1347 <fileset dir="${packages.home}/${axis.dir.version}"/>
1348 </move>
1349 <!-- install axis into greenstone web app -->
1350 <copy todir="${web.lib}">
1351 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1352 <include name="*.jar"/>
1353 </fileset>
1354 </copy>
1355 <copy todir="${web.home}">
1356 <fileset dir="${packages.home}/axis/webapps/axis/">
1357 <include name="*.jsp"/>
1358 <include name="*.jws"/>
1359 </fileset>
1360 </copy>
1361 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1362 <copy todir="${web.classes}">
1363 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1364 <include name="*.properties"/>
1365 </fileset>
1366 </copy>
1367 <echo file="${packages.home}/axis/.flagfile">
1368 the timestamp of this file is the time that axis was extracted from the zip files.
1369 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1370 </echo>
1371
1372 <else>
1373 <echo>Axis has been prepared, will not prepare</echo>
1374 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1375 </else>
1376
1377 </if>
1378 </target>
1379
1380 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
1381 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
1382
1383 <target name="deploy-site">
1384 <java classname="org.apache.axis.client.AdminClient">
1385 <classpath refid="compile.classpath"/>
1386 <arg value="-l"/>
1387 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1388 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1389 </java>
1390 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
1391 </target>
1392
1393 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
1394 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
1395 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1396 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1397 tofile="${basedir}/resources/soap/undeploy.wsdd"
1398 filtering="true"
1399 overwrite="true"/>
1400 <java classname="org.apache.axis.client.AdminClient">
1401 <classpath refid="compile.classpath"/>
1402 <arg value="-l"/>
1403 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1404 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
1405 </java>
1406 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
1407 </target>
1408
1409 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1410 with the default servicename of localsite-->
1411 <target name="deploy-localsite" depends="init"
1412 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1413 <antcall target="start-tomcat"/>
1414 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
1415 <antcall target="create-deployment-files">
1416 <param name="axis.sitename" value="localsite"/>
1417 <param name="axis.servicesname" value="${base.webservice.name}"/>
1418 <param name="axis.siteuri" value="localsite"/>
1419 </antcall>
1420 <antcall target="deploy-site">
1421 <param name="axis.sitename" value="localsite"/>
1422 <param name="axis.servicesname" value="${base.webservice.name}"/>
1423 <param name="axis.siteuri" value="localsite"/>
1424 </antcall>
1425 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
1426 </target>
1427
1428 <target name="get-sitename" unless="axis.sitename">
1429 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
1430Press Enter for default:localsite</input>
1431 </target>
1432
1433 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1434 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1435To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1436Or press Enter for undeploying the default:localsite /&gt;</input>
1437 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1438 </target>
1439
1440 <target name="get-webservices" unless="axis.servicesname">
1441 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1442Choose from: ${web.services.list}
1443Or press Enter for default:${base.webservice.name} /&gt;</input>
1444 <echo>${axis.servicesname}</echo>
1445 </target>
1446
1447 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1448 <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>
1449 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1450 </target>
1451
1452 <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">
1453 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1454 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1455 </condition>
1456
1457 <!--everything else defaults to java:RPC at present-->
1458 <condition property="soap.method" value="provider='java:RPC'">
1459 <not>
1460 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1461 </not>
1462 </condition>
1463 </target>
1464
1465 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1466 <filter token="sitename" value="${axis.sitename}"/>
1467 <filter token="siteuri" value="${axis.siteuri}"/>
1468 <filter token="servicesname" value="${axis.servicesname}"/>
1469 <filter token="soapmethod" value="${soap.method}"/>
1470 <copy file="${basedir}/resources/soap/site.wsdd.template"
1471 tofile="${basedir}/resources/soap/deploy.wsdd"
1472 filtering="true"
1473 overwrite="true"/>
1474 <!-- create the java files and compile them -->
1475 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1476 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1477 filtering="true"
1478 overwrite="true"/>
1479 <mkdir dir="${build.home}"/>
1480 <javac srcdir="${src.home}"
1481 destdir="${build.home}"
1482 debug="${compile.debug}"
1483 deprecation="${compile.deprecation}"
1484 optimize="${compile.optimize}">
1485 <classpath refid="compile.classpath"/>
1486 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1487 </javac>
1488 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1489 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1490 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1491 overwrite="true" />
1492 </target>
1493
1494
1495 <!-- ====================== Core targets ============================== -->
1496 <!-- core targets refer to the core gsdl3 java src -->
1497
1498 <target name="prepare-core"/>
1499
1500 <target name="configure-core"/>
1501
1502 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1503 description="Update only the Greenstone core" />
1504
1505 <target name="svnupdate-core" unless="nosvn.mode">
1506 <exec executable="svn">
1507 <arg value="update"/>
1508 <arg value="${basedir}"/>
1509 <arg value="-r"/><arg value="${branch.revision}"/>
1510 </exec>
1511 </target>
1512
1513 <target name="clean-core"
1514 description="Clean only the Greenstone core">
1515 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1516 <delete dir="${build.home}"/>
1517 </target>
1518
1519 <target name="compile-core" depends="init"
1520 description="Compile only the Greenstone core">
1521 <mkdir dir="${build.home}"/>
1522
1523 <if><bool><isset property="with.jni"/></bool>
1524 <javac srcdir="${src.home}"
1525 destdir="${build.home}"
1526 debug="${compile.debug}"
1527 deprecation="${compile.deprecation}"
1528 optimize="${compile.optimize}">
1529 <classpath>
1530 <path refid="compile.classpath"/>
1531 </classpath>
1532 </javac>
1533 <else>
1534 <property name="gsprefix" value=""/>
1535 <javac srcdir="${src.home}"
1536 destdir="${build.home}"
1537 debug="${compile.debug}"
1538 deprecation="${compile.deprecation}"
1539 optimize="${compile.optimize}">
1540 <classpath>
1541 <path refid="compile.classpath"/>
1542 </classpath>
1543 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1544 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1545 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1546 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1547 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1548 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1549 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1550 </javac>
1551 </else>
1552 </if>
1553 <jar destfile="${build.home}/gsdl3.jar">
1554 <fileset dir="${build.home}">
1555 <include name="org/greenstone/gsdl3/**"/>
1556 <include name="org/flax/**"/>
1557 <exclude name="**/Test.class"/>
1558 </fileset>
1559 <manifest>
1560 <attribute name="Built-By" value="${user.name}" />
1561 </manifest>
1562 </jar>
1563 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1564
1565 <jar destfile="${build.home}/gutil.jar">
1566 <fileset dir="${build.home}">
1567 <include name="org/greenstone/util/**"/>
1568 </fileset>
1569 <manifest>
1570 <attribute name="Built-By" value="${user.name}" />
1571 </manifest>
1572 </jar>
1573 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1574
1575 <!-- copy the localsite server in case we need it -->
1576 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1577
1578 <!-- Greenstone Administrator Interface -->
1579 <jar destfile="${build.home}/GAI.jar">
1580 <fileset dir="${build.home}">
1581 <include name="org/greenstone/admin/**"/>
1582 </fileset>
1583 <manifest>
1584 <attribute name="Built-By" value="${user.name}" />
1585 </manifest>
1586 </jar>
1587 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1588 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1589 <jar destfile="${build.home}/phind.jar">
1590 <fileset dir="${build.home}">
1591 <include name="org/greenstone/applet/phind/**"/>
1592 </fileset>
1593 <manifest>
1594 <attribute name="Built-By" value="${user.name}" />
1595 </manifest>
1596 </jar>
1597 <mkdir dir="${web.applet}"/>
1598 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1599 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1600 <if>
1601 <bool><istrue value="${tomcat.islocal}"/></bool>
1602 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1603 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1604 </if>
1605
1606
1607 <!-- skip anttasks for now
1608 <jar destfile="${build.home}/anttasks.jar">
1609 <fileset dir="${build.home}">
1610 <include name="org/greenstone/anttasks/**"/>
1611 </fileset>
1612 <manifest>
1613 <attribute name="Built-By" value="${user.name}" />
1614 </manifest>
1615 </jar>
1616 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1617 <jar destfile="${build.home}/gsdl3test.jar">
1618 <fileset dir="${build.home}">
1619 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1620 <include name="org/greenstone/testing/**"/>
1621 </fileset>
1622 <manifest>
1623 <attribute name="Built-By" value="${user.name}" />
1624 </manifest>
1625 </jar>
1626 <jar destfile="${build.home}/server.jar">
1627 <fileset dir="${build.home}">
1628 <include name="org/greenstone/server/**"/>
1629 <include name="org/greenstone/util/**"/>
1630 </fileset>
1631 <fileset file="${basedir}/resources/java/server.properties"/>
1632 <manifest>
1633 <attribute name="Built-By" value="${user.name}"/>
1634 </manifest>
1635 </jar>
1636 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1637 </target>
1638
1639 <!-- ================== Packages targets ================================ -->
1640 <!-- these targets refer to the greenstone source packages - these need
1641 updating less often, so are in separate targets to the core -->
1642 <target name="prepare-packages" depends="init"/>
1643
1644 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1645 description="Update only the source packages"/>
1646
1647 <target name="svnupdate-packages" unless="nosvn.mode">
1648 <exec executable="svn">
1649 <arg value="update"/>
1650 <arg value="${src.packages.home}"/>
1651 <arg value="-r"/><arg value="${branch.revision}"/>
1652 </exec>
1653 </target>
1654
1655
1656 <target name="configure-packages" depends="init,configure-javagdbm"
1657 description="Configure only the packages."/>
1658
1659 <target name="configure-javagdbm" if="with.jni">
1660 <echo>
1661 Configuring JavaGDBM
1662 </echo>
1663
1664 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1665 <arg value="--prefix=${basedir}"/>
1666 <arg value="--libdir=${lib.jni}"/>
1667 <arg value="--with-gdbm=${gdbm.home}"/>
1668 </exec>
1669 </target>
1670
1671 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1672
1673 <target name="clean-javagdbm" depends="init">
1674 <exec executable="make" os="${os.unix}"
1675 dir="${javagdbm.home}" failonerror="true">
1676 <arg value="clean"/>
1677 </exec>
1678 </target>
1679
1680 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1681
1682 <target name="distclean-javagdbm" depends="init">
1683 <exec executable="make" os="${os.unix}"
1684 dir="${javagdbm.home}" failonerror="true">
1685 <arg value="distclean"/>
1686 </exec>
1687 </target>
1688
1689 <target name="compile-packages" description="Compile only the source packages">
1690 <!-- javagdbm -->
1691 <antcall target="compile-javagdbm"/>
1692 <!-- Search4j -->
1693 <antcall target="compile-search4j"/>
1694 </target>
1695
1696 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
1697
1698 <!-- unix: -->
1699 <echo>compile javagdbm</echo>
1700 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1701 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1702 <arg value="install"/>
1703 </exec>
1704
1705 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1706 "all" which will then perform both the compile AND link targets in jni/win32.mak
1707 (thereby also generating gdbmjava.dll). Then we run the same command with
1708 the "install" argument to copy the gdbmjava.dll into the correct location. -->
1709 <echo>Windows: compile javagdbm</echo>
1710 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1711 <env key="GSDL3SRCHOME" path="${basedir}"/>
1712 </exec>
1713 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1714 <env key="GSDL3SRCHOME" path="${basedir}"/>
1715 <arg value="install"/>
1716 </exec>
1717
1718 <!-- install the jar file -->
1719 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
1720 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1721 </target>
1722
1723 <target name="compile-search4j">
1724
1725 <!-- windows -->
1726 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1727 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1728 <arg value="/f"/>
1729 <arg value="win32.mak"/>
1730 <arg value='BINDIR="${basedir}\bin"'/>
1731 </exec>
1732 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1733 <arg value="/f"/>
1734 <arg value="win32.mak"/>
1735 <arg value="install"/>
1736 <arg value='BINDIR="${basedir}\bin"'/>
1737 </exec>
1738
1739 <!-- unix -->
1740 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1741 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1742 <arg value="--bindir=${basedir}/bin"/>
1743 <arg value="${static.arg}"/>
1744 </exec>
1745 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1746 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1747 <arg value="install"/>
1748 </exec>
1749
1750 <!-- else warn -->
1751 <else>
1752 <fail>this target does not support the current os</fail>
1753
1754 </else></if></else></if>
1755
1756 </target>
1757
1758 <target name="install-auxiliary-jar-files" depends="init">
1759
1760 <if>
1761 <bool><available file="${mg.home}/mg.jar"/></bool>
1762 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1763 </if>
1764
1765 <if>
1766 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
1767 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1768 </if>
1769
1770 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${web.lib}"/>
1771 </target>
1772
1773 <target name="install-jni-files" depends="init" if="with.jni">
1774 <antcall target="install-jni-files-linux"/>
1775 <antcall target="install-jni-files-windows"/>
1776 <antcall target="install-jni-files-macos"/>
1777 </target>
1778
1779 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1780 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1781 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1782 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1783 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1784 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1785 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1786 </target>
1787 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1788 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1789 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1790 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1791 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1792 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1793 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1794 </target>
1795 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1796 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1797 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1798 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1799 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1800 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1801 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1802 </target>
1803
1804 <!-- ========common-src targets =================================-->
1805 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1806 collection building is not enabled -->
1807
1808 <target name="update-common-src" depends="init" if="collection.building.disabled">
1809 </target>
1810
1811 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1812 <exec executable="svn">
1813 <arg value="update"/>
1814 <arg value="${common.src.home}"/>
1815 <arg value="-r"/><arg value="${branch.revision}"/>
1816 </exec>
1817 </target>
1818
1819 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1820 <antcall target="checkout-common-src"/>
1821 <antcall target="unzip-windows-packages"/>
1822 </target>
1823
1824 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1825 <echo>checking out common-src</echo>
1826 <exec executable="svn">
1827 <arg value="checkout"/>
1828 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
1829 <arg value="common-src"/>
1830 <arg value="-r"/><arg value="${branch.revision}"/>
1831 </exec>
1832 </target>
1833
1834 <target name="configure-common-src" depends="init">
1835 <exec executable="${common.src.home}/configure" os="${os.unix}"
1836 dir="${common.src.home}" failonerror="true">
1837 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1838 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1839 <arg line="${gs2.opt.args}"/>
1840 <arg line="${static.arg}"/>
1841 <arg line="${allargs}"/>
1842 </exec>
1843 </target>
1844
1845 <target name="clean-common-src" depends="init">
1846 <!-- unix: -->
1847 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1848 <arg value="clean"/>
1849 </exec>
1850 <!-- windows: -->
1851 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1852 <arg value="/f"/>
1853 <arg value="win32.mak"/>
1854 <arg value="clean"/>
1855 <arg value="GSDLHOME=${gs2build.home}"/>
1856 </exec>
1857 </target>
1858 <target name="distclean-common-src" depends="init">
1859 <!-- unix: -->
1860 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1861 <arg value="distclean"/>
1862 </exec>
1863 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1864 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1865 <arg value="/f"/>
1866 <arg value="win32.mak"/>
1867 <arg value="clean"/>
1868 <arg value="GSDLHOME=${gs2build.home}"/>
1869 </exec>
1870 </target>
1871 <target name="compile-common-src" depends="init">
1872 <!-- unix: -->
1873 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1874 <arg value="${gs2.compile.target}"/>
1875 </exec>
1876 <!-- windows: -->
1877 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1878 <arg value="/f"/>
1879 <arg value="win32.mak"/>
1880 <arg value="GSDLHOME=${gs2build.home}"/>
1881 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1882 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1883 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1884 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1885 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1886 </exec>
1887 </target>
1888
1889 <!-- ======= collection-building targets ===========================-->
1890
1891 <target name="update-collection-building" if="collection.building.enabled"
1892 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"
1893 description="Update (SVN update, configure, compile etc) only the collection building components"/>
1894
1895 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1896 description="SVN update the collection building components">
1897 </target>
1898
1899 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1900 </target>
1901
1902 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1903 description="Configure the collection building components">
1904 </target>
1905
1906 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1907 description="Clean only the collection building components"
1908 if="collection.building.enabled"/>
1909
1910 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1911 description="Distclean only the collection building components"
1912 if="collection.building.enabled"/>
1913
1914 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1915 description="Compile only the collection building components">
1916 <!-- make install for common-src -->
1917 <!-- unix: -->
1918 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1919 <arg value="${gs2.install.target}"/>
1920 </exec>
1921
1922 <!-- windows: -->
1923 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1924 <arg value="/f"/>
1925 <arg value="win32.mak"/>
1926 <arg value="install"/>
1927 <arg value="GSDLHOME=${gs2build.home}"/>
1928 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1929 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1930 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1931 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1932 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1933 <!--
1934 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1935 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
1936 </exec>
1937
1938 <!-- install gs2build indexers for windows -->
1939 <if>
1940 <bool><istrue value="${current.os.iswindows}"/></bool>
1941 <copy todir="${gs2build.home}/bin/windows">
1942 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1943 <include name="*.*"/>
1944 </fileset>
1945 </copy>
1946 </if>
1947
1948 <!-- LuceneWrapper jar file not installed by default -->
1949 <mkdir dir="${gs2build.home}/bin/java"/>
1950 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${gs2build.home}/bin/java"/>
1951
1952 </target>
1953
1954 <!-- ============== gli targets ================================= -->
1955 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1956
1957 <exec executable="svn">
1958 <arg value="update"/>
1959 <arg value="${gli.home}"/>
1960 <arg value="-r"/><arg value="${branch.revision}"/>
1961 </exec>
1962
1963 <exec executable="svn" dir="web/WEB-INF/cgi">
1964 <arg value="export"/>
1965 <arg value="-r"/><arg value="${branch.revision}"/>
1966 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
1967 </exec>
1968 <exec executable="svn" dir="web/WEB-INF/cgi">
1969 <arg value="export"/>
1970 <arg value="-r"/><arg value="${branch.revision}"/>
1971 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
1972 </exec>
1973
1974 </target>
1975
1976 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1977 <!-- checkout -->
1978 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
1979
1980 <exec executable="svn">
1981 <arg value="checkout"/>
1982 <arg value="${svn.root}/main/${branch.path}/gli"/>
1983 <arg value="-r"/><arg value="${branch.revision}"/>
1984 </exec>
1985
1986 <exec executable="svn" dir="web/WEB-INF/cgi">
1987 <arg value="export"/>
1988 <arg value="-r"/><arg value="${branch.revision}"/>
1989 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
1990 </exec>
1991 <exec executable="svn" dir="web/WEB-INF/cgi">
1992 <arg value="export"/>
1993 <arg value="-r"/><arg value="${branch.revision}"/>
1994 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
1995 </exec>
1996
1997 </if>
1998 </target>
1999
2000 <target name="clean-gli" depends="init" if="collection.building.enabled">
2001 <!-- gli -->
2002 <property name="gli.home" value="${basedir}/gli"/>
2003 <!-- linux -->
2004 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
2005 resolveExecutable="true" failonerror="true"/>
2006 <!-- windows -->
2007 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
2008 resolveExecutable="true" failonerror="true"/>
2009 </target>
2010
2011 <target name="compile-gli" depends="init" if="collection.building.enabled">
2012 <if><bool><isset property="with.gli.and.gems"/></bool>
2013 <!-- gli -->
2014 <property name="gli.home" value="${basedir}/gli"/>
2015
2016 <!-- linux -->
2017 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2018 <!--remote gli-->
2019 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
2020 resolveExecutable="true" failonerror="true"/>
2021 <!-- windows -->
2022 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2023 <!--remote gli-->
2024 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
2025 resolveExecutable="true" failonerror="true"/>
2026 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
2027 </if>
2028 </target>
2029
2030 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
2031 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
2032 <env key="gsdl3path" path="${basedir}"/>
2033 <env key="gsdlpath" path="${gs2build.home}"/>
2034 </exec>
2035 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
2036 <env key="gsdl3path" path="${basedir}"/>
2037 <env key="gsdlpath" path="${gs2build.home}"/>
2038 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
2039 </exec>
2040 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
2041 <env key="GSDL3PATH" path="${basedir}"/>
2042 <env key="GSDLPATH" path="${gs2build.home}"/>
2043 </exec>
2044 <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.
2045 </echo>
2046 </target>
2047
2048 <!-- ================ gs2build targets =========================== -->
2049
2050 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
2051 <echo>svn updating gs2build</echo>
2052 <exec executable="svn">
2053 <arg value="update"/>
2054 <arg value="${gs2build.home}"/>
2055 <arg value="-r"/><arg value="${branch.revision}"/>
2056 </exec>
2057 </target>
2058
2059 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
2060 <antcall target="checkout-gs2build"/>
2061 <antcall target="unzip-windows-packages"/>
2062 <antcall target="checkout-winbin"/>
2063 <antcall target="get-windows-binaries"/>
2064 <antcall target="delete-winbin"/>
2065 </target>
2066
2067 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
2068 <echo>checking out gs2build</echo>
2069 <exec executable="svn">
2070 <arg value="checkout"/>
2071 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
2072 <arg value="-r"/><arg value="${branch.revision}"/>
2073 </exec>
2074
2075
2076 </target>
2077
2078 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
2079 unless="nosvn.mode">
2080
2081 <exec executable="svn">
2082 <arg value="checkout"/>
2083 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
2084 <arg value="-r"/><arg value="${branch.revision}"/>
2085 <arg value="winbin"/>
2086 </exec>
2087
2088 </target>
2089
2090 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
2091 <exec executable="svn">
2092 <arg value="update"/>
2093 <arg value="winbin"/>
2094 <arg value="-r"/><arg value="${branch.revision}"/>
2095 </exec>
2096
2097 </target>
2098
2099 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
2100 <move todir="${gs2build.home}/bin/windows" failonerror="false">
2101 <fileset dir="${basedir}/winbin/bin"/>
2102 </move>
2103 </target>
2104
2105 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
2106 <delete dir="${basedir}/winbin"/>
2107 </target>
2108
2109 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
2110 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
2111 dest="${common.src.home}/packages/windows/crypt"/>
2112 <untar compression="gzip"
2113 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
2114 dest="${common.src.home}/packages/sqlite"/>
2115 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
2116 dest="${common.src.home}/indexers/packages/windows/iconv"/>
2117 </target>
2118
2119 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
2120 <!-- we want a windows path in the setup.bat file -->
2121 <pathconvert targetos="windows" property="gs2build.home.windows">
2122 <path path="${gs2build.home}"/>
2123 </pathconvert>
2124 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
2125 <filterset>
2126 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
2127 </filterset>
2128 </move>
2129 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
2130 </target>
2131
2132
2133 <target name="clean-build-src" depends="init" if="collection.building.enabled">
2134 <!-- unix: -->
2135 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
2136 <arg value="clean"/>
2137 </exec>
2138 <!-- windows: -->
2139 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2140 <arg value="/f"/>
2141 <arg value="win32.mak"/>
2142 <arg value="clean"/>
2143 <arg value="GSDLHOME=${gs2build.home}"/>
2144 </exec>
2145 </target>
2146
2147
2148 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
2149 <!-- unix: -->
2150 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
2151 <arg value="distclean"/>
2152 </exec>
2153 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
2154 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2155 <arg value="/f"/>
2156 <arg value="win32.mak"/>
2157 <arg value="clean"/>
2158 <arg value="GSDLHOME=${gs2build.home}"/>
2159 </exec>
2160 </target>
2161
2162 <target name="configure-build-src" depends="init" if="collection.building.enabled"
2163 description="Configure the build-src component">
2164 <exec executable="${build.src.home}/configure" os="${os.unix}"
2165 dir="${build.src.home}" failonerror="true">
2166 <arg value="--prefix=${gs2build.home}"/>
2167 <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
2168 </exec>
2169 </target>
2170
2171 <!-- common-src is done separately and needs to be compiled first -->
2172 <target name="compile-build-src" depends="init" if="collection.building.enabled">
2173
2174 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2175 <arg line="${ldlpath.arg}"/>
2176 </exec>
2177
2178 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2179 <arg value="install"/>
2180 </exec>
2181
2182 <!-- run the setup script -->
2183 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
2184 <!--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-->
2185 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2186 <arg value="/f"/>
2187 <arg value="win32.mak"/>
2188 <arg value="GSDLHOME=${gs2build.home}"/>
2189 </exec>
2190 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2191 <arg value="/f"/>
2192 <arg value="win32.mak"/>
2193 <arg value="install"/>
2194 <arg value="GSDLHOME=${gs2build.home}"/>
2195 </exec>
2196 </target>
2197
2198
2199 <!-- ======================== TESTING Targets ========================= -->
2200
2201 <target name="test" description="Run the (incomplete) JUnit test suite "
2202 depends="init">
2203 <mkdir dir="${basedir}/test"/>
2204 <junit printsummary="withOutAndErr"
2205 errorproperty="test.failed"
2206 failureproperty="test.failed"
2207 fork="${junit.fork}">
2208 <formatter type="plain"/>
2209 <classpath>
2210 <pathelement location="${build.home}/gsdl3test.jar"/>
2211 <path refid="compile.classpath"/>
2212 </classpath>
2213 <test name="${testcase}" if="testcase"/>
2214 <batchtest todir="${basedir}/test" unless="testcase">
2215 <fileset dir="${build.home}" includes="**/*Test.class" />
2216 </batchtest>
2217 </junit>
2218 <echo>
2219 *********************************************
2220 Test output can be found in directory 'test'
2221 *********************************************
2222 </echo>
2223 </target>
2224
2225 <!-- ======================== FLAX Targets ========================= -->
2226 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2227 <echo>checking out flax ...</echo>
2228 <mkdir dir="${basedir}/src/java/org/flax"/>
2229 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
2230 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
2231 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2232 <mkdir dir="${web.home}/interfaces/flax"/>
2233 <mkdir dir="${web.home}/sites/flax"/>
2234 <mkdir dir="${basedir}/flax-resources"/>
2235 <mkdir dir="${basedir}/flax-lib"/>
2236 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2237 <arg value="src/java/org/flax"/></exec>
2238 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2239 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2240 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2241 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2242 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
2243 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2244 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2245 <arg value="${web.home}/interfaces/flax"/></exec>
2246 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2247 <arg value="${web.home}/sites/flax"/></exec>
2248 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2249 <arg value="flax-resources"/></exec>
2250 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2251 <arg value="flax-lib"/></exec>
2252 <antcall target="flax-copy-del-files" />
2253 </target>
2254
2255 <target name="flax-copy-del-files" description="copy some flax files into the appropriate greenstone3 directories and delete some unwanted greenstone stuff">
2256 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2257 <copy todir="${web.home}/WEB-INF/lib">
2258 <fileset dir="${basedir}/flax-lib">
2259 <include name="*.jar"/>
2260 </fileset>
2261 </copy>
2262 <!--<delete dir="${web.home}/sites/gateway"/>
2263 <delete dir="${web.home}/sites/localsite"/>-->
2264 </target>
2265
2266 <target name="update-flax" description="update flax from repository">
2267 <echo>updating flax ...</echo>
2268 <exec executable="svn"><arg value="update"/>
2269 <arg value="src/java/org/flax"/></exec>
2270 <exec executable="svn"><arg value="update"/>
2271 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2272 <exec executable="svn"><arg value="update"/>
2273 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2274 <exec executable="svn"><arg value="update"/>
2275 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2276 <exec executable="svn"><arg value="update"/>
2277 <arg value="${web.home}/interfaces/flax"/></exec>
2278 <exec executable="svn"><arg value="update"/>
2279 <arg value="${web.home}/web/sites/flax"/></exec>
2280 <exec executable="svn"><arg value="update"/>
2281 <arg value="flax-resources"/></exec>
2282 <exec executable="svn"><arg value="update"/>
2283 <arg value="flax-lib"/></exec>
2284 <antcall target="compile-core" />
2285 </target>
2286
2287 <!-- ======================== End of FLAX Targets ========================= -->
2288
2289
2290 <target name="compile-javadocs">
2291 <javadoc packagenames="org.greenstone.*"
2292 sourcepath="src/java"
2293 defaultexcludes="yes"
2294 destdir="docs/javadoc"
2295 author="true"
2296 version="true"
2297 use="true"
2298 windowtitle="Greenstone3 API">
2299 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2300 </javadoc>
2301 </target>
2302
2303<!-- ========== Some distribution targets ======================== -->
2304 <target name="remove-source">
2305 <if><bool><isset property="with.gli.and.gems"/></bool>
2306 <delete includeEmptyDirs="true">
2307 <fileset dir="." defaultexcludes="false">
2308 <patternset refid="greenstone3.source.component"/>
2309 </fileset>
2310 </delete>
2311
2312 <else>
2313 <delete includeEmptyDirs="true">
2314 <fileset dir="." defaultexcludes="false">
2315 <patternset refid="greenstone3.source.no.gli.component"/>
2316 </fileset>
2317 </delete>
2318 </else>
2319 </if>
2320 </target>
2321
2322 <target name="dist-tidy"
2323 description="'tidies-up' a greenstone3 installation for distribution.">
2324
2325 <!-- delete unneeded things -->
2326 <delete dir="${packages.home}/axis"/>
2327 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2328 <delete file="README-SVN.txt"/>
2329 <delete file="build.properties.in"/>
2330
2331 <!-- delete source files -->
2332 <antcall target="remove-source"/>
2333
2334 <!-- create empty directories -->
2335 <mkdir dir="${web.home}/applet"/>
2336 <mkdir dir="${web.home}/logs"/>
2337 <mkdir dir="${web.home}/logs/tmp"/>
2338
2339 <!-- os specific tidy-ups -->
2340 <!-- linux, mac -->
2341 <if><bool><istrue value="${current.os.isunix}"/></bool>
2342 <delete><fileset dir="." includes="*.bat"/></delete>
2343 <if><bool><isset property="with.gli.and.gems"/></bool>
2344 <delete><fileset dir="gli" includes="*.bat"/></delete>
2345 </if>
2346 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2347 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
2348 <delete file="${basedir}/gs2build/win32cfg.h"/>
2349 <delete file="${basedir}/gs2build/win32.mak"/>
2350 <delete dir="${basedir}/winutil"/>
2351 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2352
2353 <!-- windows -->
2354 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2355 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
2356 <if><bool><isset property="with.gli.and.gems"/></bool>
2357 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2358 </if>
2359 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2360 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2361 </if></else></if>
2362
2363 </target>
2364
2365 <!-- fix up executable permissions for binary release -->
2366 <target name="fix-execute-permissions">
2367 <echo>Setting binaries to executable</echo>
2368 <chmod perm="775">
2369 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2370 </chmod>
2371 </target>
2372
2373 <!-- fix up executable permissions for source code release -->
2374 <target name="fix-execute-permissions-source">
2375 <chmod perm="775">
2376 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2377 </chmod>
2378 </target>
2379
2380
2381 <!-- ============= tweaks for making compilation static ========== -->
2382 <target name="tweak-makefiles" depends="init" if="compile.static">
2383 <antcall target="rtftohtml-add-static" />
2384 </target>
2385
2386 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2387 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2388 </target>
2389
2390</project>
2391
Note: See TracBrowser for help on using the repository browser.