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

Last change on this file since 27080 was 27034, checked in by ak19, 11 years ago

After checking out gnome-lib, it is compiled up by running its CASCADE-MAKE.sh script which already sources devel.bash for its temporary environment. Also added a message at the end of the prepare step, telling the developer (if they turned on use.support.lib) to source devel.bash before compiling gs3 with ant install.

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