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

Last change on this file since 28297 was 28297, checked in by jlwhisler, 11 years ago

Allowing the user to customise the context name of GS3.

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