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

Last change on this file since 28636 was 28636, checked in by ak19, 10 years ago

As part of getting diffcol to work with GS3, GS3 needs to be compiled up, for which the following changes were made: 1. Modifications to build.properties and build.xml to checkout and set up gnome-lib-minimal and still pass the --enable-gnome-lib-ext flag to build-src/configure.in. 2. Fixing up build-src/Makefile.in so that sourcing gnome-lib can work on Ubuntu, which uses dash instead of bash and so does not recongise pushd/popd or source (only the dot). To get the build-src Makefile to work on Ubuntu, Makefile.in now sets the SHELL to be bin/bash for running make, and then executes the commands for sourcing gnome-lib in the same subshell as the one which compiles up build-src subdirs like wvware.

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