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

Last change on this file since 28181 was 28178, checked in by kjdon, 11 years ago

solr server now working only with files in web folder, so need to copy web solr.xml.in not original one from ext folder

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