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

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

Shifting instructions for svn updating gs2build/common-src/cgi-bin scripts for moving into gs3/web/WEB-INF/cgi to its own target and making sure it gets called at the same time as it did before (previously in prepare-gli and svnupdate-gli targets, now called alongside those targets). Now metadata-server.pl in cgi-bin is also svn-updated.

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