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

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

Bugfix. On Windows, when GLI launches the GS3server, the perl path found is env.PERLPATH since GLI uses findperl.bat to locate the path to perl bin. By the time the ant target perl-for-building determines the perl path, env.PERLPATH needs to have a slash appended at the end, else the path to perl appears as binperl instead of bin\perl in packages\tomcat\conf\web.xml, and then metadata edited with the online meta editor don't get saved since the metadata-server.pl script can't find perl. This is not a problem if the GS3 server is not launched through GLI, since ant target perl-for-building goes into another branch of its logic to locate perlpath.

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