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

Last change on this file since 27788 was 27788, checked in by ak19, 8 years ago

Dr Bainbridge suggested th e fix for when the Greenstone 3 home is moved: ant start should depend on configure-tomcat, so that greenstone3.xml is updated with the correct location of gsdl3's new home folder. Tested on Linux (CentOS) and Windows (32 bit Vista).

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