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

Last change on this file since 27238 was 27238, checked in by ak19, 11 years ago

Target check-running-tomcat now no longer pings the URL of the form host:port/greenstone3 but just host:port/ instead, since if there's a problem with the servlet (greenstone3 in this example) then check-running-tomcat may return false even though tomcat is still running at host:port. Now if tomcat is running at host:port, the check succeeds, so the stop-tomcat target will know to run actually stop the web server in such a case.

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