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

Last change on this file since 32339 was 32339, checked in by ak19, 6 years ago

Rewritten conditions and tests for setting the tomcat port to fail at the earliest error and to be easier to read and debug.

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