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

Last change on this file since 25549 was 25549, checked in by ak19, 12 years ago

Added target to print out default library servlet URL so that activate.pl can use it.

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