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

Last change on this file since 23852 was 23852, checked in by davidb, 13 years ago

Additional capability introduced to control how Perl is found.

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