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

Last change on this file since 26002 was 26002, checked in by ak19, 8 years ago

ant target clean-logs now also clears server.log.

File size: 99.4 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
[25640]591 <stringutil string="${full.perl.path}" property="partial.perl.path">
592 <replace regex="\/[^\/]*$" replacement="/" />
[23854]593 </stringutil>
[25640]594 <stringutil string="${partial.perl.path}" property="perl.path">
595 <replace regex="\\[^\\]*$" replacement="\\" />
596 </stringutil>
[23896]597 <if><bool><istrue value="${current.os.isunix}"/></bool>
598
599 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
600 <echo>
[23854]601 Non-standard location of Perl found: ${full.perl.path}
602 Set the environment variable PERLPATH or the perl.path property in
603 build.properties to explicitly control the version of Perl used.
[23896]604 </echo>
605 </if>
[23854]606 </if>
607 </else>
608 </if>
609 </if>
610
611 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
612 <if><bool><isset property="perl.path"/></bool>
613 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
614 <else>
615 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
616 </else>
617 </if>
[23857]618
619 <!-- gs2build not available, perl.path -->
620 <else>
621 <property name="perl.path" value=""/>
622 </else>
623 </if>
[23854]624 </target>
625
[25549]626 <target name="get-default-servlet-url">
627 <echo>http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}</echo>
628 </target>
629
[23854]630 <target name="start" depends="init,configure-web,start-tomcat"
[15124]631 description="Startup the Tomcat server." >
[15799]632 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
[16936]633 <echo>Tomcat: ${catalina.home}</echo>
634 <echo>Java : ${java.home}</echo>
[23849]635 <if><bool><available file="${build.src.home}"/></bool>
636 <echo>Perl : ${full.perl.path}</echo>
637 </if>
[23936]638 <if><bool><isset property="install.flax"/></bool>
639 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/flax"/>
640 <else>
641 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/"/>
642 </else>
643 </if>
644 <echo>URL : ${url}</echo>
[15799]645 <!-- assuming that index.html is not needed here -->
[15124]646 </target>
647
648 <target name="stop" depends="init,stop-tomcat"
649 description="Shutdown the Tomcat server."/>
650
651 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
652
653
[15799]654 <!-- =========== Help targets =================================== -->
[15124]655
656 <property name="install-command" value="ant [options] prepare install"/>
657
658 <target name="usage" description="Print a help message">
659 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
660 <echo message=" Execute 'ant -help' for Ant help."/>
[23849]661 <echo>
662 To install Greenstone3, run '${install-command}'.
663 There are properties defined in build.properties. The install
664 process will ask you if these properties are set correctly.
665 To avoid this prompt, use the '-Dproperties.accepted=yes'
666 option.
667 To log the output, use the '-logfile build.log' option.
668 The README.txt file has more information about the ant targets
669 and install process.
[15124]670 </echo>
671 </target>
672
673 <target name="help" depends="usage" description="Print a help message"/>
674
675 <target name="debug" depends="init" description="Display all the currently used properties">
676 <echoproperties/>
677 </target>
678
[15799]679 <!-- ====== initialization and setup targets ================== -->
[15124]680
681 <target name="accept-properties" unless="properties.accepted">
682 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
[15799]683 tomcat.server=${tomcat.server}
684 tomcat.port=${tomcat.port}
685 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
686 proxy.host=${proxy.host}
687 proxy.port=${proxy.port}
[19878]688 disable.collection.building=${disable.collection.building}
[19910]689 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
[15124]690 </input>
691 <condition property="do.abort">
692 <equals arg1="n" arg2="${properties.ok}"/>
693 </condition>
694 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
695 </target>
[20085]696
[15124]697 <!-- this sets up some initial properties -->
698 <target name="init">
699
[20085]700 <!-- has the gs3-setup script been run?? -->
701 <condition property="gs3-setup-not-done">
702 <not>
703 <isset property="env.GSDL3HOME"/>
704 </not>
705 </condition>
706
[20092]707 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
[20085]708
[15124]709 <condition property="java.too.old">
710 <or>
[16936]711 <equals arg1="1.1" arg2="${ant.java.version}"/>
712 <equals arg1="1.2" arg2="${ant.java.version}"/>
713 <equals arg1="1.3" arg2="${ant.java.version}"/>
[15124]714 </or>
715 </condition>
[20208]716 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
[15124]717
718 <available file="${basedir}/gli" property="gli.present"/>
[19878]719 <available file="${basedir}/common-src" property="common.src.present"/>
[15124]720 <available file="${basedir}/gs2build" property="gs2build.present"/>
721
722 <condition property="tomcat.islocal">
723 <or>
[16936]724 <not><isset property="tomcat.installed.path"/></not>
725 <equals arg1="" arg2="${tomcat.installed.path}"/>
[15124]726 </or>
727 </condition>
728
[15799]729 <echo>tomcat.port = ${tomcat.port}</echo>
[15124]730
731 <condition property="proxy.present">
732 <and>
[16936]733 <isset property="proxy.host"/>
734 <not><equals arg1="" arg2="${proxy.host}"/></not>
[15124]735 </and>
736 </condition>
737
[20235]738 <!--
[20290]739 the next block checks if the bundled tomcat is present in the 'packages' directory,
[25131]740 and checks for the lethal combination of tomcat 7 and java 1.4. Test for
[20290]741 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
742 download, as there is no other surefire way to check tomcat version under java 1.4
[20235]743 -->
744 <condition property="packages.tomcat.ispresent" value="true" else="false">
745 <available file="packages/tomcat"/>
746 </condition>
[25131]747 <condition property="packages.tomcat.istomcat7" value="true" else="false">
748 <available file="packages/tomcat/tomcat7.txt"/>
[20290]749 </condition>
[20235]750 <if>
751 <bool>
[20290]752 <and>
753 <istrue value="${packages.tomcat.ispresent}"/>
[25131]754 <istrue value="${packages.tomcat.istomcat7}"/>
[20290]755 <equals arg1="1.4" arg2="${ant.java.version}"/>
756 </and>
[20235]757 </bool>
[20290]758 <fail>Your Java (version 1.4) is too old to work with the bundled Apache Tomcat (version 6). Please upgrade to Java version 1.5 or greater. Alternatively, you may remove the bundled Apache Tomcat from the 'packages' folder and then run 'ant prepare-tomcat'.</fail>
[20235]759 </if>
760
[15124]761 </target>
762
763 <target name="setup-proxy" depends="init" if="proxy.present">
764 <condition property="ask.user">
765 <or>
[16936]766 <equals arg1="" arg2="${proxy.user}"/>
767 <equals arg1="" arg2="${proxy.password}"/>
[15124]768 </or>
769 </condition>
[19878]770
[15124]771 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
772 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
773 </target>
774
[15799]775 <!-- ========== Web app Targets ================================ -->
776
[20089]777 <target name="prepare-web" depends="init">
[15124]778 <mkdir dir="${web.home}/applet"/>
779 <mkdir dir="${web.home}/logs"/>
[25446]780 <mkdir dir="${web.home}/logs/tmp"/>
[15124]781 </target>
782
[24607]783 <!-- if we are using java 1.5+, we need the xalan.jar file in web/WEB-INF/lib, but if we are using java 1.4, we can't have it there.
784 The test for whether we need it assumes we won't be trying to compile GS3 against Java versions less than 1.4. -->
[15124]785 <target name="configure-java-version" depends="init"
[15139]786 description="Activates or deactivates some jar libraries as needed depending on your java version">
[15136]787
[15799]788 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
[15124]789 <condition property="need.xalan.jar">
[15799]790 <or>
[24607]791 <not><equals arg1="1.4" arg2="${ant.java.version}"/></not>
[15799]792 </or>
793 </condition>
[15136]794
[15799]795 <!-- if they have xalan.jar but dont need it -->
796 <if>
797 <bool>
[16936]798 <and>
799 <isset property="have.xalan.jar"/>
800 <not><isset property="need.xalan.jar"/></not>
801 </and>
[15799]802 </bool>
803 <antcall target="deactivate-xalan-jar"/>
804 </if>
[15136]805
[15799]806 <!-- if they need xalan.jar but dont have it -->
807 <if>
808 <bool>
[16936]809 <and>
810 <not><isset property="have.xalan.jar"/></not>
811 <isset property="need.xalan.jar"/>
812 </and>
[15799]813 </bool>
814 <antcall target="activate-xalan-jar"/>
815 </if>
[15136]816
[15124]817 </target>
818
[15139]819 <target name="activate-xalan-jar">
[15799]820 <echo>activating xalan.jar</echo>
[15124]821 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
[20085]822 <if>
823 <bool>
824 <and>
825 <isset property="current.os.ismac"/>
826 <available file="${catalina.home}/common/endorsed" type="dir"/>
827 </and>
828 </bool>
829 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
[15799]830 </if>
[15124]831 </target>
[15035]832
[15139]833 <target name="deactivate-xalan-jar">
[15799]834 <echo>deactivating xalan.jar</echo>
[15124]835 <delete file="${web.lib}/xalan.jar"/>
[20089]836 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
[15124]837 </target>
838
[15837]839
[25491]840 <target name="prepare-collections" depends="init"
841 description="Unpack all the collections from their svn zipped versions">
[16936]842 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
[17008]843 <property name="index.zip" value="index.zip"/>
[15799]844
[16936]845 <echo message="installing collections..."/>
846 <antcall target="gs2mgdemo-install"/>
847 <antcall target="gs2mgppdemo-install"/>
848 <antcall target="gberg-install"/>
[25214]849 <antcall target="lucene-jdbm-demo-install"/>
[16936]850 </target>
[15837]851
[16936]852 <target name="gs2mgdemo-prepare" if="collect.dir">
853 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
[15799]854
[16936]855 <condition property="gs2mgdemo.present">
856 <and>
[15837]857 <available file="${gs2mgdemo.dir}/${index.zip}"/>
[16936]858 </and>
859 </condition>
860 </target>
[15799]861
[17008]862 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
863 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
[16936]864 <echo>collection gs2mgdemo installed</echo>
865 </target>
[15799]866
[16936]867 <target name="gs2mgppdemo-prepare" if="collect.dir">
868 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
[15837]869
[16936]870 <condition property="gs2mgppdemo.present">
871 <and>
[15837]872 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
[16936]873 </and>
874 </condition>
875 </target>
[15799]876
[16936]877 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
[17008]878 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
[16936]879 <echo>collection gs2mgppdemo installed</echo>
880 </target>
[15799]881
[16936]882 <target name="gberg-prepare" if="collect.dir">
883 <property name="gberg.dir" value="${collect.dir}/gberg"/>
[17008]884 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
[16936]885 </target>
[15799]886
[16936]887 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
[19878]888 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
[16936]889 <echo>collection gberg installed</echo>
890 </target>
[15799]891
[25214]892 <target name="lucene-jdbm-demo-prepare" if="collect.dir">
893 <property name="lucene-jdbm-demo.dir" value="${collect.dir}/lucene-jdbm-demo"/>
[25491]894 <available file="${lucene-jdbm-demo.dir}/${index.zip}" property="lucene-jdbm-demo.present"/>
[25214]895 </target>
896
897 <target name="lucene-jdbm-demo-install" if="lucene-jdbm-demo.present" depends="lucene-jdbm-demo-prepare">
[25491]898 <unzip dest="${lucene-jdbm-demo.dir}" src="${lucene-jdbm-demo.dir}/${index.zip}"/>
[25214]899 <echo>collection lucene-jdbm-demo installed</echo>
900 </target>
901
[23854]902 <target name="configure-web" depends="init,perl-for-building"
[15124]903 description="Configure only the web app config files">
904 <!-- we want a unix path in the global.properties file -->
905 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
906 <path path="${web.home}"/>
907 </pathconvert>
[24868]908 <stringutil string="${perl.path}" property="escaped.perl.path">
909 <replace regex="\\" replacement="\\\\" />
910 </stringutil>
911
[25830]912 <filter token="gsdlhome" value="${gs2build.home}"/>
913 <filter token="gsdl3srchome" value="${basedir}"/>
[15124]914 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
915 <filter token="gsdl3version" value="${app.version}"/>
916 <filter token="tomcat.server" value="${tomcat.server}"/>
917 <filter token="tomcat.port" value="${tomcat.port}"/>
[24868]918 <filter token="perlpath" value="${escaped.perl.path}"/>
[25570]919 <filter token="disable.collection.building" value="${disable.collection.building}"/>
[25830]920 <copy file="${basedir}/web/WEB-INF/cgi/gsdl3site.cfg.in" tofile="${basedir}/web/WEB-INF/cgi/gsdl3site.cfg" filtering="true" overwrite="true"/>
[15124]921 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
922 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
923 <chmod file="${web.classes}/global.properties" perm="600"/>
924 <chmod file="${web.classes}/log4j.properties" perm="600"/>
925 </target>
926
927 <target name="compile-web" depends="init">
928 <javac srcdir="${web.classes}"
929 destdir="${web.classes}"
930 debug="${compile.debug}"
931 deprecation="${compile.deprecation}"
932 optimize="${compile.optimize}">
[16936]933 <classpath><path refid="compile.classpath"/></classpath>
[15124]934 </javac>
935 </target>
936
[20209]937 <target name="compile-classpath-jars" depends="init">
938 <if><bool><available file="admin/cp.mf"/></bool>
939 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
940 </if>
941 <if><bool><available file="${lib.java}/cp.mf"/></bool>
942 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
943 </if>
944 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
945 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
946 </if>
947 <if><bool><available file="${web.lib}/cp.mf"/></bool>
948 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
949 </if>
950 <jar destfile="cp.jar">
951 <manifest>
[20211]952 <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]953 </manifest>
954 </jar>
955 </target>
956
957 <target name="clean-classpath-jars" depends="init">
958 <delete file="admin/cp.jar"/>
959 <delete file="${lib.java}/cp.jar"/>
960 <delete file="${lib.jni}/cp.jar"/>
961 <delete file="${web.lib}/cp.jar"/>
962 <delete file="cp.jar"/>
963 </target>
964
965
[15799]966 <target name="svnupdate-web" unless="nosvn.mode">
[20930]967 <exec executable="svn">
968 <arg value="update"/>
969 <arg value="${web.home}"/>
970 <arg value="-r"/><arg value="${branch.revision}"/>
971 </exec>
[15799]972 </target>
[15124]973
974 <target name="update-web" depends="init,svnupdate-web,configure-web"
975 description="update only the web stuff (config files)"/>
976
[15799]977 <!-- ======================= Tomcat Targets ========================== -->
[15124]978
979 <!-- this target downloads and installs Tomcat -->
[25131]980 <!-- we download tomcat (version 7 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
[20089]981 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
[25131]982 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">
983 <if>
[16951]984 <bool>
985 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
986 </bool>
987
988 <!-- check that packages dir is there -->
989 <mkdir dir="${packages.home}"/>
990 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
991 dest="${packages.home}/${tomcat.version}.zip"
992 usetimestamp="true"/>
993 <unzip src="${packages.home}/${tomcat.version}.zip"
994 dest="${packages.home}"/>
[20085]995
996 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
997 we would need to have the tomcat compat package to work with Java 1.4-->
998 <if>
999 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
1000 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
1001 dest="${packages.home}/${tomcat.version}-compat.zip"
1002 usetimestamp="true"/>
1003 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
1004 dest="${packages.home}"/>
1005 </if>
1006
[16951]1007 <!-- delete any existing tomcat -->
1008 <delete dir="${packages.home}/tomcat"/>
1009 <move todir="${packages.home}/tomcat">
1010 <fileset dir="${packages.home}/${tomcat.version}"/>
1011 </move>
[25133]1012 <!--
[16951]1013 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
1014 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
1015 overwrite="true"/>
1016 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
1017 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
1018 overwrite="true"/>
[25133]1019 -->
[16951]1020 <!-- make sure we have execute permission for the .sh files -->
1021 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
1022 includes="*.sh"/>
1023
1024 <echo file="${packages.home}/tomcat/.flagfile">
1025 the timestamp of this file is the time that tomcat was extracted from the zip files.
1026 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
1027 </echo>
1028
[20089]1029 <!-- this is not strictly a prepare tomcat thing, but if one changes
1030 Java, then they need to change tomcat as well, so might as well call
1031 it here -->
1032 <antcall target="configure-java-version"/>
[16951]1033 <else>
1034 <echo>Tomcat has been prepared, will not prepare</echo>
1035 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
1036 </else>
1037
1038 </if>
1039
[15124]1040 </target>
1041
1042 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1043
[25570]1044 <target name="configure-tomcat-local" depends="init,perl-for-building" if="tomcat.islocal">
[15124]1045 <!-- re-setup the server.xml file -->
[20079]1046 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
1047 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
[15124]1048 <filterset>
[16936]1049 <filter token="port" value="${tomcat.port}"/>
1050 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
[15124]1051 </filterset>
1052 </copy>
1053 <!-- set up the greenstone3 context -->
1054 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
1055 <filterset>
[16936]1056 <filter token="gsdl3webhome" value="${web.home}"/>
[22320]1057 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
[15124]1058 </filterset>
1059 </copy>
[25570]1060
1061 <!-- set up the greenstone3 web.xml file -->
1062 <copy file="${basedir}/resources/tomcat/web.xml" tofile="${packages.home}/tomcat/conf/web.xml" overwrite="true">
1063 <filterset>
1064 <filter token="perlpath" value="${perl.path}"/>
1065 </filterset>
1066 </copy>
[15124]1067 </target>
1068
1069 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
1070 <!-- re-setup the server.xml file -->
1071 <!-- need to edit the config file, or do we get the user to do this???-->
1072 </target>
[22551]1073
[23854]1074
1075
[22551]1076<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
[20089]1077 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
[15799]1078 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
[15124]1079 <property name="tomcat.path" refid="local.tomcat.path"/>
1080 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
[25095]1081
1082 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
1083 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
1084
[21351]1085 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]1086 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1087 <env key="GSDL3HOME" value="${basedir}"/>
1088 <env key="PATH" path="${tomcat.path}"/>
1089 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1090 <env key="CATALINA_HOME" value="${catalina.home}"/>
1091 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1092 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
[22184]1093 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
[15124]1094 <env key="WNHOME" path="${wn.home}"/>
1095 </exec>
[25616]1096 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
[15124]1097 <env key="GSDLOS" value="windows"/>
1098 <env key="GSDL3HOME" value="${basedir}"/>
1099 <env key="Path" path="${tomcat.path}"/>
1100 <env key="PATH" path="${tomcat.path}"/>
1101 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
[16628]1102 <env key="CATALINA_HOME" value="${catalina.home}"/>
[15124]1103 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1104 </exec>
1105 <!-- wait for the server to startup in case other targets need it running -->
1106 <waitfor maxwait="5" maxwaitunit="second">
1107 <and>
[16936]1108 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1109 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
[15124]1110 </and>
1111 </waitfor>
1112 </target>
1113
[22551]1114 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
1115 <target name="reconfigure" description="Reconfigure the message router">
1116 <waitfor maxwait="5" maxwaitunit="second">
1117 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
1118 </waitfor>
1119 </target>
1120
1121 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
1122 <target name="reconfigure-collection" description="Reconfigure the collection">
1123 <waitfor maxwait="5" maxwaitunit="second">
1124 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
1125 </waitfor>
1126 </target>
1127
[15124]1128 <!-- windows: do we want to launch a webrowser?? -->
[25418]1129 <!-- shouldn't this test whether anything is running first?
1130 It's safer to always attempt to stop tomcat: that way we won't be dependent on the right time
1131 to check whether the server is stopped or still running before attempting to start again.
1132 This target, which was recently called force-stop-tomcat for a while but is back to being
1133 called stop-tomcat, now hides the Java exception output that appears whenever tomcat is already
1134 stopped as happens when stop-tomcat is called consecutively. -->
[25420]1135 <target name="force-stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
[21351]1136 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
[15124]1137 <env key="CATALINA_HOME" value="${catalina.home}"/>
[25418]1138 <arg line=">/dev/null 2>&amp;1"/>
[15124]1139 </exec>
[21351]1140 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
[16628]1141 <env key="CATALINA_HOME" value="${catalina.home}"/>
[25418]1142 <arg line=">nul 2>&amp;1"/>
[25443]1143 </exec>
[15124]1144 </target>
1145
[25418]1146 <!-- Can also try the "socket" condition in place of the "http" condition
1147 And also use a <waitfor> in place of <condition>, such as:
1148 <waitfor maxwait="5" maxwaitunit="second" timeoutproperty="tomcat.isstopped"><http url="..."/></waitfor>
[25420]1149 The http URL resolves to host:port/greenstone3
1150 Condition uses <http/> rather than <socket/> for testing, since if the server was stopped, the socket
1151 might still be in use for some moments. We test the URL with the http condition since it's likelier to
1152 fail sooner if the server has indeed been stopped. -->
[25418]1153 <target name="check-tomcat-running">
1154 <condition property="tomcat.isrunning">
1155 <http url="http://${tomcat.server}:${tomcat.port}${app.path}"/>
1156 </condition>
[25321]1157 </target>
1158
[25443]1159 <!-- stop-tomcat checks if the tomcat server is already running. If it appears to be running
1160 (regardless of whether tomcat was just starting to shut down), this target calls force-stop-tomcat
1161 to issue the shutdown command to tomcat. Then it waits for at most 15 seconds for the server to
1162 actually stop by checking the socket at which tomcat listens every second, printing a warning
1163 at the end of the max wait time of 15 seconds if tomcat was still running. -->
1164 <target name="stop-tomcat" description="Shutdown only Tomcat if running" depends="check-tomcat-running" if="tomcat.isrunning">
[25321]1165 <antcall target="force-stop-tomcat"/>
[25443]1166
1167 <property name="wait.numchecks" value="15"/>
1168 <echo>Waiting for the server to shutdown... (${wait.numchecks} seconds max)</echo>
1169 <waitfor maxwait="${wait.numchecks}" maxwaitunit="second" checkevery="1" checkeveryunit="second" timeoutproperty="tomcat.timedout">
[25444]1170 <not><socket server="${tomcat.server}" port="${tomcat.port}"/></not>
[25443]1171 </waitfor>
1172
1173 <if>
1174 <bool>
1175 <isset property="${tomcat.timedout}"/>
1176 </bool>
1177 <property name="tomcat.isrunning" value="true"/>
1178 <echo>WARNING: Checked the socket ${wait.numchecks} times, but port ${tomcat.port} is still busy.</echo>
1179 <else>
1180 <echo>Tomcat is stopped.</echo>
1181 <property name="tomcat.isrunning" value="false"/>
1182 </else>
1183 </if>
[25420]1184 </target>
[25321]1185
[15124]1186 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
1187
1188 <target name="setup-catalina-ant-tasks">
1189 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
1190 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
1191 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1192 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
1193 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1194 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
1195 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1196 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
1197 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1198 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
1199 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1200 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
1201 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1202 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
1203 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1204 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
1205 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1206 </target>
1207
[25449]1208 <!-- http://blog.andrewbeacock.com/2007/11/how-to-truncate-log-file-using-ubuntu.html
1209 Doing "cat </dev/null > packages/tomcat/logs/catalina.out" doesn't work as an ant target.
1210 It seems to have a problem with cat or </dev/null, with or without the < sign. -->
1211 <target name="clean-logs" description="Empties catalina.out, greenstone.log and contents of web/logs/tmp">
[26002]1212 <echo>Truncating catalina.out, greenstone.log and server.log, and emptying ${web.home}/logs/tmp</echo>
[25449]1213 <exec executable="truncate" os="${os.unix}" dir="${catalina.home}/logs" spawn="false">
1214 <arg value="-s0"/>
1215 <arg value="catalina.out"/>
1216 </exec>
1217 <exec executable="truncate" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1218 <arg value="-s0"/>
1219 <arg value="greenstone.log"/>
1220 </exec>
[26002]1221 <exec executable="truncate" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1222 <arg value="-s0"/>
1223 <arg value="server.log"/>
1224 </exec>
[15124]1225
[25449]1226 <exec executable="cmd" os="${os.windows}" dir="${catalina.home}/logs" spawn="false">
1227 <arg line="/c echo. > catalina.out"/>
1228 </exec>
1229 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1230 <arg line="/c echo. > greenstone.log"/>
1231 </exec>
[26002]1232 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1233 <arg line="/c echo. > server.log"/>
1234 </exec>
[25449]1235
[25501]1236 <if>
1237 <bool><available file="${web.home}/logs/tmp" type="dir"/></bool>
1238 <delete>
1239 <fileset dir="${web.home}/logs/tmp" includes="**/*"/>
1240 </delete>
1241 </if>
[25449]1242 </target>
1243
[15799]1244 <!-- ======================= ant Targets ============================ -->
[15124]1245 <target name="prepare-ant" depends="init">
[16951]1246 <if>
1247 <bool>
1248 <not><available file="${packages.home}/ant/.flagfile"/></not>
1249 </bool>
1250
1251 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1252 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1253 usetimestamp="true"/>
1254 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1255 dest="${packages.home}"/>
1256 <move todir="${packages.home}/ant">
1257 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1258 </move>
1259 <echo file="${packages.home}/ant/.flagfile">
1260 the timestamp of this file is the time that ant was extracted from the zip files.
1261 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1262 </echo>
1263
1264 <else>
1265 <echo>Ant has been prepared, will not prepare</echo>
1266 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1267 </else>
1268
1269 </if>
[15124]1270 </target>
1271
[25338]1272 <!-- ======================= Admin Targets ============================ -->
1273
1274 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1275 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1276 But you can do: echo mypassword | ant config-admin -->
1277 <target name="config-admin" description="Reset admin password">
1278 <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-8 characters):&gt;">
1279 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1280 </input>
[25343]1281 <!--<echo>PWD: ${admin.password}</echo>-->
[25338]1282 <antcall target="update-userdb">
1283 <param name="user.username" value="admin"/>
1284 <param name="user.password" value="${admin.password}"/>
1285 <param name="user.groups" value=""/>
1286 <param name="user.status" value=""/>
1287 <param name="user.comment" value="Password updated."/>
1288 <param name="user.email" value=""/>
1289 </antcall>
1290 </target>
1291
1292 <target name="config-user" description="Add or modify users" depends="get-user-data,update-userdb"/>
1293
1294 <target name="get-user-data" description="Get user details">
1295 <input addproperty="user.username" message="Username:&gt;"/>
1296 <input addproperty="user.password" defaultvalue="" message="Password (3-8 characters):&gt;">
1297 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1298 </input>
1299 <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list):&gt;"/>
1300 <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
1301 <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
1302 <input addproperty="user.email" defaultvalue="" message="Email:&gt;"/>
1303 </target>
1304
1305<!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1306 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1307 But you can do: echo mypassword | ant config-admin -->
[25418]1308 <target name="update-userdb" description="Add or modify users" depends="check-tomcat-running">
1309
1310 <!-- stop tomcat if running, since derby db is embedded and only allows connections from one jvm instance at a time
1311 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
1312 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
[25338]1313 <if>
1314 <bool>
1315 <istrue value="${tomcat.isrunning}"/>
1316 </bool>
[25418]1317 <antcall target="stop-tomcat"/>
[25338]1318 </if>
1319
1320 <!--<echo>${admin.password}</echo>--> <!-- for testing -->
1321 <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
1322 <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
1323 <arg file="${web.home}/sites/localsite/etc/usersDB"/>
1324 <arg value="${user.username}"/>
1325 <arg value="password=${user.password}"/>
1326 <arg value="groups=${user.groups}"/>
1327 <arg value="status=${user.status}"/>
1328 <arg value="comment=${user.comment}"/>
1329 <arg value="email=${user.email}"/>
1330 </java>
1331
1332 <!-- run tomcat again if it used to be running -->
1333 <if>
1334 <bool>
1335 <istrue value="${tomcat.isrunning}"/>
1336 </bool>
1337 <antcall target="start-tomcat"/>
1338 </if>
1339 </target>
1340
1341
[20079]1342 <!-- ======================= Axis Targets ============================ -->
1343
[15124]1344 <target name="prepare-axis" depends="init">
[16951]1345
1346 <if>
1347 <bool>
1348 <not><available file="${packages.home}/axis/.flagfile"/></not>
1349 </bool>
1350
1351 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1352 dest="${packages.home}/${axis.zip.version}"
1353 usetimestamp="true"/>
1354 <unzip src="${packages.home}/${axis.zip.version}"
1355 dest="${packages.home}"/>
1356 <move todir="${packages.home}/axis">
1357 <fileset dir="${packages.home}/${axis.dir.version}"/>
1358 </move>
1359 <!-- install axis into greenstone web app -->
1360 <copy todir="${web.lib}">
1361 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1362 <include name="*.jar"/>
1363 </fileset>
1364 </copy>
1365 <copy todir="${web.home}">
1366 <fileset dir="${packages.home}/axis/webapps/axis/">
1367 <include name="*.jsp"/>
1368 <include name="*.jws"/>
1369 </fileset>
1370 </copy>
1371 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1372 <copy todir="${web.classes}">
1373 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1374 <include name="*.properties"/>
1375 </fileset>
1376 </copy>
1377 <echo file="${packages.home}/axis/.flagfile">
1378 the timestamp of this file is the time that axis was extracted from the zip files.
1379 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1380 </echo>
1381
1382 <else>
1383 <echo>Axis has been prepared, will not prepare</echo>
1384 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1385 </else>
1386
1387 </if>
[15124]1388 </target>
1389
[15229]1390 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
[15124]1391 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
[15799]1392
1393 <target name="deploy-site">
[15124]1394 <java classname="org.apache.axis.client.AdminClient">
1395 <classpath refid="compile.classpath"/>
1396 <arg value="-l"/>
1397 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]1398 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1399 </java>
1400 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
[15124]1401 </target>
1402
[15229]1403 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
[15124]1404 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
[15229]1405 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1406 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1407 tofile="${basedir}/resources/soap/undeploy.wsdd"
1408 filtering="true"
1409 overwrite="true"/>
[15124]1410 <java classname="org.apache.axis.client.AdminClient">
1411 <classpath refid="compile.classpath"/>
1412 <arg value="-l"/>
1413 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
[15229]1414 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
[15124]1415 </java>
[15229]1416 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
[15799]1417 </target>
[15124]1418
[16936]1419 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1420 with the default servicename of localsite-->
[15124]1421 <target name="deploy-localsite" depends="init"
1422 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1423 <antcall target="start-tomcat"/>
[15235]1424 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
[15229]1425 <antcall target="create-deployment-files">
1426 <param name="axis.sitename" value="localsite"/>
[15235]1427 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]1428 <param name="axis.siteuri" value="localsite"/>
1429 </antcall>
[15124]1430 <antcall target="deploy-site">
1431 <param name="axis.sitename" value="localsite"/>
[15235]1432 <param name="axis.servicesname" value="${base.webservice.name}"/>
[15229]1433 <param name="axis.siteuri" value="localsite"/>
[15124]1434 </antcall>
[15369]1435 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
[15124]1436 </target>
[15799]1437
[16936]1438 <target name="get-sitename" unless="axis.sitename">
[15229]1439 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
[15235]1440Press Enter for default:localsite</input>
[15124]1441 </target>
1442
[15229]1443 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1444 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1445To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
[20209]1446Or press Enter for undeploying the default:localsite /&gt;</input>
[15229]1447 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
[15124]1448 </target>
1449
[15229]1450 <target name="get-webservices" unless="axis.servicesname">
[15235]1451 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
[15229]1452Choose from: ${web.services.list}
[20209]1453Or press Enter for default:${base.webservice.name} /&gt;</input>
[15229]1454 <echo>${axis.servicesname}</echo>
1455 </target>
1456
1457 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
[15235]1458 <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]1459 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1460 </target>
1461
1462 <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">
1463 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
[15235]1464 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15124]1465 </condition>
[15229]1466
1467 <!--everything else defaults to java:RPC at present-->
1468 <condition property="soap.method" value="provider='java:RPC'">
1469 <not>
[15235]1470 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
[15229]1471 </not>
1472 </condition>
[16936]1473 </target>
[15799]1474
[16936]1475 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
[15124]1476 <filter token="sitename" value="${axis.sitename}"/>
1477 <filter token="siteuri" value="${axis.siteuri}"/>
[15229]1478 <filter token="servicesname" value="${axis.servicesname}"/>
1479 <filter token="soapmethod" value="${soap.method}"/>
[15124]1480 <copy file="${basedir}/resources/soap/site.wsdd.template"
[15229]1481 tofile="${basedir}/resources/soap/deploy.wsdd"
1482 filtering="true"
1483 overwrite="true"/>
[15124]1484 <!-- create the java files and compile them -->
[15229]1485 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1486 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1487 filtering="true"
1488 overwrite="true"/>
[15124]1489 <mkdir dir="${build.home}"/>
1490 <javac srcdir="${src.home}"
1491 destdir="${build.home}"
1492 debug="${compile.debug}"
1493 deprecation="${compile.deprecation}"
1494 optimize="${compile.optimize}">
1495 <classpath refid="compile.classpath"/>
[15229]1496 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
[15124]1497 </javac>
1498 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
[15799]1499 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1500 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1501 overwrite="true" />
[15124]1502 </target>
[15799]1503
[15124]1504
[15799]1505 <!-- ====================== Core targets ============================== -->
1506 <!-- core targets refer to the core gsdl3 java src -->
[15124]1507
[19878]1508 <target name="prepare-core"/>
[15124]1509
1510 <target name="configure-core"/>
1511
1512 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1513 description="Update only the Greenstone core" />
1514
[15799]1515 <target name="svnupdate-core" unless="nosvn.mode">
[20930]1516 <exec executable="svn">
1517 <arg value="update"/>
1518 <arg value="${basedir}"/>
1519 <arg value="-r"/><arg value="${branch.revision}"/>
1520 </exec>
[15124]1521 </target>
1522
1523 <target name="clean-core"
1524 description="Clean only the Greenstone core">
[19878]1525 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
[15124]1526 <delete dir="${build.home}"/>
1527 </target>
1528
[15799]1529 <target name="compile-core" depends="init"
[15124]1530 description="Compile only the Greenstone core">
1531 <mkdir dir="${build.home}"/>
[25131]1532
[23803]1533 <if><bool><isset property="with.jni"/></bool>
1534 <javac srcdir="${src.home}"
1535 destdir="${build.home}"
1536 debug="${compile.debug}"
1537 deprecation="${compile.deprecation}"
1538 optimize="${compile.optimize}">
1539 <classpath>
1540 <path refid="compile.classpath"/>
1541 </classpath>
1542 </javac>
1543 <else>
1544 <property name="gsprefix" value=""/>
1545 <javac srcdir="${src.home}"
1546 destdir="${build.home}"
1547 debug="${compile.debug}"
1548 deprecation="${compile.deprecation}"
1549 optimize="${compile.optimize}">
1550 <classpath>
1551 <path refid="compile.classpath"/>
1552 </classpath>
1553 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1554 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1555 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1556 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1557 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1558 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1559 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1560 </javac>
1561 </else>
1562 </if>
[15124]1563 <jar destfile="${build.home}/gsdl3.jar">
1564 <fileset dir="${build.home}">
[16936]1565 <include name="org/greenstone/gsdl3/**"/>
[15124]1566 <include name="org/flax/**"/>
[16936]1567 <exclude name="**/Test.class"/>
[15124]1568 </fileset>
1569 <manifest>
[16936]1570 <attribute name="Built-By" value="${user.name}" />
[15124]1571 </manifest>
1572 </jar>
1573 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
[22101]1574
1575 <jar destfile="${build.home}/gutil.jar">
1576 <fileset dir="${build.home}">
1577 <include name="org/greenstone/util/**"/>
1578 </fileset>
1579 <manifest>
1580 <attribute name="Built-By" value="${user.name}" />
1581 </manifest>
1582 </jar>
1583 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1584
[15124]1585 <!-- copy the localsite server in case we need it -->
[15235]1586 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
[15124]1587
[17918]1588 <!-- Greenstone Administrator Interface -->
[15124]1589 <jar destfile="${build.home}/GAI.jar">
1590 <fileset dir="${build.home}">
[16936]1591 <include name="org/greenstone/admin/**"/>
[15124]1592 </fileset>
1593 <manifest>
[16936]1594 <attribute name="Built-By" value="${user.name}" />
[15124]1595 </manifest>
1596 </jar>
[17917]1597 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
[18124]1598 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
[15124]1599 <jar destfile="${build.home}/phind.jar">
1600 <fileset dir="${build.home}">
[16936]1601 <include name="org/greenstone/applet/phind/**"/>
[15124]1602 </fileset>
1603 <manifest>
[16936]1604 <attribute name="Built-By" value="${user.name}" />
[15124]1605 </manifest>
1606 </jar>
1607 <mkdir dir="${web.applet}"/>
1608 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1609 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
[18515]1610 <if>
1611 <bool><istrue value="${tomcat.islocal}"/></bool>
[20085]1612 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1613 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
[18515]1614 </if>
1615
1616
[17116]1617 <!-- skip anttasks for now
[15124]1618 <jar destfile="${build.home}/anttasks.jar">
1619 <fileset dir="${build.home}">
[16936]1620 <include name="org/greenstone/anttasks/**"/>
[15124]1621 </fileset>
1622 <manifest>
[16936]1623 <attribute name="Built-By" value="${user.name}" />
[15124]1624 </manifest>
1625 </jar>
[17116]1626 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
[15124]1627 <jar destfile="${build.home}/gsdl3test.jar">
1628 <fileset dir="${build.home}">
[16936]1629 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1630 <include name="org/greenstone/testing/**"/>
[15124]1631 </fileset>
1632 <manifest>
[16936]1633 <attribute name="Built-By" value="${user.name}" />
[15124]1634 </manifest>
1635 </jar>
1636 <jar destfile="${build.home}/server.jar">
1637 <fileset dir="${build.home}">
[16936]1638 <include name="org/greenstone/server/**"/>
[22634]1639 <include name="org/greenstone/util/**"/>
[15124]1640 </fileset>
1641 <fileset file="${basedir}/resources/java/server.properties"/>
1642 <manifest>
[16936]1643 <attribute name="Built-By" value="${user.name}"/>
[15124]1644 </manifest>
1645 </jar>
1646 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1647 </target>
[15799]1648
1649 <!-- ================== Packages targets ================================ -->
[15124]1650 <!-- these targets refer to the greenstone source packages - these need
1651 updating less often, so are in separate targets to the core -->
[19871]1652 <target name="prepare-packages" depends="init"/>
[15124]1653
1654 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1655 description="Update only the source packages"/>
1656
[15799]1657 <target name="svnupdate-packages" unless="nosvn.mode">
[20930]1658 <exec executable="svn">
1659 <arg value="update"/>
1660 <arg value="${src.packages.home}"/>
1661 <arg value="-r"/><arg value="${branch.revision}"/>
1662 </exec>
[15124]1663 </target>
[19931]1664
[15124]1665
[19871]1666 <target name="configure-packages" depends="init,configure-javagdbm"
[15124]1667 description="Configure only the packages."/>
1668
[22184]1669 <target name="configure-javagdbm" if="with.jni">
[15124]1670 <echo>
1671 Configuring JavaGDBM
1672 </echo>
[18417]1673
[19904]1674 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15124]1675 <arg value="--prefix=${basedir}"/>
1676 <arg value="--libdir=${lib.jni}"/>
[19873]1677 <arg value="--with-gdbm=${gdbm.home}"/>
[15124]1678 </exec>
1679 </target>
1680
[19871]1681 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
[15124]1682
1683 <target name="clean-javagdbm" depends="init">
1684 <exec executable="make" os="${os.unix}"
[19904]1685 dir="${javagdbm.home}" failonerror="true">
[15124]1686 <arg value="clean"/>
1687 </exec>
1688 </target>
1689
[19871]1690 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
[15185]1691
[15799]1692 <target name="distclean-javagdbm" depends="init">
1693 <exec executable="make" os="${os.unix}"
[19904]1694 dir="${javagdbm.home}" failonerror="true">
[15799]1695 <arg value="distclean"/>
1696 </exec>
1697 </target>
1698
1699 <target name="compile-packages" description="Compile only the source packages">
[22184]1700 <!-- javagdbm -->
1701 <antcall target="compile-javagdbm"/>
1702 <!-- Search4j -->
1703 <antcall target="compile-search4j"/>
1704 </target>
1705
1706 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
[15799]1707
[19878]1708 <!-- unix: -->
[15799]1709 <echo>compile javagdbm</echo>
[19904]1710 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1711 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
[15799]1712 <arg value="install"/>
1713 </exec>
[15098]1714
[23852]1715 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1716 "all" which will then perform both the compile AND link targets in jni/win32.mak
1717 (thereby also generating gdbmjava.dll). Then we run the same command with
1718 the "install" argument to copy the gdbmjava.dll into the correct location. -->
[23849]1719 <echo>Windows: compile javagdbm</echo>
[24076]1720 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1721 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23852]1722 </exec>
1723 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
[24076]1724 <env key="GSDL3SRCHOME" path="${basedir}"/>
[23847]1725 <arg value="install"/>
[15799]1726 </exec>
[15124]1727
[15799]1728 <!-- install the jar file -->
[23847]1729 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
[15799]1730 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1731 </target>
1732
[17491]1733 <target name="compile-search4j">
[17509]1734
[19996]1735 <!-- windows -->
[19997]1736 <if><bool><istrue value="${current.os.iswindows}"/></bool>
[19996]1737 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1738 <arg value="/f"/>
1739 <arg value="win32.mak"/>
1740 <arg value='BINDIR="${basedir}\bin"'/>
1741 </exec>
1742 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1743 <arg value="/f"/>
1744 <arg value="win32.mak"/>
1745 <arg value="install"/>
1746 <arg value='BINDIR="${basedir}\bin"'/>
1747 </exec>
[17509]1748
[19996]1749 <!-- unix -->
[19997]1750 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
[19996]1751 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1752 <arg value="--bindir=${basedir}/bin"/>
1753 <arg value="${static.arg}"/>
1754 </exec>
1755 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1756 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1757 <arg value="install"/>
1758 </exec>
[17509]1759
[19996]1760 <!-- else warn -->
1761 <else>
1762 <fail>this target does not support the current os</fail>
[17509]1763
[19996]1764 </else></if></else></if>
1765
[17491]1766 </target>
1767
[19871]1768 <target name="install-auxiliary-jar-files" depends="init">
[22184]1769
1770 <if>
1771 <bool><available file="${mg.home}/mg.jar"/></bool>
1772 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1773 </if>
1774
1775 <if>
[22199]1776 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
[22184]1777 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1778 </if>
1779
[24744]1780 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${web.lib}"/>
[19871]1781 </target>
1782
[22976]1783 <target name="install-jni-files" depends="init" if="with.jni">
1784 <antcall target="install-jni-files-linux"/>
1785 <antcall target="install-jni-files-windows"/>
1786 <antcall target="install-jni-files-macos"/>
1787 </target>
[15124]1788
[15799]1789 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
[15124]1790 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1791 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
[15799]1792 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
[15124]1793 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1794 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
[15799]1795 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1796 </target>
1797 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
[15124]1798 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1799 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
[15799]1800 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
[15124]1801 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1802 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
[15799]1803 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1804 </target>
1805 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
[15124]1806 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1807 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
[15799]1808 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
[15124]1809 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1810 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
[15799]1811 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1812 </target>
1813
[19871]1814 <!-- ========common-src targets =================================-->
1815 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1816 collection building is not enabled -->
1817
1818 <target name="update-common-src" depends="init" if="collection.building.disabled">
1819 </target>
[19931]1820
[19871]1821 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
[20930]1822 <exec executable="svn">
1823 <arg value="update"/>
1824 <arg value="${common.src.home}"/>
1825 <arg value="-r"/><arg value="${branch.revision}"/>
1826 </exec>
[19871]1827 </target>
1828
[19878]1829 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
[19871]1830 <antcall target="checkout-common-src"/>
1831 <antcall target="unzip-windows-packages"/>
1832 </target>
1833
1834 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1835 <echo>checking out common-src</echo>
[20930]1836 <exec executable="svn">
1837 <arg value="checkout"/>
[21196]1838 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
[20930]1839 <arg value="common-src"/>
1840 <arg value="-r"/><arg value="${branch.revision}"/>
1841 </exec>
[19871]1842 </target>
1843
[19931]1844 <target name="configure-common-src" depends="init">
[19871]1845 <exec executable="${common.src.home}/configure" os="${os.unix}"
[19904]1846 dir="${common.src.home}" failonerror="true">
[19931]1847 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
[19933]1848 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
[22184]1849 <arg line="${gs2.opt.args}"/>
[22854]1850 <arg line="${static.arg}"/>
[23611]1851 <arg line="${allargs}"/>
[19871]1852 </exec>
1853 </target>
1854
[19931]1855 <target name="clean-common-src" depends="init">
[19871]1856 <!-- unix: -->
[19904]1857 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]1858 <arg value="clean"/>
1859 </exec>
1860 <!-- windows: -->
[19904]1861 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
[19871]1862 <arg value="/f"/>
1863 <arg value="win32.mak"/>
1864 <arg value="clean"/>
[19960]1865 <arg value="GSDLHOME=${gs2build.home}"/>
[19871]1866 </exec>
1867 </target>
[19931]1868 <target name="distclean-common-src" depends="init">
[19960]1869 <!-- unix: -->
[19904]1870 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[19871]1871 <arg value="distclean"/>
1872 </exec>
[19960]1873 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1874 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1875 <arg value="/f"/>
1876 <arg value="win32.mak"/>
1877 <arg value="clean"/>
1878 <arg value="GSDLHOME=${gs2build.home}"/>
1879 </exec>
[19871]1880 </target>
[19931]1881 <target name="compile-common-src" depends="init">
[19871]1882 <!-- unix: -->
[19904]1883 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]1884 <arg value="${gs2.compile.target}"/>
[19871]1885 </exec>
1886 <!-- windows: -->
[19904]1887 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
[19871]1888 <arg value="/f"/>
1889 <arg value="win32.mak"/>
[19934]1890 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]1891 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[22976]1892 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1893 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1894 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1895 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
[19871]1896 </exec>
1897 </target>
1898
[19843]1899 <!-- ======= collection-building targets ===========================-->
[15124]1900
[19843]1901 <target name="update-collection-building" if="collection.building.enabled"
[19931]1902 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]1903 description="Update (SVN update, configure, compile etc) only the collection building components"/>
[15124]1904
[19843]1905 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1906 description="SVN update the collection building components">
1907 </target>
[15124]1908
[19843]1909 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
[15124]1910 </target>
1911
[19931]1912 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1913 description="Configure the collection building components">
[19843]1914 </target>
[15098]1915
[19948]1916 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
[19843]1917 description="Clean only the collection building components"
1918 if="collection.building.enabled"/>
[18495]1919
[19948]1920 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
[19843]1921 description="Distclean only the collection building components"
1922 if="collection.building.enabled"/>
1923
[19931]1924 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
[19843]1925 description="Compile only the collection building components">
[19931]1926 <!-- make install for common-src -->
1927 <!-- unix: -->
1928 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
[22184]1929 <arg value="${gs2.install.target}"/>
[19931]1930 </exec>
1931
1932 <!-- windows: -->
1933 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1934 <arg value="/f"/>
1935 <arg value="win32.mak"/>
[21370]1936 <arg value="install"/>
[23837]1937 <arg value="GSDLHOME=${gs2build.home}"/>
[22184]1938 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
[23837]1939 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1940 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1941 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1942 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1943 <!--
1944 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1945 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
[19931]1946 </exec>
1947
1948 <!-- install gs2build indexers for windows -->
1949 <if>
1950 <bool><istrue value="${current.os.iswindows}"/></bool>
1951 <copy todir="${gs2build.home}/bin/windows">
1952 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1953 <include name="*.*"/>
1954 </fileset>
1955 </copy>
1956 </if>
1957
1958 <!-- LuceneWrapper jar file not installed by default -->
1959 <mkdir dir="${gs2build.home}/bin/java"/>
[24744]1960 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${gs2build.home}/bin/java"/>
[19931]1961
[15124]1962 </target>
[19843]1963
1964 <!-- ============== gli targets ================================= -->
[15799]1965 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
[19929]1966
[20930]1967 <exec executable="svn">
1968 <arg value="update"/>
1969 <arg value="${gli.home}"/>
1970 <arg value="-r"/><arg value="${branch.revision}"/>
1971 </exec>
1972
[21196]1973 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]1974 <arg value="export"/>
1975 <arg value="-r"/><arg value="${branch.revision}"/>
[25136]1976 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
[20930]1977 </exec>
[21196]1978 <exec executable="svn" dir="web/WEB-INF/cgi">
1979 <arg value="export"/>
1980 <arg value="-r"/><arg value="${branch.revision}"/>
[25136]1981 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
[21196]1982 </exec>
[20930]1983
[15124]1984 </target>
1985
[19843]1986 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
[19911]1987 <!-- checkout -->
[23808]1988 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
[19929]1989
[20930]1990 <exec executable="svn">
1991 <arg value="checkout"/>
[21196]1992 <arg value="${svn.root}/main/${branch.path}/gli"/>
[20930]1993 <arg value="-r"/><arg value="${branch.revision}"/>
1994 </exec>
1995
[21196]1996 <exec executable="svn" dir="web/WEB-INF/cgi">
[20930]1997 <arg value="export"/>
1998 <arg value="-r"/><arg value="${branch.revision}"/>
[25570]1999 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
[20930]2000 </exec>
[21196]2001 <exec executable="svn" dir="web/WEB-INF/cgi">
2002 <arg value="export"/>
2003 <arg value="-r"/><arg value="${branch.revision}"/>
[25570]2004 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
[21196]2005 </exec>
[20930]2006
[19911]2007 </if>
[15124]2008 </target>
[19843]2009
2010 <target name="clean-gli" depends="init" if="collection.building.enabled">
2011 <!-- gli -->
2012 <property name="gli.home" value="${basedir}/gli"/>
2013 <!-- linux -->
2014 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
[20826]2015 resolveExecutable="true" failonerror="true"/>
[19843]2016 <!-- windows -->
2017 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
[20826]2018 resolveExecutable="true" failonerror="true"/>
[19843]2019 </target>
2020
2021 <target name="compile-gli" depends="init" if="collection.building.enabled">
[23808]2022 <if><bool><isset property="with.gli.and.gems"/></bool>
[23807]2023 <!-- gli -->
2024 <property name="gli.home" value="${basedir}/gli"/>
[15098]2025
[23807]2026 <!-- linux -->
2027 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2028 <!--remote gli-->
2029 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
2030 resolveExecutable="true" failonerror="true"/>
2031 <!-- windows -->
2032 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2033 <!--remote gli-->
2034 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
2035 resolveExecutable="true" failonerror="true"/>
2036 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
2037 </if>
[19843]2038 </target>
[15124]2039
[19843]2040 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
[21351]2041 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
[19843]2042 <env key="gsdl3path" path="${basedir}"/>
[19871]2043 <env key="gsdlpath" path="${gs2build.home}"/>
[19843]2044 </exec>
[21351]2045 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
[19843]2046 <env key="gsdl3path" path="${basedir}"/>
[19871]2047 <env key="gsdlpath" path="${gs2build.home}"/>
[19873]2048 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
[19843]2049 </exec>
[21351]2050 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
[19843]2051 <env key="GSDL3PATH" path="${basedir}"/>
[19871]2052 <env key="GSDLPATH" path="${gs2build.home}"/>
[19843]2053 </exec>
2054 <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.
2055 </echo>
2056 </target>
2057
2058 <!-- ================ gs2build targets =========================== -->
2059
2060 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
2061 <echo>svn updating gs2build</echo>
[20930]2062 <exec executable="svn">
2063 <arg value="update"/>
2064 <arg value="${gs2build.home}"/>
2065 <arg value="-r"/><arg value="${branch.revision}"/>
2066 </exec>
[15799]2067 </target>
[19843]2068
[15124]2069 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
2070 <antcall target="checkout-gs2build"/>
2071 <antcall target="unzip-windows-packages"/>
2072 <antcall target="checkout-winbin"/>
2073 <antcall target="get-windows-binaries"/>
2074 <antcall target="delete-winbin"/>
2075 </target>
2076
[19843]2077 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
2078 <echo>checking out gs2build</echo>
[20930]2079 <exec executable="svn">
2080 <arg value="checkout"/>
[21196]2081 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
[20930]2082 <arg value="-r"/><arg value="${branch.revision}"/>
2083 </exec>
2084
[21196]2085
[19843]2086 </target>
2087
[15124]2088 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
[15799]2089 unless="nosvn.mode">
[20930]2090
2091 <exec executable="svn">
2092 <arg value="checkout"/>
[21196]2093 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
[20930]2094 <arg value="-r"/><arg value="${branch.revision}"/>
[21196]2095 <arg value="winbin"/>
[20930]2096 </exec>
2097
[15124]2098 </target>
2099
[15799]2100 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
[20930]2101 <exec executable="svn">
2102 <arg value="update"/>
2103 <arg value="winbin"/>
2104 <arg value="-r"/><arg value="${branch.revision}"/>
2105 </exec>
2106
[15799]2107 </target>
[15124]2108
2109 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
2110 <move todir="${gs2build.home}/bin/windows" failonerror="false">
2111 <fileset dir="${basedir}/winbin/bin"/>
2112 </move>
2113 </target>
[19843]2114
[15124]2115 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
2116 <delete dir="${basedir}/winbin"/>
2117 </target>
2118
[19871]2119 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
2120 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
2121 dest="${common.src.home}/packages/windows/crypt"/>
[18179]2122 <untar compression="gzip"
[19871]2123 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
2124 dest="${common.src.home}/packages/sqlite"/>
2125 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
2126 dest="${common.src.home}/indexers/packages/windows/iconv"/>
[15799]2127 </target>
[19878]2128
[15124]2129 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
2130 <!-- we want a windows path in the setup.bat file -->
2131 <pathconvert targetos="windows" property="gs2build.home.windows">
2132 <path path="${gs2build.home}"/>
2133 </pathconvert>
2134 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
2135 <filterset>
[16620]2136 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
[15799]2137 </filterset>
[15124]2138 </move>
2139 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
2140 </target>
2141
[19843]2142
[19948]2143 <target name="clean-build-src" depends="init" if="collection.building.enabled">
[19871]2144 <!-- unix: -->
[19948]2145 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]2146 <arg value="clean"/>
2147 </exec>
2148 <!-- windows: -->
[19948]2149 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[15799]2150 <arg value="/f"/>
2151 <arg value="win32.mak"/>
2152 <arg value="clean"/>
[19960]2153 <arg value="GSDLHOME=${gs2build.home}"/>
[15124]2154 </exec>
2155 </target>
2156
[19948]2157
2158 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
[19960]2159 <!-- unix: -->
[19948]2160 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
[15124]2161 <arg value="distclean"/>
2162 </exec>
[19960]2163 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
2164 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2165 <arg value="/f"/>
2166 <arg value="win32.mak"/>
2167 <arg value="clean"/>
2168 <arg value="GSDLHOME=${gs2build.home}"/>
2169 </exec>
[15124]2170 </target>
[19843]2171
[19931]2172 <target name="configure-build-src" depends="init" if="collection.building.enabled"
2173 description="Configure the build-src component">
2174 <exec executable="${build.src.home}/configure" os="${os.unix}"
2175 dir="${build.src.home}" failonerror="true">
2176 <arg value="--prefix=${gs2build.home}"/>
[23611]2177 <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
[19931]2178 </exec>
2179 </target>
[19910]2180
[19931]2181 <!-- common-src is done separately and needs to be compiled first -->
2182 <target name="compile-build-src" depends="init" if="collection.building.enabled">
2183
2184 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[23611]2185 <arg line="${ldlpath.arg}"/>
[22845]2186 </exec>
2187
2188 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
[19931]2189 <arg value="install"/>
2190 </exec>
[19910]2191
[19931]2192 <!-- run the setup script -->
[20826]2193 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
[19910]2194 <!--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]2195 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[19910]2196 <arg value="/f"/>
2197 <arg value="win32.mak"/>
[19934]2198 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]2199 </exec>
[19931]2200 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
[19910]2201 <arg value="/f"/>
2202 <arg value="win32.mak"/>
2203 <arg value="install"/>
[19934]2204 <arg value="GSDLHOME=${gs2build.home}"/>
[19910]2205 </exec>
[15124]2206 </target>
2207
2208
[15799]2209 <!-- ======================== TESTING Targets ========================= -->
[15124]2210
2211 <target name="test" description="Run the (incomplete) JUnit test suite "
2212 depends="init">
2213 <mkdir dir="${basedir}/test"/>
2214 <junit printsummary="withOutAndErr"
2215 errorproperty="test.failed"
2216 failureproperty="test.failed"
2217 fork="${junit.fork}">
2218 <formatter type="plain"/>
2219 <classpath>
[16936]2220 <pathelement location="${build.home}/gsdl3test.jar"/>
2221 <path refid="compile.classpath"/>
[15124]2222 </classpath>
2223 <test name="${testcase}" if="testcase"/>
2224 <batchtest todir="${basedir}/test" unless="testcase">
[18505]2225 <fileset dir="${build.home}" includes="**/*Test.class" />
[15124]2226 </batchtest>
2227 </junit>
2228 <echo>
2229 *********************************************
[15799]2230 Test output can be found in directory 'test'
[15124]2231 *********************************************
2232 </echo>
2233 </target>
[15799]2234
[20950]2235 <!-- ======================== FLAX Targets ========================= -->
2236 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2237 <echo>checking out flax ...</echo>
2238 <mkdir dir="${basedir}/src/java/org/flax"/>
2239 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
[22198]2240 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
[20950]2241 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2242 <mkdir dir="${web.home}/interfaces/flax"/>
2243 <mkdir dir="${web.home}/sites/flax"/>
2244 <mkdir dir="${basedir}/flax-resources"/>
2245 <mkdir dir="${basedir}/flax-lib"/>
[21272]2246 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2247 <arg value="src/java/org/flax"/></exec>
2248 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2249 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
[22198]2250 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2251 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2252 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
[21272]2253 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2254 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2255 <arg value="${web.home}/interfaces/flax"/></exec>
2256 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2257 <arg value="${web.home}/sites/flax"/></exec>
2258 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2259 <arg value="flax-resources"/></exec>
2260 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2261 <arg value="flax-lib"/></exec>
[25901]2262 <antcall target="flax-copy-del-files" />
[20950]2263 </target>
[23442]2264
[25901]2265 <target name="flax-copy-del-files" description="copy some flax files into the appropriate greenstone3 directories and delete some unwanted greenstone stuff">
[23442]2266 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2267 <copy todir="${web.home}/WEB-INF/lib">
[25901]2268 <fileset dir="${basedir}/flax-lib">
2269 <include name="*.jar"/>
2270 </fileset>
[23442]2271 </copy>
[25904]2272 <!--<delete dir="${web.home}/sites/gateway"/>
2273 <delete dir="${web.home}/sites/localsite"/>-->
[23442]2274 </target>
[20950]2275
2276 <target name="update-flax" description="update flax from repository">
2277 <echo>updating flax ...</echo>
[21272]2278 <exec executable="svn"><arg value="update"/>
2279 <arg value="src/java/org/flax"/></exec>
2280 <exec executable="svn"><arg value="update"/>
[22198]2281 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2282 <exec executable="svn"><arg value="update"/>
[21272]2283 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2284 <exec executable="svn"><arg value="update"/>
2285 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2286 <exec executable="svn"><arg value="update"/>
2287 <arg value="${web.home}/interfaces/flax"/></exec>
2288 <exec executable="svn"><arg value="update"/>
[24366]2289 <arg value="${web.home}/web/sites/flax"/></exec>
2290 <exec executable="svn"><arg value="update"/>
[21272]2291 <arg value="flax-resources"/></exec>
2292 <exec executable="svn"><arg value="update"/>
2293 <arg value="flax-lib"/></exec>
[24098]2294 <antcall target="compile-core" />
[20950]2295 </target>
2296
[25901]2297 <!-- ========================End of FLAX Targets ========================= -->
[20963]2298
[19354]2299 <target name="compile-javadocs">
2300 <javadoc packagenames="org.greenstone.*"
2301 sourcepath="src/java"
2302 defaultexcludes="yes"
2303 destdir="docs/javadoc"
2304 author="true"
2305 version="true"
2306 use="true"
2307 windowtitle="Greenstone3 API">
2308 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2309 </javadoc>
2310 </target>
2311
[20089]2312<!-- ========== Some distribution targets ======================== -->
[19972]2313 <target name="remove-source">
[23809]2314 <if><bool><isset property="with.gli.and.gems"/></bool>
[19975]2315 <delete includeEmptyDirs="true">
2316 <fileset dir="." defaultexcludes="false">
2317 <patternset refid="greenstone3.source.component"/>
2318 </fileset>
2319 </delete>
[23809]2320
2321 <else>
2322 <delete includeEmptyDirs="true">
2323 <fileset dir="." defaultexcludes="false">
2324 <patternset refid="greenstone3.source.no.gli.component"/>
2325 </fileset>
2326 </delete>
2327 </else>
2328 </if>
[19972]2329 </target>
2330
[19903]2331 <target name="dist-tidy"
2332 description="'tidies-up' a greenstone3 installation for distribution.">
2333
2334 <!-- delete unneeded things -->
2335 <delete dir="${packages.home}/axis"/>
2336 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2337 <delete file="README-SVN.txt"/>
[20215]2338 <delete file="build.properties.in"/>
[19903]2339
[19961]2340 <!-- delete source files -->
[19972]2341 <antcall target="remove-source"/>
[19903]2342
2343 <!-- create empty directories -->
2344 <mkdir dir="${web.home}/applet"/>
2345 <mkdir dir="${web.home}/logs"/>
[25446]2346 <mkdir dir="${web.home}/logs/tmp"/>
[19903]2347
2348 <!-- os specific tidy-ups -->
[20051]2349 <!-- linux, mac -->
2350 <if><bool><istrue value="${current.os.isunix}"/></bool>
[19903]2351 <delete><fileset dir="." includes="*.bat"/></delete>
[23809]2352 <if><bool><isset property="with.gli.and.gems"/></bool>
2353 <delete><fileset dir="gli" includes="*.bat"/></delete>
2354 </if>
[19903]2355 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2356 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
[19946]2357 <delete file="${basedir}/gs2build/win32cfg.h"/>
[19939]2358 <delete file="${basedir}/gs2build/win32.mak"/>
[20051]2359 <delete dir="${basedir}/winutil"/>
[19903]2360 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2361
[20051]2362 <!-- windows -->
2363 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2364 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
[23809]2365 <if><bool><isset property="with.gli.and.gems"/></bool>
2366 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2367 </if>
[20051]2368 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2369 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2370 </if></else></if>
2371
[19903]2372 </target>
2373
[20089]2374 <!-- fix up executable permissions for binary release -->
2375 <target name="fix-execute-permissions">
2376 <echo>Setting binaries to executable</echo>
[20127]2377 <chmod perm="775">
2378 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2379 </chmod>
[20089]2380 </target>
2381
2382 <!-- fix up executable permissions for source code release -->
2383 <target name="fix-execute-permissions-source">
[20127]2384 <chmod perm="775">
2385 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2386 </chmod>
[20089]2387 </target>
2388
2389
[19931]2390 <!-- ============= tweaks for making compilation static ========== -->
2391 <target name="tweak-makefiles" depends="init" if="compile.static">
2392 <antcall target="rtftohtml-add-static" />
2393 </target>
2394
2395 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2396 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2397 </target>
2398
[26002]2399</project>
Note: See TracBrowser for help on using the repository browser.