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

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

All the changes (still preliminary) that use tomcat.https.port and tomcat.http.port to determine tomcat.port and write it out to build.xml. Now the server application won't quite work: it can't change the port numbers as its code only knows to write out the tomcat.port, and the actual tomcat port (https or http) will remain unaffected. But I'll fix this later, as there may be a better way to do this.

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