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

Last change on this file since 28613 was 28613, checked in by ak19, 7 years ago

Minor correction to previous commit to make the new get-isisgdl ant target work on Mac. On macs, the uname binary is located in /usr/bin not /bin. Therefore, the target is now calling uname directly.

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