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

Last change on this file since 29438 was 29438, checked in by kjdon, 9 years ago

added a clear-tomcat-sessions target

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