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

Last change on this file since 23941 was 23941, checked in by ak19, 13 years ago

Need to use GNUwin32 port of linux Which cmd instead of DOS Where cmd since Where is not available on Windows XP.

File size: 91.1 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="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
26
27
28 <!-- ===================== Property Definitions =========================== -->
29
30 <!--
31
32 Each of the following properties are used in the build script.
33 Values for these properties are set by the first place they are
34 defined, from the following list:
35
36 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
37
38 * Definitions from a "build.properties" file in the top level
39 source directory of this application.
40
41 * Definitions from a "build.properties" file in the user's
42 home directory.
43
44 * Default definitions in this build.xml file.
45
46 You will note below that property values can be composed based on the
47 contents of previously defined properties. This is a powerful technique
48 that helps you minimize the number of changes required when your development
49 environment is modified. Note that property composition is allowed within
50 "build.properties" files as well as in the "build.xml" script.
51
52 -->
53
54 <!-- create build.properties if it has not been created yet -->
55 <if>
56 <bool><not><available file="build.properties"/></not></bool>
57 <copy file="build.properties.in" tofile="build.properties"/>
58 </if>
59
60 <!-- create the packages dir if it has not been created yet -->
61 <mkdir dir="packages"/>
62
63 <!--the first three properties have to be put on the top to be used by build.properties-->
64 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
65 <property name="src.packages.home" value="${basedir}/src/packages"/>
66 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
67
68 <property file="build.properties"/>
69 <if><bool><available file="${user.home}/build.properties"/></bool>
70 <property file="${user.home}/build.properties"/>
71 </if>
72
73 <!-- now we've read in properties, apply defaults -->
74 <property name="disable.collection.building" value="false"/>
75
76 <!-- get properties from the environment -->
77 <property environment="env"/>
78
79 <!-- get the filesets defining components and executables -->
80 <import file="resources/xml/components.xml"/>
81 <import file="resources/xml/executables.xml"/>
82
83 <!-- version properties for external packages -->
84 <!-- for Java versions < 1.4, we print out the message that Java is too old.
85 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 6.0-->
86 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-6.0.20">
87 <equals arg1="1.4" arg2="${ant.java.version}"/>
88 </condition>
89 <condition property="tomcat.version.major" value="5" else="6">
90 <equals arg1="1.4" arg2="${ant.java.version}"/>
91 </condition>
92 <condition property="privileged.attribute" value="privileged='true'" else="">
93 <equals arg1="6" arg2="${tomcat.version.major}"/>
94 </condition>
95
96 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
97 <property name="axis.dir.version" value="axis-1_4"/>
98 <property name="sqlite.targz.version" value="sqlite-amalgamation-3.5.9.tar.gz"/>
99
100 <property name="build.home" value="${basedir}/build"/>
101 <property name="src.home" value="${basedir}/src/java"/>
102 <property name="packages.home" value="${basedir}/packages"/>
103 <!-- this may be set in build.properties, eg if you move the web dir to
104 tomcats webapps directory -->
105 <property name="web.home" value="${basedir}/web"/>
106 <!-- jar files needed by applets go here -->
107 <property name="web.applet" value="${web.home}/applet"/>
108
109 <!-- jar files needed by the servlet (and extra ones) go here -->
110 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
111 <!-- other files needed by the servlet go here -->
112 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
113 <!--- flax: the WordNet home -->
114 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
115
116 <!-- jni libraries and java wrappers go here -->
117 <property name="lib.jni" value="${basedir}/lib/jni"/>
118
119 <!-- other jar files needed for installation (but not runtime) go here -->
120 <property name="lib.java" value="${basedir}/lib/java"/>
121
122 <property name="javadocs" value="${basedir}/docs/javadoc"/>
123
124 <property name="app.name" value="greenstone3"/>
125 <property name="app.path" value="/${app.name}"/>
126
127 <property name="admin.dir" value="${basedir}/admin"/>
128
129 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
130 <property name="app.version" value="trunk"/>
131 <property name="branch.path" value="trunk"/>
132 <property name="branch.revision" value="HEAD"/>
133
134 <!--constants -->
135 <property name="svn.root" value="http://svn.greenstone.org"/>
136
137 <!-- catalina home is set to tomcat basedir if already installed, otherwise
138 use greenstone's tomcat -->
139 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
140 <and>
141 <isset property="tomcat.installed.path"/>
142 <not>
143 <equals arg1="" arg2="${tomcat.installed.path}"/>
144 </not>
145 </and>
146 </condition>
147
148 <property name="os.linux" value="Linux"/>
149 <property name="os.mac" value="Mac OS X"/>
150 <property name="os.solaris" value="SunOS"/>
151 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
152 <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!!!-->
153
154 <!-- this is true for linux and macs -->
155 <condition property="current.os.isunix">
156 <os family="unix"/>
157 </condition>
158
159 <condition property="current.os.isunixnotmac">
160 <and>
161 <os family="unix"/>
162 <not>
163 <os family="mac"/>
164 </not>
165 </and>
166 </condition>
167
168 <condition property="current.os.ismac">
169 <os family="mac"/>
170 </condition>
171
172 <condition property="current.os.iswindows">
173 <os family="windows"/>
174 </condition>
175
176 <!-- is there a better way to do this?? what about solaris?? -->
177 <condition property="os.bin.dir" value="windows">
178 <os family="windows"/>
179 </condition>
180 <condition property="os.bin.dir" value="darwin">
181 <os family="mac"/>
182 </condition>
183 <condition property="os.bin.dir" value="linux">
184 <and>
185 <os family="unix"/>
186 <not>
187 <os family="mac"/>
188 </not>
189 </and>
190 </condition>
191
192
193 <condition property="collection.building.disabled">
194 <and>
195 <isset property="disable.collection.building"/>
196 <istrue value="${disable.collection.building}"/>
197 </and>
198 </condition>
199
200 <condition property="collection.building.enabled">
201 <not>
202 <istrue value="${disable.collection.building}"/>
203 </not>
204 </condition>
205
206 <condition property="collection.building.enabled.windows">
207 <and>
208 <istrue value="${collection.building.enabled}"/>
209 <isset property="current.os.iswindows"/>
210 </and>
211 </condition>
212
213 <condition property="collection.building.enabled.unix">
214 <and>
215 <istrue value="${collection.building.enabled}"/>
216 <isset property="current.os.isunix"/>
217 </and>
218 </condition>
219
220 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
221 <isset property="compile.static"/>
222 </condition>
223
224 <!-- If building a release then we want to adjust environment variables so that the support library can be see during compilation -->
225 <if><bool><isset property="use.support.lib"/></bool>
226 <property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
227
228 <if><bool><isset property="env.CFLAGS"/></bool>
229 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CFLAGS}&quot;"/>
230 <else>
231 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
232 </else>
233 </if>
234
235 <if><bool><isset property="env.CPPFLAGS"/></bool>
236 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CPPFLAGS}&quot;"/>
237 <else>
238 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
239 </else>
240 </if>
241
242 <if><bool><isset property="env.CXXFLAGS"/></bool>
243 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CXXFLAGS}&quot;"/>
244 <else>
245 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
246 </else>
247 </if>
248
249 <if><bool><isset property="env.LDFLAGS"/></bool>
250 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib ${env.LDFLAGS}&quot;"/>
251 <else>
252 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib&quot;"/>
253 </else>
254 </if>
255
256 <if><bool><isset property="env.PATH"/></bool>
257 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin:${env.PATH}&quot;"/>
258 <else>
259 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin&quot;"/>
260 </else>
261 </if>
262
263 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
264 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig:${env.PKG_CONFIG_PATH}&quot;"/>
265 <else>
266 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig&quot;"/>
267 </else>
268 </if>
269
270 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
271 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
272 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}&quot;"/>
273 <else>
274 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
275 </else>
276 </if>
277 <else>
278 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
279 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
280 <else>
281 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
282 </else>
283 </if>
284 </else>
285 </if>
286
287 <else>
288 <if><bool><isset property="env.CFLAGS"/></bool>
289 <property name="cflags.arg" value="CFLAGS=&quot;${env.CFLAGS}&quot;"/>
290 <else>
291 <property name="cflags.arg" value=" "/>
292 </else>
293 </if>
294
295 <if><bool><isset property="env.CPPFLAGS"/></bool>
296 <property name="cppflags.arg" value="CPPFLAGS=&quot;${env.CPPFLAGS}&quot;"/>
297 <else>
298 <property name="cppflags.arg" value=" "/>
299 </else>
300 </if>
301
302 <if><bool><isset property="env.CXXFLAGS"/></bool>
303 <property name="cxxflags.arg" value="CXXFLAGS=&quot;${env.CXXFLAGS}&quot;"/>
304 <else>
305 <property name="cxxflags.arg" value=" "/>
306 </else>
307 </if>
308
309 <if><bool><isset property="env.LDFLAGS"/></bool>
310 <property name="ldflags.arg" value="LDFLAGS=&quot;${env.LDFLAGS}&quot;"/>
311 <else>
312 <property name="ldflags.arg" value=" "/>
313 </else>
314 </if>
315
316 <if><bool><isset property="env.PATH"/></bool>
317 <property name="path.arg" value="PATH=&quot;${env.PATH}&quot;"/>
318 <else>
319 <property name="path.arg" value=" "/>
320 </else>
321 </if>
322
323 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
324 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${env.PKG_CONFIG_PATH}&quot;"/>
325 <else>
326 <property name="pcpath.arg" value=" "/>
327 </else>
328 </if>
329
330 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
331 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
332 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
333 <else>
334 <property name="ldlpath.arg" value=" "/>
335 </else>
336 </if>
337 <else>
338 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
339 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
340 <else>
341 <property name="ldlpath.arg" value=" "/>
342 </else>
343 </if>
344 </else>
345 </if>
346 </else>
347 </if>
348 <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
349
350 <condition property="gs2.opt.args" value= " " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
351 <istrue value="${with.jni}"/>
352 </condition>
353 <condition property="gs2.compile.target" value="with-jni" else="without-jni">
354 <istrue value="${with.jni}"/>
355 </condition>
356 <condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
357 <istrue value="${with.jni}"/>
358 </condition>
359 <condition property="gs2.windows.enablejni" value="1" else="0">
360 <istrue value="${with.jni}"/>
361 </condition>
362 <condition property="gs2.windows.enablemg" value="1" else="0">
363 <istrue value="${with.jni}"/>
364 </condition>
365 <condition property="gs2.windows.enablemgpp" value="1" else="0">
366 <istrue value="${with.jni}"/>
367 </condition>
368 <!-- Should accent folding not also be set here ?? -->
369 <condition property="gs2.windows.usegdbm" value="1" else="0">
370 <istrue value="${with.jni}"/>
371 </condition>
372 <condition property="gs2.windows.usesqlite" value="1" else="0">
373 <istrue value="${with.jni}"/>
374 </condition>
375
376 <!-- where is search4j tool -->
377 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
378 <isset property="current.os.iswindows"/>
379 </condition>
380
381
382 <!-- ============= Base dirs for each package and component ============ -->
383 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
384 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
385 <property name="gli.home" value="${basedir}/gli"/>
386 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
387
388 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
389 <istrue value="${disable.collection.building}"/>
390 </condition>
391
392 <property name="build.src.home" value="${gs2build.home}/build-src"/>
393 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
394 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
395 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
396 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
397
398 <!-- ==================== Compilation Control Options ==================== -->
399
400 <!--
401
402 These properties control option settings on the Javac compiler when it
403 is invoked using the <javac> task.
404
405 compile.debug Should compilation include the debug option?
406
407 compile.deprecation Should compilation include the deprecation option?
408
409 compile.optimize Should compilation include the optimize option?
410
411 -->
412
413 <property name="compile.debug" value="true"/>
414 <property name="compile.deprecation" value="true"/>
415 <property name="compile.optimize" value="true"/>
416
417 <!--
418
419 Rather than relying on the CLASSPATH environment variable, Ant includes
420 features that makes it easy to dynamically construct the classpath you
421 need for each compilation. The example below constructs the compile
422 classpath to include the servlet.jar file, as well as the other components
423 that Tomcat makes available to web applications automatically, plus anything
424 that you explicitly added.
425
426 -->
427
428 <!-- All elements that Tomcat 5 exposes to applications -->
429 <path id="tomcat5">
430 <pathelement location="${catalina.home}/common/classes"/>
431 <fileset dir="${catalina.home}/common/endorsed">
432 <include name="*.jar"/>
433 </fileset>
434 <fileset dir="${catalina.home}/common/lib">
435 <include name="*.jar"/>
436 </fileset>
437 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
438 <pathelement location="${catalina.home}/shared/classes"/>
439 <fileset dir="${catalina.home}/shared/lib">
440 <include name="*.jar"/>
441 </fileset>
442 </path>
443
444 <!-- All elements that Tomcat 6 exposes to applications -->
445 <path id="tomcat6">
446 <fileset dir="${catalina.home}/lib">
447 <include name="*.jar"/>
448 </fileset>
449 </path>
450
451 <path id="compile.classpath">
452 <!-- Include all jar files and libraries in our jni lib directory -->
453 <pathelement location="${lib.jni}"/>
454 <fileset dir="${lib.jni}">
455 <include name="*.jar"/>
456 </fileset>
457 <!-- Include all jar files in our web lib directory -->
458 <pathelement location="${web.lib}"/>
459 <fileset dir="${web.lib}">
460 <include name="*.jar"/>
461 </fileset>
462
463 <pathelement location="${lib.java}"/>
464 <fileset dir="${lib.java}">
465 <include name="*.jar"/>
466 </fileset>
467
468 <!-- include the jar files from the source packages -->
469 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
470 so we add them in by name -->
471 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
472 <pathelement location="${lib.jni}/mg.jar"/>
473 <pathelement location="${lib.jni}/mgpp.jar"/>
474
475 <!-- Include all elements that Tomcat exposes to applications -->
476 <path refid="tomcat${tomcat.version.major}"/>
477
478 </path>
479
480 <path id="local.tomcat.classpath">
481 <!-- explicitly include the jni java wrappers in the classpath -->
482 <pathelement location="${lib.jni}"/>
483 <fileset dir="${lib.jni}">
484 <include name="*.jar"/>
485 </fileset>
486 </path>
487
488 <path id="local.tomcat.path">
489 <pathelement location="${basedir}/bin/script"/>
490 <pathelement location="${basedir}/bin"/>
491 <pathelement location="${lib.jni}"/>
492 <pathelement path="${env.PATH}"/>
493 <pathelement path="${env.Path}"/>
494 <pathelement path="${wn.home}/bin"/>
495 </path>
496
497 <target name="test-setup">
498 <echo>ant java version=${ant.java.version}</echo>
499 <echo>is unix : ${current.os.isunix}</echo>
500 <echo>is mac : ${current.os.ismac}</echo>
501 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
502 <echo>is windows : ${current.os.iswindows}</echo>
503 <echo>os.unix: ${os.unix}</echo>
504 </target>
505
506 <!-- ==================== Primary and Global Targets ============================= -->
507
508 <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"
509 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.">
510
511 <!-- make sure .sh files are executable -->
512 <chmod dir="${basedir}" perm="ugo+rx"
513 includes="*.sh"/>
514 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
515 includes="*.sh,*.pl"/>
516 </target>
517
518 <!-- 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 -->
519 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
520 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
521
522 <target name="install-common-src" depends="init"
523 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
524 <antcall target="configure-common-src"/>
525 <antcall target="compile-common-src"/>
526 <antcall target="install-auxiliary-jar-files"/>
527 <antcall target="install-jni-files"/>
528 </target>
529
530 <target name="install-collection-building" depends="init" if="collection.building.enabled"
531 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
532 <antcall target="configure-collection-building"/>
533 <antcall target="tweak-makefiles" />
534 <antcall target="compile-collection-building"/>
535 </target>
536
537
538 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
539 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
540
541 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
542 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
543
544 <target name="configure" depends="init,configure-tomcat,configure-web"
545 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."/>
546
547 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
548 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
549
550 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
551 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
552
553 <target name="update" depends="init,svnupdate,clean,install"
554 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'"/>
555
556
557 <target name="perl-for-building" depends="init">
558 <!-- uses perl.path if set in build.properties, otherwise try for
559 environment variable PERLPATH, and failing that assumes 'perl'
560 is on environment PATH -->
561 <!-- 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 -->
562 <if><bool><available file="${gs2build.home}"/></bool>
563
564 <if><bool><not><isset property="perl.path"/></not></bool>
565
566 <if>
567 <bool>
568 <and>
569 <isset property="env.PERLPATH"/>
570 <not><equals arg1="${env.PERLPATH}" arg2=""/></not>
571 </and>
572 </bool>
573 <property name="perl.path" value="${env.PERLPATH}"/>
574 <else>
575 <echo>
576 Using PATH environment variable to locate Perl.
577 </echo>
578 <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
579 <arg value="perl" />
580 </exec>
581
582 <!-- DOS semi-equivalent of Linux which is "where" which returns lines of matches.
583 Use ant string functions to grab just the first line returned by the DOS where command.
584 Sadly, "where" is not supported by winXP. Using GNUwin32 port of Linux "which" instead.-->
585 <!--<exec executable="where" os="${os.windows}" spawn="false" outputproperty="full.perl.path">
586 <arg value="perl" />
587 </exec>
588
589 <if><bool><istrue value="${current.os.iswindows}"/></bool>
590 <stringutil string="${full.perl.path}" property="full.perl.path">
591 <replace regex="[\n].*$" replacement="" />
592 </stringutil>
593 </if>-->
594 <exec executable="${gs2build.home}/bin/windows/which" os="${os.windows}" spawn="false" outputproperty="full.perl.path">
595 <arg value="perl" />
596 </exec>
597
598 <stringutil string="${full.perl.path}" property="perl.path">
599 <replace regex="\/[^\/]*$" replacement="" />
600 </stringutil>
601 <if><bool><istrue value="${current.os.isunix}"/></bool>
602
603 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
604 <echo>
605 Non-standard location of Perl found: ${full.perl.path}
606 Set the environment variable PERLPATH or the perl.path property in
607 build.properties to explicitly control the version of Perl used.
608 </echo>
609 </if>
610 </if>
611 </else>
612 </if>
613 </if>
614
615 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
616 <if><bool><isset property="perl.path"/></bool>
617 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
618 <else>
619 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
620 </else>
621 </if>
622
623 <!-- gs2build not available, perl.path -->
624 <else>
625 <property name="perl.path" value=""/>
626 </else>
627 </if>
628 </target>
629
630 <target name="start" depends="init,configure-web,start-tomcat"
631 description="Startup the Tomcat server." >
632 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
633 <echo>Tomcat: ${catalina.home}</echo>
634 <echo>Java : ${java.home}</echo>
635 <if><bool><available file="${build.src.home}"/></bool>
636 <echo>Perl : ${full.perl.path}</echo>
637 </if>
638 <if><bool><isset property="install.flax"/></bool>
639 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/flax"/>
640 <else>
641 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/"/>
642 </else>
643 </if>
644 <echo>URL : ${url}</echo>
645 <!-- assuming that index.html is not needed here -->
646 </target>
647
648 <target name="stop" depends="init,stop-tomcat"
649 description="Shutdown the Tomcat server."/>
650
651 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
652
653
654 <!-- =========== Help targets =================================== -->
655
656 <property name="install-command" value="ant [options] prepare install"/>
657
658 <target name="usage" description="Print a help message">
659 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
660 <echo message=" Execute 'ant -help' for Ant help."/>
661 <echo>
662 To install Greenstone3, run '${install-command}'.
663 There are properties defined in build.properties. The install
664 process will ask you if these properties are set correctly.
665 To avoid this prompt, use the '-Dproperties.accepted=yes'
666 option.
667 To log the output, use the '-logfile build.log' option.
668 The README.txt file has more information about the ant targets
669 and install process.
670 </echo>
671 </target>
672
673 <target name="help" depends="usage" description="Print a help message"/>
674
675 <target name="debug" depends="init" description="Display all the currently used properties">
676 <echoproperties/>
677 </target>
678
679 <!-- ====== initialization and setup targets ================== -->
680
681 <target name="accept-properties" unless="properties.accepted">
682 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
683 tomcat.server=${tomcat.server}
684 tomcat.port=${tomcat.port}
685 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
686 proxy.host=${proxy.host}
687 proxy.port=${proxy.port}
688 disable.collection.building=${disable.collection.building}
689 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
690 </input>
691 <condition property="do.abort">
692 <equals arg1="n" arg2="${properties.ok}"/>
693 </condition>
694 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
695 </target>
696
697 <!-- this sets up some initial properties -->
698 <target name="init">
699
700 <!-- has the gs3-setup script been run?? -->
701 <condition property="gs3-setup-not-done">
702 <not>
703 <isset property="env.GSDL3HOME"/>
704 </not>
705 </condition>
706
707 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
708
709 <condition property="java.too.old">
710 <or>
711 <equals arg1="1.1" arg2="${ant.java.version}"/>
712 <equals arg1="1.2" arg2="${ant.java.version}"/>
713 <equals arg1="1.3" arg2="${ant.java.version}"/>
714 </or>
715 </condition>
716 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
717
718 <available file="${basedir}/gli" property="gli.present"/>
719 <available file="${basedir}/common-src" property="common.src.present"/>
720 <available file="${basedir}/gs2build" property="gs2build.present"/>
721
722 <condition property="tomcat.islocal">
723 <or>
724 <not><isset property="tomcat.installed.path"/></not>
725 <equals arg1="" arg2="${tomcat.installed.path}"/>
726 </or>
727 </condition>
728
729 <echo>tomcat.port = ${tomcat.port}</echo>
730
731 <condition property="proxy.present">
732 <and>
733 <isset property="proxy.host"/>
734 <not><equals arg1="" arg2="${proxy.host}"/></not>
735 </and>
736 </condition>
737
738 <!--
739 the next block checks if the bundled tomcat is present in the 'packages' directory,
740 and checks for the lethal combination of tomcat 6 and java 1.4. Test for
741 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
742 download, as there is no other surefire way to check tomcat version under java 1.4
743 -->
744 <condition property="packages.tomcat.ispresent" value="true" else="false">
745 <available file="packages/tomcat"/>
746 </condition>
747 <condition property="packages.tomcat.istomcat6" value="true" else="false">
748 <available file="packages/tomcat/tomcat6.txt"/>
749 </condition>
750 <if>
751 <bool>
752 <and>
753 <istrue value="${packages.tomcat.ispresent}"/>
754 <istrue value="${packages.tomcat.istomcat6}"/>
755 <equals arg1="1.4" arg2="${ant.java.version}"/>
756 </and>
757 </bool>
758 <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>
759 </if>
760
761 </target>
762
763 <target name="setup-proxy" depends="init" if="proxy.present">
764 <condition property="ask.user">
765 <or>
766 <equals arg1="" arg2="${proxy.user}"/>
767 <equals arg1="" arg2="${proxy.password}"/>
768 </or>
769 </condition>
770
771 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
772 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
773 </target>
774
775 <!-- ========== Web app Targets ================================ -->
776
777 <target name="prepare-web" depends="init">
778 <mkdir dir="${web.home}/applet"/>
779 <mkdir dir="${web.home}/logs"/>
780 </target>
781
782 <!-- 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 -->
783 <target name="configure-java-version" depends="init"
784 description="Activates or deactivates some jar libraries as needed depending on your java version">
785
786 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
787 <condition property="need.xalan.jar">
788 <or>
789 <equals arg1="1.5" arg2="${ant.java.version}"/>
790 <equals arg1="1.6" arg2="${ant.java.version}"/>
791 </or>
792 </condition>
793
794 <!-- if they have xalan.jar but dont need it -->
795 <if>
796 <bool>
797 <and>
798 <isset property="have.xalan.jar"/>
799 <not><isset property="need.xalan.jar"/></not>
800 </and>
801 </bool>
802 <antcall target="deactivate-xalan-jar"/>
803 </if>
804
805 <!-- if they need xalan.jar but dont have it -->
806 <if>
807 <bool>
808 <and>
809 <not><isset property="have.xalan.jar"/></not>
810 <isset property="need.xalan.jar"/>
811 </and>
812 </bool>
813 <antcall target="activate-xalan-jar"/>
814 </if>
815
816 </target>
817
818 <target name="activate-xalan-jar">
819 <echo>activating xalan.jar</echo>
820 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
821 <if>
822 <bool>
823 <and>
824 <isset property="current.os.ismac"/>
825 <available file="${catalina.home}/common/endorsed" type="dir"/>
826 </and>
827 </bool>
828 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
829 </if>
830 </target>
831
832 <target name="deactivate-xalan-jar">
833 <echo>deactivating xalan.jar</echo>
834 <delete file="${web.lib}/xalan.jar"/>
835 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
836 </target>
837
838
839 <target name="prepare-collections" depends="init">
840 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
841 <property name="index.zip" value="index.zip"/>
842
843 <echo message="installing collections..."/>
844 <antcall target="gs2mgdemo-install"/>
845 <antcall target="gs2mgppdemo-install"/>
846 <antcall target="gberg-install"/>
847 </target>
848
849 <target name="gs2mgdemo-prepare" if="collect.dir">
850 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
851
852 <condition property="gs2mgdemo.present">
853 <and>
854 <available file="${gs2mgdemo.dir}/${index.zip}"/>
855 </and>
856 </condition>
857 </target>
858
859 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
860 <echo> installing gs2mgdemo</echo>
861 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
862 <echo>collection gs2mgdemo installed</echo>
863 </target>
864
865 <target name="gs2mgppdemo-prepare" if="collect.dir">
866 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
867
868 <condition property="gs2mgppdemo.present">
869 <and>
870 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
871 </and>
872 </condition>
873 </target>
874
875 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
876 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
877 <echo>collection gs2mgppdemo installed</echo>
878 </target>
879
880 <target name="gberg-prepare" if="collect.dir">
881 <property name="gberg.dir" value="${collect.dir}/gberg"/>
882 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
883 </target>
884
885 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
886 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
887 <echo>collection gberg installed</echo>
888 </target>
889
890 <target name="configure-web" depends="init,perl-for-building"
891 description="Configure only the web app config files">
892 <!-- we want a unix path in the global.properties file -->
893 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
894 <path path="${web.home}"/>
895 </pathconvert>
896 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
897 <filter token="gsdl3version" value="${app.version}"/>
898 <filter token="tomcat.server" value="${tomcat.server}"/>
899 <filter token="tomcat.port" value="${tomcat.port}"/>
900 <filter token="perlpath" value="${perl.path}"/>
901 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
902 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
903 <chmod file="${web.classes}/global.properties" perm="600"/>
904 <chmod file="${web.classes}/log4j.properties" perm="600"/>
905 </target>
906
907 <target name="compile-web" depends="init">
908 <javac srcdir="${web.classes}"
909 destdir="${web.classes}"
910 debug="${compile.debug}"
911 deprecation="${compile.deprecation}"
912 optimize="${compile.optimize}">
913 <classpath><path refid="compile.classpath"/></classpath>
914 </javac>
915 </target>
916
917 <target name="compile-classpath-jars" depends="init">
918 <if><bool><available file="admin/cp.mf"/></bool>
919 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
920 </if>
921 <if><bool><available file="${lib.java}/cp.mf"/></bool>
922 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
923 </if>
924 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
925 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
926 </if>
927 <if><bool><available file="${web.lib}/cp.mf"/></bool>
928 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
929 </if>
930 <jar destfile="cp.jar">
931 <manifest>
932 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
933 </manifest>
934 </jar>
935 </target>
936
937 <target name="clean-classpath-jars" depends="init">
938 <delete file="admin/cp.jar"/>
939 <delete file="${lib.java}/cp.jar"/>
940 <delete file="${lib.jni}/cp.jar"/>
941 <delete file="${web.lib}/cp.jar"/>
942 <delete file="cp.jar"/>
943 </target>
944
945
946 <target name="svnupdate-web" unless="nosvn.mode">
947 <exec executable="svn">
948 <arg value="update"/>
949 <arg value="${web.home}"/>
950 <arg value="-r"/><arg value="${branch.revision}"/>
951 </exec>
952 </target>
953
954 <target name="update-web" depends="init,svnupdate-web,configure-web"
955 description="update only the web stuff (config files)"/>
956
957 <!-- ======================= Tomcat Targets ========================== -->
958
959 <!-- this target downloads and installs Tomcat -->
960 <!-- we download tomcat (version 6 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
961 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
962 description="downloads the appropriate version of Tomcat (Tomcat 5 if using Java 1.4, Tomcat 6 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/6 then you need to run prepare-tomcat">
963 <if>
964 <bool>
965 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
966 </bool>
967
968 <!-- check that packages dir is there -->
969 <mkdir dir="${packages.home}"/>
970 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
971 dest="${packages.home}/${tomcat.version}.zip"
972 usetimestamp="true"/>
973 <unzip src="${packages.home}/${tomcat.version}.zip"
974 dest="${packages.home}"/>
975
976 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
977 we would need to have the tomcat compat package to work with Java 1.4-->
978 <if>
979 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
980 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
981 dest="${packages.home}/${tomcat.version}-compat.zip"
982 usetimestamp="true"/>
983 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
984 dest="${packages.home}"/>
985 </if>
986
987 <!-- delete any existing tomcat -->
988 <delete dir="${packages.home}/tomcat"/>
989 <move todir="${packages.home}/tomcat">
990 <fileset dir="${packages.home}/${tomcat.version}"/>
991 </move>
992 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
993 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
994 overwrite="true"/>
995 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
996 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
997 overwrite="true"/>
998 <!-- make sure we have execute permission for the .sh files -->
999 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
1000 includes="*.sh"/>
1001
1002 <echo file="${packages.home}/tomcat/.flagfile">
1003 the timestamp of this file is the time that tomcat was extracted from the zip files.
1004 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
1005 </echo>
1006
1007 <!-- this is not strictly a prepare tomcat thing, but if one changes
1008 Java, then they need to change tomcat as well, so might as well call
1009 it here -->
1010 <antcall target="configure-java-version"/>
1011 <else>
1012 <echo>Tomcat has been prepared, will not prepare</echo>
1013 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
1014 </else>
1015
1016 </if>
1017
1018 </target>
1019
1020 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1021
1022 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
1023 <!-- re-setup the server.xml file -->
1024 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
1025 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
1026 <filterset>
1027 <filter token="port" value="${tomcat.port}"/>
1028 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
1029 </filterset>
1030 </copy>
1031 <!-- set up the greenstone3 context -->
1032 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
1033 <filterset>
1034 <filter token="gsdl3webhome" value="${web.home}"/>
1035 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
1036 </filterset>
1037 </copy>
1038 </target>
1039
1040 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
1041 <!-- re-setup the server.xml file -->
1042 <!-- need to edit the config file, or do we get the user to do this???-->
1043 </target>
1044
1045
1046
1047<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
1048 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
1049 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
1050 <property name="tomcat.path" refid="local.tomcat.path"/>
1051 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
1052 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1053 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1054 <env key="GSDL3HOME" value="${basedir}"/>
1055 <env key="PATH" path="${tomcat.path}"/>
1056 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1057 <env key="CATALINA_HOME" value="${catalina.home}"/>
1058 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1059 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
1060 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
1061 <env key="WNHOME" path="${wn.home}"/>
1062 </exec>
1063 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
1064 <env key="GSDLOS" value="windows"/>
1065 <env key="GSDL3HOME" value="${basedir}"/>
1066 <env key="Path" path="${tomcat.path}"/>
1067 <env key="PATH" path="${tomcat.path}"/>
1068 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1069 <env key="CATALINA_HOME" value="${catalina.home}"/>
1070 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1071 </exec>
1072 <!-- wait for the server to startup in case other targets need it running -->
1073 <waitfor maxwait="5" maxwaitunit="second">
1074 <and>
1075 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1076 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
1077 </and>
1078 </waitfor>
1079 </target>
1080
1081 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
1082 <target name="reconfigure" description="Reconfigure the message router">
1083 <waitfor maxwait="5" maxwaitunit="second">
1084 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
1085 </waitfor>
1086 </target>
1087
1088 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
1089 <target name="reconfigure-collection" description="Reconfigure the collection">
1090 <waitfor maxwait="5" maxwaitunit="second">
1091 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
1092 </waitfor>
1093 </target>
1094
1095 <!-- windows: do we want to launch a webrowser?? -->
1096 <!-- shouldn't this test whether anything is running first? -->
1097 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
1098 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1099 <env key="CATALINA_HOME" value="${catalina.home}"/>
1100 </exec>
1101 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
1102 <env key="CATALINA_HOME" value="${catalina.home}"/>
1103 </exec>
1104 </target>
1105
1106 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
1107
1108 <target name="setup-catalina-ant-tasks">
1109 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
1110 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
1111 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1112 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
1113 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1114 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
1115 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1116 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
1117 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1118 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
1119 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1120 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
1121 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1122 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
1123 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1124 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
1125 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1126 </target>
1127
1128
1129 <!-- ======================= ant Targets ============================ -->
1130 <target name="prepare-ant" depends="init">
1131 <if>
1132 <bool>
1133 <not><available file="${packages.home}/ant/.flagfile"/></not>
1134 </bool>
1135
1136 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1137 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1138 usetimestamp="true"/>
1139 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1140 dest="${packages.home}"/>
1141 <move todir="${packages.home}/ant">
1142 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1143 </move>
1144 <echo file="${packages.home}/ant/.flagfile">
1145 the timestamp of this file is the time that ant was extracted from the zip files.
1146 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1147 </echo>
1148
1149 <else>
1150 <echo>Ant has been prepared, will not prepare</echo>
1151 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1152 </else>
1153
1154 </if>
1155 </target>
1156
1157 <!-- ======================= Axis Targets ============================ -->
1158
1159 <target name="prepare-axis" depends="init">
1160
1161 <if>
1162 <bool>
1163 <not><available file="${packages.home}/axis/.flagfile"/></not>
1164 </bool>
1165
1166 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1167 dest="${packages.home}/${axis.zip.version}"
1168 usetimestamp="true"/>
1169 <unzip src="${packages.home}/${axis.zip.version}"
1170 dest="${packages.home}"/>
1171 <move todir="${packages.home}/axis">
1172 <fileset dir="${packages.home}/${axis.dir.version}"/>
1173 </move>
1174 <!-- install axis into greenstone web app -->
1175 <copy todir="${web.lib}">
1176 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1177 <include name="*.jar"/>
1178 </fileset>
1179 </copy>
1180 <copy todir="${web.home}">
1181 <fileset dir="${packages.home}/axis/webapps/axis/">
1182 <include name="*.jsp"/>
1183 <include name="*.jws"/>
1184 </fileset>
1185 </copy>
1186 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1187 <copy todir="${web.classes}">
1188 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1189 <include name="*.properties"/>
1190 </fileset>
1191 </copy>
1192 <echo file="${packages.home}/axis/.flagfile">
1193 the timestamp of this file is the time that axis was extracted from the zip files.
1194 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1195 </echo>
1196
1197 <else>
1198 <echo>Axis has been prepared, will not prepare</echo>
1199 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1200 </else>
1201
1202 </if>
1203 </target>
1204
1205 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
1206 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
1207
1208 <target name="deploy-site">
1209 <java classname="org.apache.axis.client.AdminClient">
1210 <classpath refid="compile.classpath"/>
1211 <arg value="-l"/>
1212 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1213 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1214 </java>
1215 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
1216 </target>
1217
1218 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
1219 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
1220 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1221 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1222 tofile="${basedir}/resources/soap/undeploy.wsdd"
1223 filtering="true"
1224 overwrite="true"/>
1225 <java classname="org.apache.axis.client.AdminClient">
1226 <classpath refid="compile.classpath"/>
1227 <arg value="-l"/>
1228 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1229 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
1230 </java>
1231 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
1232 </target>
1233
1234 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1235 with the default servicename of localsite-->
1236 <target name="deploy-localsite" depends="init"
1237 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1238 <antcall target="start-tomcat"/>
1239 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
1240 <antcall target="create-deployment-files">
1241 <param name="axis.sitename" value="localsite"/>
1242 <param name="axis.servicesname" value="${base.webservice.name}"/>
1243 <param name="axis.siteuri" value="localsite"/>
1244 </antcall>
1245 <antcall target="deploy-site">
1246 <param name="axis.sitename" value="localsite"/>
1247 <param name="axis.servicesname" value="${base.webservice.name}"/>
1248 <param name="axis.siteuri" value="localsite"/>
1249 </antcall>
1250 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
1251 </target>
1252
1253 <target name="get-sitename" unless="axis.sitename">
1254 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
1255Press Enter for default:localsite</input>
1256 </target>
1257
1258 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1259 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1260To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1261Or press Enter for undeploying the default:localsite /&gt;</input>
1262 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1263 </target>
1264
1265 <target name="get-webservices" unless="axis.servicesname">
1266 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1267Choose from: ${web.services.list}
1268Or press Enter for default:${base.webservice.name} /&gt;</input>
1269 <echo>${axis.servicesname}</echo>
1270 </target>
1271
1272 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1273 <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>
1274 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1275 </target>
1276
1277 <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">
1278 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1279 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1280 </condition>
1281
1282 <!--everything else defaults to java:RPC at present-->
1283 <condition property="soap.method" value="provider='java:RPC'">
1284 <not>
1285 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1286 </not>
1287 </condition>
1288 </target>
1289
1290 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1291 <filter token="sitename" value="${axis.sitename}"/>
1292 <filter token="siteuri" value="${axis.siteuri}"/>
1293 <filter token="servicesname" value="${axis.servicesname}"/>
1294 <filter token="soapmethod" value="${soap.method}"/>
1295 <copy file="${basedir}/resources/soap/site.wsdd.template"
1296 tofile="${basedir}/resources/soap/deploy.wsdd"
1297 filtering="true"
1298 overwrite="true"/>
1299 <!-- create the java files and compile them -->
1300 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1301 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1302 filtering="true"
1303 overwrite="true"/>
1304 <mkdir dir="${build.home}"/>
1305 <javac srcdir="${src.home}"
1306 destdir="${build.home}"
1307 debug="${compile.debug}"
1308 deprecation="${compile.deprecation}"
1309 optimize="${compile.optimize}">
1310 <classpath refid="compile.classpath"/>
1311 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1312 </javac>
1313 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1314 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1315 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1316 overwrite="true" />
1317 </target>
1318
1319
1320 <!-- ====================== Core targets ============================== -->
1321 <!-- core targets refer to the core gsdl3 java src -->
1322
1323 <target name="prepare-core"/>
1324
1325 <target name="configure-core"/>
1326
1327 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1328 description="Update only the Greenstone core" />
1329
1330 <target name="svnupdate-core" unless="nosvn.mode">
1331 <exec executable="svn">
1332 <arg value="update"/>
1333 <arg value="${basedir}"/>
1334 <arg value="-r"/><arg value="${branch.revision}"/>
1335 </exec>
1336 </target>
1337
1338 <target name="clean-core"
1339 description="Clean only the Greenstone core">
1340 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1341 <delete dir="${build.home}"/>
1342 </target>
1343
1344 <target name="compile-core" depends="init"
1345 description="Compile only the Greenstone core">
1346 <mkdir dir="${build.home}"/>
1347 <if><bool><isset property="with.jni"/></bool>
1348 <javac srcdir="${src.home}"
1349 destdir="${build.home}"
1350 debug="${compile.debug}"
1351 deprecation="${compile.deprecation}"
1352 optimize="${compile.optimize}">
1353 <classpath>
1354 <path refid="compile.classpath"/>
1355 </classpath>
1356 </javac>
1357 <else>
1358 <property name="gsprefix" value=""/>
1359 <javac srcdir="${src.home}"
1360 destdir="${build.home}"
1361 debug="${compile.debug}"
1362 deprecation="${compile.deprecation}"
1363 optimize="${compile.optimize}">
1364 <classpath>
1365 <path refid="compile.classpath"/>
1366 </classpath>
1367 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1368 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1369 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1370 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1371 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1372 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1373 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1374 </javac>
1375 </else>
1376 </if>
1377 <jar destfile="${build.home}/gsdl3.jar">
1378 <fileset dir="${build.home}">
1379 <include name="org/greenstone/gsdl3/**"/>
1380 <include name="org/flax/**"/>
1381 <exclude name="**/Test.class"/>
1382 </fileset>
1383 <manifest>
1384 <attribute name="Built-By" value="${user.name}" />
1385 </manifest>
1386 </jar>
1387 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1388
1389 <jar destfile="${build.home}/gutil.jar">
1390 <fileset dir="${build.home}">
1391 <include name="org/greenstone/util/**"/>
1392 </fileset>
1393 <manifest>
1394 <attribute name="Built-By" value="${user.name}" />
1395 </manifest>
1396 </jar>
1397 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1398
1399 <!-- copy the localsite server in case we need it -->
1400 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1401
1402 <!-- Greenstone Administrator Interface -->
1403 <jar destfile="${build.home}/GAI.jar">
1404 <fileset dir="${build.home}">
1405 <include name="org/greenstone/admin/**"/>
1406 </fileset>
1407 <manifest>
1408 <attribute name="Built-By" value="${user.name}" />
1409 </manifest>
1410 </jar>
1411 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1412 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1413 <jar destfile="${build.home}/phind.jar">
1414 <fileset dir="${build.home}">
1415 <include name="org/greenstone/applet/phind/**"/>
1416 </fileset>
1417 <manifest>
1418 <attribute name="Built-By" value="${user.name}" />
1419 </manifest>
1420 </jar>
1421 <mkdir dir="${web.applet}"/>
1422 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1423 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1424 <if>
1425 <bool><istrue value="${tomcat.islocal}"/></bool>
1426 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1427 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1428 </if>
1429
1430
1431 <!-- skip anttasks for now
1432 <jar destfile="${build.home}/anttasks.jar">
1433 <fileset dir="${build.home}">
1434 <include name="org/greenstone/anttasks/**"/>
1435 </fileset>
1436 <manifest>
1437 <attribute name="Built-By" value="${user.name}" />
1438 </manifest>
1439 </jar>
1440 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1441 <jar destfile="${build.home}/gsdl3test.jar">
1442 <fileset dir="${build.home}">
1443 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1444 <include name="org/greenstone/testing/**"/>
1445 </fileset>
1446 <manifest>
1447 <attribute name="Built-By" value="${user.name}" />
1448 </manifest>
1449 </jar>
1450 <jar destfile="${build.home}/server.jar">
1451 <fileset dir="${build.home}">
1452 <include name="org/greenstone/server/**"/>
1453 <include name="org/greenstone/util/**"/>
1454 </fileset>
1455 <fileset file="${basedir}/resources/java/server.properties"/>
1456 <manifest>
1457 <attribute name="Built-By" value="${user.name}"/>
1458 </manifest>
1459 </jar>
1460 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1461 </target>
1462
1463 <!-- ================== Packages targets ================================ -->
1464 <!-- these targets refer to the greenstone source packages - these need
1465 updating less often, so are in separate targets to the core -->
1466 <target name="prepare-packages" depends="init"/>
1467
1468 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1469 description="Update only the source packages"/>
1470
1471 <target name="svnupdate-packages" unless="nosvn.mode">
1472 <exec executable="svn">
1473 <arg value="update"/>
1474 <arg value="${src.packages.home}"/>
1475 <arg value="-r"/><arg value="${branch.revision}"/>
1476 </exec>
1477 </target>
1478
1479
1480 <target name="configure-packages" depends="init,configure-javagdbm"
1481 description="Configure only the packages."/>
1482
1483 <target name="configure-javagdbm" if="with.jni">
1484 <echo>
1485 Configuring JavaGDBM
1486 </echo>
1487
1488 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1489 <arg value="--prefix=${basedir}"/>
1490 <arg value="--libdir=${lib.jni}"/>
1491 <arg value="--with-gdbm=${gdbm.home}"/>
1492 </exec>
1493 </target>
1494
1495 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1496
1497 <target name="clean-javagdbm" depends="init">
1498 <exec executable="make" os="${os.unix}"
1499 dir="${javagdbm.home}" failonerror="true">
1500 <arg value="clean"/>
1501 </exec>
1502 </target>
1503
1504 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1505
1506 <target name="distclean-javagdbm" depends="init">
1507 <exec executable="make" os="${os.unix}"
1508 dir="${javagdbm.home}" failonerror="true">
1509 <arg value="distclean"/>
1510 </exec>
1511 </target>
1512
1513 <target name="compile-packages" description="Compile only the source packages">
1514 <!-- javagdbm -->
1515 <antcall target="compile-javagdbm"/>
1516 <!-- Search4j -->
1517 <antcall target="compile-search4j"/>
1518 </target>
1519
1520 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
1521
1522 <!-- unix: -->
1523 <echo>compile javagdbm</echo>
1524 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1525 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1526 <arg value="install"/>
1527 </exec>
1528
1529 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1530 "all" which will then perform both the compile AND link targets in jni/win32.mak
1531 (thereby also generating gdbmjava.dll). Then we run the same command with
1532 the "install" argument to copy the gdbmjava.dll into the correct location. -->
1533 <echo>Windows: compile javagdbm</echo>
1534 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1535 <env key="GSDLHOME" path="${gs2build.home}"/>
1536 </exec>
1537 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1538 <env key="GSDLHOME" path="${gs2build.home}"/>
1539 <arg value="install"/>
1540 </exec>
1541
1542 <!-- install the jar file -->
1543 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
1544 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1545 </target>
1546
1547 <target name="compile-search4j">
1548
1549 <!-- windows -->
1550 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1551 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1552 <arg value="/f"/>
1553 <arg value="win32.mak"/>
1554 <arg value='BINDIR="${basedir}\bin"'/>
1555 </exec>
1556 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1557 <arg value="/f"/>
1558 <arg value="win32.mak"/>
1559 <arg value="install"/>
1560 <arg value='BINDIR="${basedir}\bin"'/>
1561 </exec>
1562
1563 <!-- unix -->
1564 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1565 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1566 <arg value="--bindir=${basedir}/bin"/>
1567 <arg value="${static.arg}"/>
1568 </exec>
1569 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1570 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1571 <arg value="install"/>
1572 </exec>
1573
1574 <!-- else warn -->
1575 <else>
1576 <fail>this target does not support the current os</fail>
1577
1578 </else></if></else></if>
1579
1580 </target>
1581
1582 <target name="install-auxiliary-jar-files" depends="init">
1583
1584 <if>
1585 <bool><available file="${mg.home}/mg.jar"/></bool>
1586 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1587 </if>
1588
1589 <if>
1590 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
1591 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1592 </if>
1593
1594 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1595 </target>
1596
1597 <target name="install-jni-files" depends="init" if="with.jni">
1598 <antcall target="install-jni-files-linux"/>
1599 <antcall target="install-jni-files-windows"/>
1600 <antcall target="install-jni-files-macos"/>
1601 </target>
1602
1603 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1604 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1605 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1606 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1607 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1608 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1609 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1610 </target>
1611 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1612 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1613 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1614 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1615 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1616 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1617 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1618 </target>
1619 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1620 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1621 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1622 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1623 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1624 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1625 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1626 </target>
1627
1628 <!-- ========common-src targets =================================-->
1629 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1630 collection building is not enabled -->
1631
1632 <target name="update-common-src" depends="init" if="collection.building.disabled">
1633 </target>
1634
1635 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1636 <exec executable="svn">
1637 <arg value="update"/>
1638 <arg value="${common.src.home}"/>
1639 <arg value="-r"/><arg value="${branch.revision}"/>
1640 </exec>
1641 </target>
1642
1643 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1644 <antcall target="checkout-common-src"/>
1645 <antcall target="unzip-windows-packages"/>
1646 </target>
1647
1648 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1649 <echo>checking out common-src</echo>
1650 <exec executable="svn">
1651 <arg value="checkout"/>
1652 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
1653 <arg value="common-src"/>
1654 <arg value="-r"/><arg value="${branch.revision}"/>
1655 </exec>
1656 </target>
1657
1658 <target name="configure-common-src" depends="init">
1659 <exec executable="${common.src.home}/configure" os="${os.unix}"
1660 dir="${common.src.home}" failonerror="true">
1661 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1662 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1663 <arg line="${gs2.opt.args}"/>
1664 <arg line="${static.arg}"/>
1665 <arg line="${allargs}"/>
1666 </exec>
1667 </target>
1668
1669 <target name="clean-common-src" depends="init">
1670 <!-- unix: -->
1671 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1672 <arg value="clean"/>
1673 </exec>
1674 <!-- windows: -->
1675 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1676 <arg value="/f"/>
1677 <arg value="win32.mak"/>
1678 <arg value="clean"/>
1679 <arg value="GSDLHOME=${gs2build.home}"/>
1680 </exec>
1681 </target>
1682 <target name="distclean-common-src" depends="init">
1683 <!-- unix: -->
1684 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1685 <arg value="distclean"/>
1686 </exec>
1687 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1688 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1689 <arg value="/f"/>
1690 <arg value="win32.mak"/>
1691 <arg value="clean"/>
1692 <arg value="GSDLHOME=${gs2build.home}"/>
1693 </exec>
1694 </target>
1695 <target name="compile-common-src" depends="init">
1696 <!-- unix: -->
1697 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1698 <arg value="${gs2.compile.target}"/>
1699 </exec>
1700 <!-- windows: -->
1701 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1702 <arg value="/f"/>
1703 <arg value="win32.mak"/>
1704 <arg value="GSDLHOME=${gs2build.home}"/>
1705 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1706 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1707 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1708 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1709 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1710 </exec>
1711 </target>
1712
1713 <!-- ======= collection-building targets ===========================-->
1714
1715 <target name="update-collection-building" if="collection.building.enabled"
1716 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"
1717 description="Update (SVN update, configure, compile etc) only the collection building components"/>
1718
1719 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1720 description="SVN update the collection building components">
1721 </target>
1722
1723 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1724 </target>
1725
1726 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1727 description="Configure the collection building components">
1728 </target>
1729
1730 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1731 description="Clean only the collection building components"
1732 if="collection.building.enabled"/>
1733
1734 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1735 description="Distclean only the collection building components"
1736 if="collection.building.enabled"/>
1737
1738 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1739 description="Compile only the collection building components">
1740 <!-- make install for common-src -->
1741 <!-- unix: -->
1742 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1743 <arg value="${gs2.install.target}"/>
1744 </exec>
1745
1746 <!-- windows: -->
1747 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1748 <arg value="/f"/>
1749 <arg value="win32.mak"/>
1750 <arg value="install"/>
1751 <arg value="GSDLHOME=${gs2build.home}"/>
1752 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1753 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1754 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1755 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1756 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1757 <!--
1758 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1759 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
1760 </exec>
1761
1762 <!-- install gs2build indexers for windows -->
1763 <if>
1764 <bool><istrue value="${current.os.iswindows}"/></bool>
1765 <copy todir="${gs2build.home}/bin/windows">
1766 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1767 <include name="*.*"/>
1768 </fileset>
1769 </copy>
1770 </if>
1771
1772 <!-- LuceneWrapper jar file not installed by default -->
1773 <mkdir dir="${gs2build.home}/bin/java"/>
1774 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1775
1776 </target>
1777
1778 <!-- ============== gli targets ================================= -->
1779 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1780
1781 <exec executable="svn">
1782 <arg value="update"/>
1783 <arg value="${gli.home}"/>
1784 <arg value="-r"/><arg value="${branch.revision}"/>
1785 </exec>
1786
1787 <exec executable="svn" dir="web/WEB-INF/cgi">
1788 <arg value="export"/>
1789 <arg value="-r"/><arg value="${branch.revision}"/>
1790 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gliserver.pl"/>
1791 </exec>
1792 <exec executable="svn" dir="web/WEB-INF/cgi">
1793 <arg value="export"/>
1794 <arg value="-r"/><arg value="${branch.revision}"/>
1795 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gsdlCGI.pm"/>
1796 </exec>
1797
1798 </target>
1799
1800 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1801 <!-- checkout -->
1802 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
1803
1804 <exec executable="svn">
1805 <arg value="checkout"/>
1806 <arg value="${svn.root}/main/${branch.path}/gli"/>
1807 <arg value="-r"/><arg value="${branch.revision}"/>
1808 </exec>
1809
1810 <exec executable="svn" dir="web/WEB-INF/cgi">
1811 <arg value="export"/>
1812 <arg value="-r"/><arg value="${branch.revision}"/>
1813 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gliserver.pl"/>
1814 </exec>
1815 <exec executable="svn" dir="web/WEB-INF/cgi">
1816 <arg value="export"/>
1817 <arg value="-r"/><arg value="${branch.revision}"/>
1818 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gsdlCGI.pm"/>
1819 </exec>
1820
1821 </if>
1822 </target>
1823
1824 <target name="clean-gli" depends="init" if="collection.building.enabled">
1825 <!-- gli -->
1826 <property name="gli.home" value="${basedir}/gli"/>
1827 <!-- linux -->
1828 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1829 resolveExecutable="true" failonerror="true"/>
1830 <!-- windows -->
1831 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1832 resolveExecutable="true" failonerror="true"/>
1833 </target>
1834
1835 <target name="compile-gli" depends="init" if="collection.building.enabled">
1836 <if><bool><isset property="with.gli.and.gems"/></bool>
1837 <!-- gli -->
1838 <property name="gli.home" value="${basedir}/gli"/>
1839
1840 <!-- linux -->
1841 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
1842 <!--remote gli-->
1843 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1844 resolveExecutable="true" failonerror="true"/>
1845 <!-- windows -->
1846 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
1847 <!--remote gli-->
1848 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1849 resolveExecutable="true" failonerror="true"/>
1850 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1851 </if>
1852 </target>
1853
1854 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1855 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1856 <env key="gsdl3path" path="${basedir}"/>
1857 <env key="gsdlpath" path="${gs2build.home}"/>
1858 </exec>
1859 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1860 <env key="gsdl3path" path="${basedir}"/>
1861 <env key="gsdlpath" path="${gs2build.home}"/>
1862 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
1863 </exec>
1864 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1865 <env key="GSDL3PATH" path="${basedir}"/>
1866 <env key="GSDLPATH" path="${gs2build.home}"/>
1867 </exec>
1868 <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.
1869 </echo>
1870 </target>
1871
1872 <!-- ================ gs2build targets =========================== -->
1873
1874 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1875 <echo>svn updating gs2build</echo>
1876 <exec executable="svn">
1877 <arg value="update"/>
1878 <arg value="${gs2build.home}"/>
1879 <arg value="-r"/><arg value="${branch.revision}"/>
1880 </exec>
1881 </target>
1882
1883 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1884 <antcall target="checkout-gs2build"/>
1885 <antcall target="unzip-windows-packages"/>
1886 <antcall target="checkout-winbin"/>
1887 <antcall target="get-windows-binaries"/>
1888 <antcall target="delete-winbin"/>
1889 </target>
1890
1891 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1892 <echo>checking out gs2build</echo>
1893 <exec executable="svn">
1894 <arg value="checkout"/>
1895 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
1896 <arg value="-r"/><arg value="${branch.revision}"/>
1897 </exec>
1898
1899
1900 </target>
1901
1902 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1903 unless="nosvn.mode">
1904
1905 <exec executable="svn">
1906 <arg value="checkout"/>
1907 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
1908 <arg value="-r"/><arg value="${branch.revision}"/>
1909 <arg value="winbin"/>
1910 </exec>
1911
1912 </target>
1913
1914 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1915 <exec executable="svn">
1916 <arg value="update"/>
1917 <arg value="winbin"/>
1918 <arg value="-r"/><arg value="${branch.revision}"/>
1919 </exec>
1920
1921 </target>
1922
1923 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1924 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1925 <fileset dir="${basedir}/winbin/bin"/>
1926 </move>
1927 </target>
1928
1929 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1930 <delete dir="${basedir}/winbin"/>
1931 </target>
1932
1933 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
1934 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
1935 dest="${common.src.home}/packages/windows/crypt"/>
1936 <untar compression="gzip"
1937 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
1938 dest="${common.src.home}/packages/sqlite"/>
1939 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
1940 dest="${common.src.home}/indexers/packages/windows/iconv"/>
1941 </target>
1942
1943 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1944 <!-- we want a windows path in the setup.bat file -->
1945 <pathconvert targetos="windows" property="gs2build.home.windows">
1946 <path path="${gs2build.home}"/>
1947 </pathconvert>
1948 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1949 <filterset>
1950 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1951 </filterset>
1952 </move>
1953 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1954 </target>
1955
1956
1957 <target name="clean-build-src" depends="init" if="collection.building.enabled">
1958 <!-- unix: -->
1959 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1960 <arg value="clean"/>
1961 </exec>
1962 <!-- windows: -->
1963 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1964 <arg value="/f"/>
1965 <arg value="win32.mak"/>
1966 <arg value="clean"/>
1967 <arg value="GSDLHOME=${gs2build.home}"/>
1968 </exec>
1969 </target>
1970
1971
1972 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
1973 <!-- unix: -->
1974 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1975 <arg value="distclean"/>
1976 </exec>
1977 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1978 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1979 <arg value="/f"/>
1980 <arg value="win32.mak"/>
1981 <arg value="clean"/>
1982 <arg value="GSDLHOME=${gs2build.home}"/>
1983 </exec>
1984 </target>
1985
1986 <target name="configure-build-src" depends="init" if="collection.building.enabled"
1987 description="Configure the build-src component">
1988 <exec executable="${build.src.home}/configure" os="${os.unix}"
1989 dir="${build.src.home}" failonerror="true">
1990 <arg value="--prefix=${gs2build.home}"/>
1991 <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
1992 </exec>
1993 </target>
1994
1995 <!-- common-src is done separately and needs to be compiled first -->
1996 <target name="compile-build-src" depends="init" if="collection.building.enabled">
1997
1998 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
1999 <arg line="${ldlpath.arg}"/>
2000 </exec>
2001
2002 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2003 <arg value="install"/>
2004 </exec>
2005
2006 <!-- run the setup script -->
2007 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
2008 <!--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-->
2009 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2010 <arg value="/f"/>
2011 <arg value="win32.mak"/>
2012 <arg value="GSDLHOME=${gs2build.home}"/>
2013 </exec>
2014 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2015 <arg value="/f"/>
2016 <arg value="win32.mak"/>
2017 <arg value="install"/>
2018 <arg value="GSDLHOME=${gs2build.home}"/>
2019 </exec>
2020 </target>
2021
2022
2023 <!-- ======================== TESTING Targets ========================= -->
2024
2025 <target name="test" description="Run the (incomplete) JUnit test suite "
2026 depends="init">
2027 <mkdir dir="${basedir}/test"/>
2028 <junit printsummary="withOutAndErr"
2029 errorproperty="test.failed"
2030 failureproperty="test.failed"
2031 fork="${junit.fork}">
2032 <formatter type="plain"/>
2033 <classpath>
2034 <pathelement location="${build.home}/gsdl3test.jar"/>
2035 <path refid="compile.classpath"/>
2036 </classpath>
2037 <test name="${testcase}" if="testcase"/>
2038 <batchtest todir="${basedir}/test" unless="testcase">
2039 <fileset dir="${build.home}" includes="**/*Test.class" />
2040 </batchtest>
2041 </junit>
2042 <echo>
2043 *********************************************
2044 Test output can be found in directory 'test'
2045 *********************************************
2046 </echo>
2047 </target>
2048
2049 <!-- ======================== FLAX Targets ========================= -->
2050 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2051 <echo>checking out flax ...</echo>
2052 <mkdir dir="${basedir}/src/java/org/flax"/>
2053 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
2054 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
2055 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2056 <mkdir dir="${web.home}/interfaces/flax"/>
2057 <mkdir dir="${web.home}/sites/flax"/>
2058 <mkdir dir="${basedir}/flax-resources"/>
2059 <mkdir dir="${basedir}/flax-lib"/>
2060 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2061 <arg value="src/java/org/flax"/></exec>
2062 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2063 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2064 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2065 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2066 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
2067 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2068 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2069 <arg value="${web.home}/interfaces/flax"/></exec>
2070 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2071 <arg value="${web.home}/sites/flax"/></exec>
2072 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2073 <arg value="flax-resources"/></exec>
2074 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2075 <arg value="flax-lib"/></exec>
2076 <antcall target="flax-copy-files" />
2077 </target>
2078
2079 <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
2080 <echo>copying flax files ...</echo>
2081 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2082 <!-- A configuration file containing web service binding information for the axis engine -->
2083 <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
2084 <!-- A static web service wsdl file which is queried by soap client. The reason this file is used (instead of the dynamically generated version) is in case any redirects are used in the Apache configuration (e.g., flax.nzdl.org:80 redirects to harakeke:8080) -->
2085 <copy file="${basedir}/flax-resources/FlaxWebService.wsdl" tofile="${web.home}/FlaxWebService.wsdl" overwrite="true"/>
2086 <copy todir="${web.home}/WEB-INF/lib">
2087 <fileset dir="${basedir}/flax-lib">
2088 <include name="*.jar"/>
2089 </fileset>
2090 </copy>
2091 </target>
2092 <target name="configure-flax-wsdl" description="Configure flax webservice with tomcat server/port">
2093 <rsr file="${web.home}/FlaxWebService.wsdl" pattern="@flaxpublicserver@:@flaxpublicport@" replacement="${tomcat.server}:${tomcat.port}"/>
2094 <echo>FLAX server for Moodle module is configured to: http://${tomcat.server}:${tomcat.port}.</echo>
2095 </target>
2096
2097 <target name="update-flax" description="update flax from repository">
2098 <echo>updating flax ...</echo>
2099 <exec executable="svn"><arg value="update"/>
2100 <arg value="src/java/org/flax"/></exec>
2101 <exec executable="svn"><arg value="update"/>
2102 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2103 <exec executable="svn"><arg value="update"/>
2104 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2105 <exec executable="svn"><arg value="update"/>
2106 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2107 <exec executable="svn"><arg value="update"/>
2108 <arg value="${web.home}/interfaces/flax"/></exec>
2109 <exec executable="svn"><arg value="update"/>
2110 <arg value="flax-resources"/></exec>
2111 <exec executable="svn"><arg value="update"/>
2112 <arg value="flax-lib"/></exec>
2113 <antcall target="flax-copy-files" />
2114 </target>
2115
2116
2117 <target name="compile-javadocs">
2118 <javadoc packagenames="org.greenstone.*"
2119 sourcepath="src/java"
2120 defaultexcludes="yes"
2121 destdir="docs/javadoc"
2122 author="true"
2123 version="true"
2124 use="true"
2125 windowtitle="Greenstone3 API">
2126 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2127 </javadoc>
2128 </target>
2129
2130<!-- ========== Some distribution targets ======================== -->
2131 <target name="remove-source">
2132 <if><bool><isset property="with.gli.and.gems"/></bool>
2133 <delete includeEmptyDirs="true">
2134 <fileset dir="." defaultexcludes="false">
2135 <patternset refid="greenstone3.source.component"/>
2136 </fileset>
2137 </delete>
2138
2139 <else>
2140 <delete includeEmptyDirs="true">
2141 <fileset dir="." defaultexcludes="false">
2142 <patternset refid="greenstone3.source.no.gli.component"/>
2143 </fileset>
2144 </delete>
2145 </else>
2146 </if>
2147 </target>
2148
2149 <target name="dist-tidy"
2150 description="'tidies-up' a greenstone3 installation for distribution.">
2151
2152 <!-- delete unneeded things -->
2153 <delete dir="${packages.home}/axis"/>
2154 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2155 <delete file="README-SVN.txt"/>
2156 <delete file="build.properties.in"/>
2157
2158 <!-- delete source files -->
2159 <antcall target="remove-source"/>
2160
2161 <!-- create empty directories -->
2162 <mkdir dir="${web.home}/applet"/>
2163 <mkdir dir="${web.home}/logs"/>
2164
2165 <!-- os specific tidy-ups -->
2166 <!-- linux, mac -->
2167 <if><bool><istrue value="${current.os.isunix}"/></bool>
2168 <delete><fileset dir="." includes="*.bat"/></delete>
2169 <if><bool><isset property="with.gli.and.gems"/></bool>
2170 <delete><fileset dir="gli" includes="*.bat"/></delete>
2171 </if>
2172 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2173 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
2174 <delete file="${basedir}/gs2build/win32cfg.h"/>
2175 <delete file="${basedir}/gs2build/win32.mak"/>
2176 <delete dir="${basedir}/winutil"/>
2177 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2178
2179 <!-- windows -->
2180 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2181 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
2182 <if><bool><isset property="with.gli.and.gems"/></bool>
2183 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2184 </if>
2185 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2186 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2187 </if></else></if>
2188
2189 </target>
2190
2191 <!-- fix up executable permissions for binary release -->
2192 <target name="fix-execute-permissions">
2193 <echo>Setting binaries to executable</echo>
2194 <chmod perm="775">
2195 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2196 </chmod>
2197 </target>
2198
2199 <!-- fix up executable permissions for source code release -->
2200 <target name="fix-execute-permissions-source">
2201 <chmod perm="775">
2202 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2203 </chmod>
2204 </target>
2205
2206
2207 <!-- ============= tweaks for making compilation static ========== -->
2208 <target name="tweak-makefiles" depends="init" if="compile.static">
2209 <antcall target="rtftohtml-add-static" />
2210 </target>
2211
2212 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2213 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2214 </target>
2215
2216</project>
2217
Note: See TracBrowser for help on using the repository browser.