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

Last change on this file since 28907 was 28907, checked in by kjdon, 10 years ago

moved gsdl3site.cfg.in file to resources/cgi. On prepare it's copied to resources/cgi/gsdl3site.cfg, then on tomcat start its copied with filtering to web/WEB_INF/cgi

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