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

Last change on this file since 29515 was 29515, checked in by Jeremy Symon, 9 years ago

Added property to set the encoding to UTF-8 when building. This is required for building under environments where the system language is set to ASCII - javac will crash if it encounters unicode characters otherwise

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