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

Last change on this file since 29268 was 29268, checked in by kjdon, 10 years ago

need to copy OAIConfig.xml to WEB-INF, not OAIConfig.xml.in, as the .xml file is the one we tell users to edit.

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