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

Last change on this file since 26888 was 26806, checked in by davidb, 11 years ago

strip now added to the list of cross-compile args set up

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