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

Last change on this file since 23936 was 23936, checked in by xiao, 13 years ago

modified to display the correct url if install.flax is set; cosmetic change on configure-flax-wsdl

File size: 90.7 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 <exec executable="where" os="${os.windows}" spawn="false" outputproperty="full.perl.path">
583 <arg value="perl" />
584 </exec>
585
586 <if><bool><istrue value="${current.os.iswindows}"/></bool>
587 <stringutil string="${full.perl.path}" property="full.perl.path">
588 <replace regex="[\n].*$" replacement="" />
589 </stringutil>
590 </if>
591
592 <stringutil string="${full.perl.path}" property="perl.path">
593 <replace regex="\/[^\/]*$" replacement="" />
594 </stringutil>
595
596 <if><bool><istrue value="${current.os.isunix}"/></bool>
597
598 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
599 <echo>
600 Non-standard location of Perl found: ${full.perl.path}
601 Set the environment variable PERLPATH or the perl.path property in
602 build.properties to explicitly control the version of Perl used.
603 </echo>
604 </if>
605 </if>
606 </else>
607 </if>
608 </if>
609
610 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
611 <if><bool><isset property="perl.path"/></bool>
612 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
613 <else>
614 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
615 </else>
616 </if>
617
618 <!-- gs2build not available, perl.path -->
619 <else>
620 <property name="perl.path" value=""/>
621 </else>
622 </if>
623 </target>
624
625 <target name="start" depends="init,configure-web,start-tomcat"
626 description="Startup the Tomcat server." >
627 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
628 <echo>Tomcat: ${catalina.home}</echo>
629 <echo>Java : ${java.home}</echo>
630 <if><bool><available file="${build.src.home}"/></bool>
631 <echo>Perl : ${full.perl.path}</echo>
632 </if>
633 <if><bool><isset property="install.flax"/></bool>
634 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/flax"/>
635 <else>
636 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/"/>
637 </else>
638 </if>
639 <echo>URL : ${url}</echo>
640 <!-- assuming that index.html is not needed here -->
641 </target>
642
643 <target name="stop" depends="init,stop-tomcat"
644 description="Shutdown the Tomcat server."/>
645
646 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
647
648
649 <!-- =========== Help targets =================================== -->
650
651 <property name="install-command" value="ant [options] prepare install"/>
652
653 <target name="usage" description="Print a help message">
654 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
655 <echo message=" Execute 'ant -help' for Ant help."/>
656 <echo>
657 To install Greenstone3, run '${install-command}'.
658 There are properties defined in build.properties. The install
659 process will ask you if these properties are set correctly.
660 To avoid this prompt, use the '-Dproperties.accepted=yes'
661 option.
662 To log the output, use the '-logfile build.log' option.
663 The README.txt file has more information about the ant targets
664 and install process.
665 </echo>
666 </target>
667
668 <target name="help" depends="usage" description="Print a help message"/>
669
670 <target name="debug" depends="init" description="Display all the currently used properties">
671 <echoproperties/>
672 </target>
673
674 <!-- ====== initialization and setup targets ================== -->
675
676 <target name="accept-properties" unless="properties.accepted">
677 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
678 tomcat.server=${tomcat.server}
679 tomcat.port=${tomcat.port}
680 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
681 proxy.host=${proxy.host}
682 proxy.port=${proxy.port}
683 disable.collection.building=${disable.collection.building}
684 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
685 </input>
686 <condition property="do.abort">
687 <equals arg1="n" arg2="${properties.ok}"/>
688 </condition>
689 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
690 </target>
691
692 <!-- this sets up some initial properties -->
693 <target name="init">
694
695 <!-- has the gs3-setup script been run?? -->
696 <condition property="gs3-setup-not-done">
697 <not>
698 <isset property="env.GSDL3HOME"/>
699 </not>
700 </condition>
701
702 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
703
704 <condition property="java.too.old">
705 <or>
706 <equals arg1="1.1" arg2="${ant.java.version}"/>
707 <equals arg1="1.2" arg2="${ant.java.version}"/>
708 <equals arg1="1.3" arg2="${ant.java.version}"/>
709 </or>
710 </condition>
711 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
712
713 <available file="${basedir}/gli" property="gli.present"/>
714 <available file="${basedir}/common-src" property="common.src.present"/>
715 <available file="${basedir}/gs2build" property="gs2build.present"/>
716
717 <condition property="tomcat.islocal">
718 <or>
719 <not><isset property="tomcat.installed.path"/></not>
720 <equals arg1="" arg2="${tomcat.installed.path}"/>
721 </or>
722 </condition>
723
724 <echo>tomcat.port = ${tomcat.port}</echo>
725
726 <condition property="proxy.present">
727 <and>
728 <isset property="proxy.host"/>
729 <not><equals arg1="" arg2="${proxy.host}"/></not>
730 </and>
731 </condition>
732
733 <!--
734 the next block checks if the bundled tomcat is present in the 'packages' directory,
735 and checks for the lethal combination of tomcat 6 and java 1.4. Test for
736 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
737 download, as there is no other surefire way to check tomcat version under java 1.4
738 -->
739 <condition property="packages.tomcat.ispresent" value="true" else="false">
740 <available file="packages/tomcat"/>
741 </condition>
742 <condition property="packages.tomcat.istomcat6" value="true" else="false">
743 <available file="packages/tomcat/tomcat6.txt"/>
744 </condition>
745 <if>
746 <bool>
747 <and>
748 <istrue value="${packages.tomcat.ispresent}"/>
749 <istrue value="${packages.tomcat.istomcat6}"/>
750 <equals arg1="1.4" arg2="${ant.java.version}"/>
751 </and>
752 </bool>
753 <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>
754 </if>
755
756 </target>
757
758 <target name="setup-proxy" depends="init" if="proxy.present">
759 <condition property="ask.user">
760 <or>
761 <equals arg1="" arg2="${proxy.user}"/>
762 <equals arg1="" arg2="${proxy.password}"/>
763 </or>
764 </condition>
765
766 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
767 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
768 </target>
769
770 <!-- ========== Web app Targets ================================ -->
771
772 <target name="prepare-web" depends="init">
773 <mkdir dir="${web.home}/applet"/>
774 <mkdir dir="${web.home}/logs"/>
775 </target>
776
777 <!-- 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 -->
778 <target name="configure-java-version" depends="init"
779 description="Activates or deactivates some jar libraries as needed depending on your java version">
780
781 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
782 <condition property="need.xalan.jar">
783 <or>
784 <equals arg1="1.5" arg2="${ant.java.version}"/>
785 <equals arg1="1.6" arg2="${ant.java.version}"/>
786 </or>
787 </condition>
788
789 <!-- if they have xalan.jar but dont need it -->
790 <if>
791 <bool>
792 <and>
793 <isset property="have.xalan.jar"/>
794 <not><isset property="need.xalan.jar"/></not>
795 </and>
796 </bool>
797 <antcall target="deactivate-xalan-jar"/>
798 </if>
799
800 <!-- if they need xalan.jar but dont have it -->
801 <if>
802 <bool>
803 <and>
804 <not><isset property="have.xalan.jar"/></not>
805 <isset property="need.xalan.jar"/>
806 </and>
807 </bool>
808 <antcall target="activate-xalan-jar"/>
809 </if>
810
811 </target>
812
813 <target name="activate-xalan-jar">
814 <echo>activating xalan.jar</echo>
815 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
816 <if>
817 <bool>
818 <and>
819 <isset property="current.os.ismac"/>
820 <available file="${catalina.home}/common/endorsed" type="dir"/>
821 </and>
822 </bool>
823 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
824 </if>
825 </target>
826
827 <target name="deactivate-xalan-jar">
828 <echo>deactivating xalan.jar</echo>
829 <delete file="${web.lib}/xalan.jar"/>
830 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
831 </target>
832
833
834 <target name="prepare-collections" depends="init">
835 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
836 <property name="index.zip" value="index.zip"/>
837
838 <echo message="installing collections..."/>
839 <antcall target="gs2mgdemo-install"/>
840 <antcall target="gs2mgppdemo-install"/>
841 <antcall target="gberg-install"/>
842 </target>
843
844 <target name="gs2mgdemo-prepare" if="collect.dir">
845 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
846
847 <condition property="gs2mgdemo.present">
848 <and>
849 <available file="${gs2mgdemo.dir}/${index.zip}"/>
850 </and>
851 </condition>
852 </target>
853
854 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
855 <echo> installing gs2mgdemo</echo>
856 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
857 <echo>collection gs2mgdemo installed</echo>
858 </target>
859
860 <target name="gs2mgppdemo-prepare" if="collect.dir">
861 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
862
863 <condition property="gs2mgppdemo.present">
864 <and>
865 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
866 </and>
867 </condition>
868 </target>
869
870 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
871 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
872 <echo>collection gs2mgppdemo installed</echo>
873 </target>
874
875 <target name="gberg-prepare" if="collect.dir">
876 <property name="gberg.dir" value="${collect.dir}/gberg"/>
877 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
878 </target>
879
880 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
881 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
882 <echo>collection gberg installed</echo>
883 </target>
884
885 <target name="configure-web" depends="init,perl-for-building"
886 description="Configure only the web app config files">
887 <!-- we want a unix path in the global.properties file -->
888 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
889 <path path="${web.home}"/>
890 </pathconvert>
891 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
892 <filter token="gsdl3version" value="${app.version}"/>
893 <filter token="tomcat.server" value="${tomcat.server}"/>
894 <filter token="tomcat.port" value="${tomcat.port}"/>
895 <filter token="perlpath" value="${perl.path}"/>
896 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
897 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
898 <chmod file="${web.classes}/global.properties" perm="600"/>
899 <chmod file="${web.classes}/log4j.properties" perm="600"/>
900 </target>
901
902 <target name="compile-web" depends="init">
903 <javac srcdir="${web.classes}"
904 destdir="${web.classes}"
905 debug="${compile.debug}"
906 deprecation="${compile.deprecation}"
907 optimize="${compile.optimize}">
908 <classpath><path refid="compile.classpath"/></classpath>
909 </javac>
910 </target>
911
912 <target name="compile-classpath-jars" depends="init">
913 <if><bool><available file="admin/cp.mf"/></bool>
914 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
915 </if>
916 <if><bool><available file="${lib.java}/cp.mf"/></bool>
917 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
918 </if>
919 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
920 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
921 </if>
922 <if><bool><available file="${web.lib}/cp.mf"/></bool>
923 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
924 </if>
925 <jar destfile="cp.jar">
926 <manifest>
927 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
928 </manifest>
929 </jar>
930 </target>
931
932 <target name="clean-classpath-jars" depends="init">
933 <delete file="admin/cp.jar"/>
934 <delete file="${lib.java}/cp.jar"/>
935 <delete file="${lib.jni}/cp.jar"/>
936 <delete file="${web.lib}/cp.jar"/>
937 <delete file="cp.jar"/>
938 </target>
939
940
941 <target name="svnupdate-web" unless="nosvn.mode">
942 <exec executable="svn">
943 <arg value="update"/>
944 <arg value="${web.home}"/>
945 <arg value="-r"/><arg value="${branch.revision}"/>
946 </exec>
947 </target>
948
949 <target name="update-web" depends="init,svnupdate-web,configure-web"
950 description="update only the web stuff (config files)"/>
951
952 <!-- ======================= Tomcat Targets ========================== -->
953
954 <!-- this target downloads and installs Tomcat -->
955 <!-- we download tomcat (version 6 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
956 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
957 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">
958 <if>
959 <bool>
960 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
961 </bool>
962
963 <!-- check that packages dir is there -->
964 <mkdir dir="${packages.home}"/>
965 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
966 dest="${packages.home}/${tomcat.version}.zip"
967 usetimestamp="true"/>
968 <unzip src="${packages.home}/${tomcat.version}.zip"
969 dest="${packages.home}"/>
970
971 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
972 we would need to have the tomcat compat package to work with Java 1.4-->
973 <if>
974 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
975 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
976 dest="${packages.home}/${tomcat.version}-compat.zip"
977 usetimestamp="true"/>
978 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
979 dest="${packages.home}"/>
980 </if>
981
982 <!-- delete any existing tomcat -->
983 <delete dir="${packages.home}/tomcat"/>
984 <move todir="${packages.home}/tomcat">
985 <fileset dir="${packages.home}/${tomcat.version}"/>
986 </move>
987 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
988 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
989 overwrite="true"/>
990 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
991 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
992 overwrite="true"/>
993 <!-- make sure we have execute permission for the .sh files -->
994 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
995 includes="*.sh"/>
996
997 <echo file="${packages.home}/tomcat/.flagfile">
998 the timestamp of this file is the time that tomcat was extracted from the zip files.
999 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
1000 </echo>
1001
1002 <!-- this is not strictly a prepare tomcat thing, but if one changes
1003 Java, then they need to change tomcat as well, so might as well call
1004 it here -->
1005 <antcall target="configure-java-version"/>
1006 <else>
1007 <echo>Tomcat has been prepared, will not prepare</echo>
1008 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
1009 </else>
1010
1011 </if>
1012
1013 </target>
1014
1015 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1016
1017 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
1018 <!-- re-setup the server.xml file -->
1019 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
1020 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
1021 <filterset>
1022 <filter token="port" value="${tomcat.port}"/>
1023 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
1024 </filterset>
1025 </copy>
1026 <!-- set up the greenstone3 context -->
1027 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
1028 <filterset>
1029 <filter token="gsdl3webhome" value="${web.home}"/>
1030 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
1031 </filterset>
1032 </copy>
1033 </target>
1034
1035 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
1036 <!-- re-setup the server.xml file -->
1037 <!-- need to edit the config file, or do we get the user to do this???-->
1038 </target>
1039
1040
1041
1042<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
1043 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
1044 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
1045 <property name="tomcat.path" refid="local.tomcat.path"/>
1046 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
1047 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1048 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1049 <env key="GSDL3HOME" value="${basedir}"/>
1050 <env key="PATH" path="${tomcat.path}"/>
1051 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1052 <env key="CATALINA_HOME" value="${catalina.home}"/>
1053 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1054 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
1055 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
1056 <env key="WNHOME" path="${wn.home}"/>
1057 </exec>
1058 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
1059 <env key="GSDLOS" value="windows"/>
1060 <env key="GSDL3HOME" value="${basedir}"/>
1061 <env key="Path" path="${tomcat.path}"/>
1062 <env key="PATH" path="${tomcat.path}"/>
1063 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1064 <env key="CATALINA_HOME" value="${catalina.home}"/>
1065 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1066 </exec>
1067 <!-- wait for the server to startup in case other targets need it running -->
1068 <waitfor maxwait="5" maxwaitunit="second">
1069 <and>
1070 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1071 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
1072 </and>
1073 </waitfor>
1074 </target>
1075
1076 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
1077 <target name="reconfigure" description="Reconfigure the message router">
1078 <waitfor maxwait="5" maxwaitunit="second">
1079 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
1080 </waitfor>
1081 </target>
1082
1083 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
1084 <target name="reconfigure-collection" description="Reconfigure the collection">
1085 <waitfor maxwait="5" maxwaitunit="second">
1086 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
1087 </waitfor>
1088 </target>
1089
1090 <!-- windows: do we want to launch a webrowser?? -->
1091 <!-- shouldn't this test whether anything is running first? -->
1092 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
1093 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1094 <env key="CATALINA_HOME" value="${catalina.home}"/>
1095 </exec>
1096 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
1097 <env key="CATALINA_HOME" value="${catalina.home}"/>
1098 </exec>
1099 </target>
1100
1101 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
1102
1103 <target name="setup-catalina-ant-tasks">
1104 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
1105 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
1106 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1107 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
1108 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1109 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
1110 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1111 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
1112 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1113 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
1114 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1115 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
1116 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1117 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
1118 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1119 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
1120 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1121 </target>
1122
1123
1124 <!-- ======================= ant Targets ============================ -->
1125 <target name="prepare-ant" depends="init">
1126 <if>
1127 <bool>
1128 <not><available file="${packages.home}/ant/.flagfile"/></not>
1129 </bool>
1130
1131 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1132 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1133 usetimestamp="true"/>
1134 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1135 dest="${packages.home}"/>
1136 <move todir="${packages.home}/ant">
1137 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1138 </move>
1139 <echo file="${packages.home}/ant/.flagfile">
1140 the timestamp of this file is the time that ant was extracted from the zip files.
1141 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1142 </echo>
1143
1144 <else>
1145 <echo>Ant has been prepared, will not prepare</echo>
1146 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1147 </else>
1148
1149 </if>
1150 </target>
1151
1152 <!-- ======================= Axis Targets ============================ -->
1153
1154 <target name="prepare-axis" depends="init">
1155
1156 <if>
1157 <bool>
1158 <not><available file="${packages.home}/axis/.flagfile"/></not>
1159 </bool>
1160
1161 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1162 dest="${packages.home}/${axis.zip.version}"
1163 usetimestamp="true"/>
1164 <unzip src="${packages.home}/${axis.zip.version}"
1165 dest="${packages.home}"/>
1166 <move todir="${packages.home}/axis">
1167 <fileset dir="${packages.home}/${axis.dir.version}"/>
1168 </move>
1169 <!-- install axis into greenstone web app -->
1170 <copy todir="${web.lib}">
1171 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1172 <include name="*.jar"/>
1173 </fileset>
1174 </copy>
1175 <copy todir="${web.home}">
1176 <fileset dir="${packages.home}/axis/webapps/axis/">
1177 <include name="*.jsp"/>
1178 <include name="*.jws"/>
1179 </fileset>
1180 </copy>
1181 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1182 <copy todir="${web.classes}">
1183 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1184 <include name="*.properties"/>
1185 </fileset>
1186 </copy>
1187 <echo file="${packages.home}/axis/.flagfile">
1188 the timestamp of this file is the time that axis was extracted from the zip files.
1189 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1190 </echo>
1191
1192 <else>
1193 <echo>Axis has been prepared, will not prepare</echo>
1194 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1195 </else>
1196
1197 </if>
1198 </target>
1199
1200 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
1201 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
1202
1203 <target name="deploy-site">
1204 <java classname="org.apache.axis.client.AdminClient">
1205 <classpath refid="compile.classpath"/>
1206 <arg value="-l"/>
1207 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1208 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1209 </java>
1210 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
1211 </target>
1212
1213 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
1214 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
1215 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1216 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1217 tofile="${basedir}/resources/soap/undeploy.wsdd"
1218 filtering="true"
1219 overwrite="true"/>
1220 <java classname="org.apache.axis.client.AdminClient">
1221 <classpath refid="compile.classpath"/>
1222 <arg value="-l"/>
1223 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1224 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
1225 </java>
1226 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
1227 </target>
1228
1229 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1230 with the default servicename of localsite-->
1231 <target name="deploy-localsite" depends="init"
1232 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1233 <antcall target="start-tomcat"/>
1234 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
1235 <antcall target="create-deployment-files">
1236 <param name="axis.sitename" value="localsite"/>
1237 <param name="axis.servicesname" value="${base.webservice.name}"/>
1238 <param name="axis.siteuri" value="localsite"/>
1239 </antcall>
1240 <antcall target="deploy-site">
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 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
1246 </target>
1247
1248 <target name="get-sitename" unless="axis.sitename">
1249 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
1250Press Enter for default:localsite</input>
1251 </target>
1252
1253 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1254 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1255To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1256Or press Enter for undeploying the default:localsite /&gt;</input>
1257 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1258 </target>
1259
1260 <target name="get-webservices" unless="axis.servicesname">
1261 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1262Choose from: ${web.services.list}
1263Or press Enter for default:${base.webservice.name} /&gt;</input>
1264 <echo>${axis.servicesname}</echo>
1265 </target>
1266
1267 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1268 <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>
1269 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1270 </target>
1271
1272 <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">
1273 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1274 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1275 </condition>
1276
1277 <!--everything else defaults to java:RPC at present-->
1278 <condition property="soap.method" value="provider='java:RPC'">
1279 <not>
1280 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1281 </not>
1282 </condition>
1283 </target>
1284
1285 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1286 <filter token="sitename" value="${axis.sitename}"/>
1287 <filter token="siteuri" value="${axis.siteuri}"/>
1288 <filter token="servicesname" value="${axis.servicesname}"/>
1289 <filter token="soapmethod" value="${soap.method}"/>
1290 <copy file="${basedir}/resources/soap/site.wsdd.template"
1291 tofile="${basedir}/resources/soap/deploy.wsdd"
1292 filtering="true"
1293 overwrite="true"/>
1294 <!-- create the java files and compile them -->
1295 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1296 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1297 filtering="true"
1298 overwrite="true"/>
1299 <mkdir dir="${build.home}"/>
1300 <javac srcdir="${src.home}"
1301 destdir="${build.home}"
1302 debug="${compile.debug}"
1303 deprecation="${compile.deprecation}"
1304 optimize="${compile.optimize}">
1305 <classpath refid="compile.classpath"/>
1306 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1307 </javac>
1308 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1309 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1310 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1311 overwrite="true" />
1312 </target>
1313
1314
1315 <!-- ====================== Core targets ============================== -->
1316 <!-- core targets refer to the core gsdl3 java src -->
1317
1318 <target name="prepare-core"/>
1319
1320 <target name="configure-core"/>
1321
1322 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1323 description="Update only the Greenstone core" />
1324
1325 <target name="svnupdate-core" unless="nosvn.mode">
1326 <exec executable="svn">
1327 <arg value="update"/>
1328 <arg value="${basedir}"/>
1329 <arg value="-r"/><arg value="${branch.revision}"/>
1330 </exec>
1331 </target>
1332
1333 <target name="clean-core"
1334 description="Clean only the Greenstone core">
1335 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1336 <delete dir="${build.home}"/>
1337 </target>
1338
1339 <target name="compile-core" depends="init"
1340 description="Compile only the Greenstone core">
1341 <mkdir dir="${build.home}"/>
1342 <if><bool><isset property="with.jni"/></bool>
1343 <javac srcdir="${src.home}"
1344 destdir="${build.home}"
1345 debug="${compile.debug}"
1346 deprecation="${compile.deprecation}"
1347 optimize="${compile.optimize}">
1348 <classpath>
1349 <path refid="compile.classpath"/>
1350 </classpath>
1351 </javac>
1352 <else>
1353 <property name="gsprefix" value=""/>
1354 <javac srcdir="${src.home}"
1355 destdir="${build.home}"
1356 debug="${compile.debug}"
1357 deprecation="${compile.deprecation}"
1358 optimize="${compile.optimize}">
1359 <classpath>
1360 <path refid="compile.classpath"/>
1361 </classpath>
1362 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1363 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1364 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1365 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1366 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1367 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1368 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1369 </javac>
1370 </else>
1371 </if>
1372 <jar destfile="${build.home}/gsdl3.jar">
1373 <fileset dir="${build.home}">
1374 <include name="org/greenstone/gsdl3/**"/>
1375 <include name="org/flax/**"/>
1376 <exclude name="**/Test.class"/>
1377 </fileset>
1378 <manifest>
1379 <attribute name="Built-By" value="${user.name}" />
1380 </manifest>
1381 </jar>
1382 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1383
1384 <jar destfile="${build.home}/gutil.jar">
1385 <fileset dir="${build.home}">
1386 <include name="org/greenstone/util/**"/>
1387 </fileset>
1388 <manifest>
1389 <attribute name="Built-By" value="${user.name}" />
1390 </manifest>
1391 </jar>
1392 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1393
1394 <!-- copy the localsite server in case we need it -->
1395 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1396
1397 <!-- Greenstone Administrator Interface -->
1398 <jar destfile="${build.home}/GAI.jar">
1399 <fileset dir="${build.home}">
1400 <include name="org/greenstone/admin/**"/>
1401 </fileset>
1402 <manifest>
1403 <attribute name="Built-By" value="${user.name}" />
1404 </manifest>
1405 </jar>
1406 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1407 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1408 <jar destfile="${build.home}/phind.jar">
1409 <fileset dir="${build.home}">
1410 <include name="org/greenstone/applet/phind/**"/>
1411 </fileset>
1412 <manifest>
1413 <attribute name="Built-By" value="${user.name}" />
1414 </manifest>
1415 </jar>
1416 <mkdir dir="${web.applet}"/>
1417 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1418 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1419 <if>
1420 <bool><istrue value="${tomcat.islocal}"/></bool>
1421 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1422 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1423 </if>
1424
1425
1426 <!-- skip anttasks for now
1427 <jar destfile="${build.home}/anttasks.jar">
1428 <fileset dir="${build.home}">
1429 <include name="org/greenstone/anttasks/**"/>
1430 </fileset>
1431 <manifest>
1432 <attribute name="Built-By" value="${user.name}" />
1433 </manifest>
1434 </jar>
1435 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1436 <jar destfile="${build.home}/gsdl3test.jar">
1437 <fileset dir="${build.home}">
1438 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1439 <include name="org/greenstone/testing/**"/>
1440 </fileset>
1441 <manifest>
1442 <attribute name="Built-By" value="${user.name}" />
1443 </manifest>
1444 </jar>
1445 <jar destfile="${build.home}/server.jar">
1446 <fileset dir="${build.home}">
1447 <include name="org/greenstone/server/**"/>
1448 <include name="org/greenstone/util/**"/>
1449 </fileset>
1450 <fileset file="${basedir}/resources/java/server.properties"/>
1451 <manifest>
1452 <attribute name="Built-By" value="${user.name}"/>
1453 </manifest>
1454 </jar>
1455 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1456 </target>
1457
1458 <!-- ================== Packages targets ================================ -->
1459 <!-- these targets refer to the greenstone source packages - these need
1460 updating less often, so are in separate targets to the core -->
1461 <target name="prepare-packages" depends="init"/>
1462
1463 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1464 description="Update only the source packages"/>
1465
1466 <target name="svnupdate-packages" unless="nosvn.mode">
1467 <exec executable="svn">
1468 <arg value="update"/>
1469 <arg value="${src.packages.home}"/>
1470 <arg value="-r"/><arg value="${branch.revision}"/>
1471 </exec>
1472 </target>
1473
1474
1475 <target name="configure-packages" depends="init,configure-javagdbm"
1476 description="Configure only the packages."/>
1477
1478 <target name="configure-javagdbm" if="with.jni">
1479 <echo>
1480 Configuring JavaGDBM
1481 </echo>
1482
1483 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1484 <arg value="--prefix=${basedir}"/>
1485 <arg value="--libdir=${lib.jni}"/>
1486 <arg value="--with-gdbm=${gdbm.home}"/>
1487 </exec>
1488 </target>
1489
1490 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1491
1492 <target name="clean-javagdbm" depends="init">
1493 <exec executable="make" os="${os.unix}"
1494 dir="${javagdbm.home}" failonerror="true">
1495 <arg value="clean"/>
1496 </exec>
1497 </target>
1498
1499 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1500
1501 <target name="distclean-javagdbm" depends="init">
1502 <exec executable="make" os="${os.unix}"
1503 dir="${javagdbm.home}" failonerror="true">
1504 <arg value="distclean"/>
1505 </exec>
1506 </target>
1507
1508 <target name="compile-packages" description="Compile only the source packages">
1509 <!-- javagdbm -->
1510 <antcall target="compile-javagdbm"/>
1511 <!-- Search4j -->
1512 <antcall target="compile-search4j"/>
1513 </target>
1514
1515 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
1516
1517 <!-- unix: -->
1518 <echo>compile javagdbm</echo>
1519 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1520 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1521 <arg value="install"/>
1522 </exec>
1523
1524 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1525 "all" which will then perform both the compile AND link targets in jni/win32.mak
1526 (thereby also generating gdbmjava.dll). Then we run the same command with
1527 the "install" argument to copy the gdbmjava.dll into the correct location. -->
1528 <echo>Windows: compile javagdbm</echo>
1529 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1530 <env key="GSDLHOME" path="${gs2build.home}"/>
1531 </exec>
1532 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1533 <env key="GSDLHOME" path="${gs2build.home}"/>
1534 <arg value="install"/>
1535 </exec>
1536
1537 <!-- install the jar file -->
1538 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
1539 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1540 </target>
1541
1542 <target name="compile-search4j">
1543
1544 <!-- windows -->
1545 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1546 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1547 <arg value="/f"/>
1548 <arg value="win32.mak"/>
1549 <arg value='BINDIR="${basedir}\bin"'/>
1550 </exec>
1551 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1552 <arg value="/f"/>
1553 <arg value="win32.mak"/>
1554 <arg value="install"/>
1555 <arg value='BINDIR="${basedir}\bin"'/>
1556 </exec>
1557
1558 <!-- unix -->
1559 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1560 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1561 <arg value="--bindir=${basedir}/bin"/>
1562 <arg value="${static.arg}"/>
1563 </exec>
1564 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1565 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1566 <arg value="install"/>
1567 </exec>
1568
1569 <!-- else warn -->
1570 <else>
1571 <fail>this target does not support the current os</fail>
1572
1573 </else></if></else></if>
1574
1575 </target>
1576
1577 <target name="install-auxiliary-jar-files" depends="init">
1578
1579 <if>
1580 <bool><available file="${mg.home}/mg.jar"/></bool>
1581 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1582 </if>
1583
1584 <if>
1585 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
1586 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1587 </if>
1588
1589 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1590 </target>
1591
1592 <target name="install-jni-files" depends="init" if="with.jni">
1593 <antcall target="install-jni-files-linux"/>
1594 <antcall target="install-jni-files-windows"/>
1595 <antcall target="install-jni-files-macos"/>
1596 </target>
1597
1598 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1599 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1600 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1601 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1602 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1603 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1604 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1605 </target>
1606 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1607 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1608 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1609 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1610 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1611 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1612 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1613 </target>
1614 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1615 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1616 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1617 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1618 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1619 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1620 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1621 </target>
1622
1623 <!-- ========common-src targets =================================-->
1624 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1625 collection building is not enabled -->
1626
1627 <target name="update-common-src" depends="init" if="collection.building.disabled">
1628 </target>
1629
1630 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1631 <exec executable="svn">
1632 <arg value="update"/>
1633 <arg value="${common.src.home}"/>
1634 <arg value="-r"/><arg value="${branch.revision}"/>
1635 </exec>
1636 </target>
1637
1638 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1639 <antcall target="checkout-common-src"/>
1640 <antcall target="unzip-windows-packages"/>
1641 </target>
1642
1643 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1644 <echo>checking out common-src</echo>
1645 <exec executable="svn">
1646 <arg value="checkout"/>
1647 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
1648 <arg value="common-src"/>
1649 <arg value="-r"/><arg value="${branch.revision}"/>
1650 </exec>
1651 </target>
1652
1653 <target name="configure-common-src" depends="init">
1654 <exec executable="${common.src.home}/configure" os="${os.unix}"
1655 dir="${common.src.home}" failonerror="true">
1656 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1657 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1658 <arg line="${gs2.opt.args}"/>
1659 <arg line="${static.arg}"/>
1660 <arg line="${allargs}"/>
1661 </exec>
1662 </target>
1663
1664 <target name="clean-common-src" depends="init">
1665 <!-- unix: -->
1666 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1667 <arg value="clean"/>
1668 </exec>
1669 <!-- windows: -->
1670 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1671 <arg value="/f"/>
1672 <arg value="win32.mak"/>
1673 <arg value="clean"/>
1674 <arg value="GSDLHOME=${gs2build.home}"/>
1675 </exec>
1676 </target>
1677 <target name="distclean-common-src" depends="init">
1678 <!-- unix: -->
1679 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1680 <arg value="distclean"/>
1681 </exec>
1682 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1683 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1684 <arg value="/f"/>
1685 <arg value="win32.mak"/>
1686 <arg value="clean"/>
1687 <arg value="GSDLHOME=${gs2build.home}"/>
1688 </exec>
1689 </target>
1690 <target name="compile-common-src" depends="init">
1691 <!-- unix: -->
1692 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1693 <arg value="${gs2.compile.target}"/>
1694 </exec>
1695 <!-- windows: -->
1696 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1697 <arg value="/f"/>
1698 <arg value="win32.mak"/>
1699 <arg value="GSDLHOME=${gs2build.home}"/>
1700 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1701 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1702 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1703 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1704 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1705 </exec>
1706 </target>
1707
1708 <!-- ======= collection-building targets ===========================-->
1709
1710 <target name="update-collection-building" if="collection.building.enabled"
1711 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"
1712 description="Update (SVN update, configure, compile etc) only the collection building components"/>
1713
1714 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1715 description="SVN update the collection building components">
1716 </target>
1717
1718 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1719 </target>
1720
1721 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1722 description="Configure the collection building components">
1723 </target>
1724
1725 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1726 description="Clean only the collection building components"
1727 if="collection.building.enabled"/>
1728
1729 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1730 description="Distclean only the collection building components"
1731 if="collection.building.enabled"/>
1732
1733 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1734 description="Compile only the collection building components">
1735 <!-- make install for common-src -->
1736 <!-- unix: -->
1737 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1738 <arg value="${gs2.install.target}"/>
1739 </exec>
1740
1741 <!-- windows: -->
1742 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1743 <arg value="/f"/>
1744 <arg value="win32.mak"/>
1745 <arg value="install"/>
1746 <arg value="GSDLHOME=${gs2build.home}"/>
1747 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1748 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
1749 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
1750 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
1751 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
1752 <!--
1753 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
1754 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
1755 </exec>
1756
1757 <!-- install gs2build indexers for windows -->
1758 <if>
1759 <bool><istrue value="${current.os.iswindows}"/></bool>
1760 <copy todir="${gs2build.home}/bin/windows">
1761 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1762 <include name="*.*"/>
1763 </fileset>
1764 </copy>
1765 </if>
1766
1767 <!-- LuceneWrapper jar file not installed by default -->
1768 <mkdir dir="${gs2build.home}/bin/java"/>
1769 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1770
1771 </target>
1772
1773 <!-- ============== gli targets ================================= -->
1774 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1775
1776 <exec executable="svn">
1777 <arg value="update"/>
1778 <arg value="${gli.home}"/>
1779 <arg value="-r"/><arg value="${branch.revision}"/>
1780 </exec>
1781
1782 <exec executable="svn" dir="web/WEB-INF/cgi">
1783 <arg value="export"/>
1784 <arg value="-r"/><arg value="${branch.revision}"/>
1785 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gliserver.pl"/>
1786 </exec>
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/gsdlCGI.pm"/>
1791 </exec>
1792
1793 </target>
1794
1795 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1796 <!-- checkout -->
1797 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
1798
1799 <exec executable="svn">
1800 <arg value="checkout"/>
1801 <arg value="${svn.root}/main/${branch.path}/gli"/>
1802 <arg value="-r"/><arg value="${branch.revision}"/>
1803 </exec>
1804
1805 <exec executable="svn" dir="web/WEB-INF/cgi">
1806 <arg value="export"/>
1807 <arg value="-r"/><arg value="${branch.revision}"/>
1808 <arg value="${svn.root}/main/${branch.path}/greenstone2/cgi-bin/gliserver.pl"/>
1809 </exec>
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/gsdlCGI.pm"/>
1814 </exec>
1815
1816 </if>
1817 </target>
1818
1819 <target name="clean-gli" depends="init" if="collection.building.enabled">
1820 <!-- gli -->
1821 <property name="gli.home" value="${basedir}/gli"/>
1822 <!-- linux -->
1823 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1824 resolveExecutable="true" failonerror="true"/>
1825 <!-- windows -->
1826 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1827 resolveExecutable="true" failonerror="true"/>
1828 </target>
1829
1830 <target name="compile-gli" depends="init" if="collection.building.enabled">
1831 <if><bool><isset property="with.gli.and.gems"/></bool>
1832 <!-- gli -->
1833 <property name="gli.home" value="${basedir}/gli"/>
1834
1835 <!-- linux -->
1836 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
1837 <!--remote gli-->
1838 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1839 resolveExecutable="true" failonerror="true"/>
1840 <!-- windows -->
1841 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
1842 <!--remote gli-->
1843 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1844 resolveExecutable="true" failonerror="true"/>
1845 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1846 </if>
1847 </target>
1848
1849 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1850 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1851 <env key="gsdl3path" path="${basedir}"/>
1852 <env key="gsdlpath" path="${gs2build.home}"/>
1853 </exec>
1854 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1855 <env key="gsdl3path" path="${basedir}"/>
1856 <env key="gsdlpath" path="${gs2build.home}"/>
1857 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
1858 </exec>
1859 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1860 <env key="GSDL3PATH" path="${basedir}"/>
1861 <env key="GSDLPATH" path="${gs2build.home}"/>
1862 </exec>
1863 <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.
1864 </echo>
1865 </target>
1866
1867 <!-- ================ gs2build targets =========================== -->
1868
1869 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1870 <echo>svn updating gs2build</echo>
1871 <exec executable="svn">
1872 <arg value="update"/>
1873 <arg value="${gs2build.home}"/>
1874 <arg value="-r"/><arg value="${branch.revision}"/>
1875 </exec>
1876 </target>
1877
1878 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1879 <antcall target="checkout-gs2build"/>
1880 <antcall target="unzip-windows-packages"/>
1881 <antcall target="checkout-winbin"/>
1882 <antcall target="get-windows-binaries"/>
1883 <antcall target="delete-winbin"/>
1884 </target>
1885
1886 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1887 <echo>checking out gs2build</echo>
1888 <exec executable="svn">
1889 <arg value="checkout"/>
1890 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
1891 <arg value="-r"/><arg value="${branch.revision}"/>
1892 </exec>
1893
1894
1895 </target>
1896
1897 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1898 unless="nosvn.mode">
1899
1900 <exec executable="svn">
1901 <arg value="checkout"/>
1902 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
1903 <arg value="-r"/><arg value="${branch.revision}"/>
1904 <arg value="winbin"/>
1905 </exec>
1906
1907 </target>
1908
1909 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1910 <exec executable="svn">
1911 <arg value="update"/>
1912 <arg value="winbin"/>
1913 <arg value="-r"/><arg value="${branch.revision}"/>
1914 </exec>
1915
1916 </target>
1917
1918 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1919 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1920 <fileset dir="${basedir}/winbin/bin"/>
1921 </move>
1922 </target>
1923
1924 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1925 <delete dir="${basedir}/winbin"/>
1926 </target>
1927
1928 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
1929 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
1930 dest="${common.src.home}/packages/windows/crypt"/>
1931 <untar compression="gzip"
1932 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
1933 dest="${common.src.home}/packages/sqlite"/>
1934 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
1935 dest="${common.src.home}/indexers/packages/windows/iconv"/>
1936 </target>
1937
1938 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1939 <!-- we want a windows path in the setup.bat file -->
1940 <pathconvert targetos="windows" property="gs2build.home.windows">
1941 <path path="${gs2build.home}"/>
1942 </pathconvert>
1943 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1944 <filterset>
1945 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1946 </filterset>
1947 </move>
1948 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1949 </target>
1950
1951
1952 <target name="clean-build-src" depends="init" if="collection.building.enabled">
1953 <!-- unix: -->
1954 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1955 <arg value="clean"/>
1956 </exec>
1957 <!-- windows: -->
1958 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1959 <arg value="/f"/>
1960 <arg value="win32.mak"/>
1961 <arg value="clean"/>
1962 <arg value="GSDLHOME=${gs2build.home}"/>
1963 </exec>
1964 </target>
1965
1966
1967 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
1968 <!-- unix: -->
1969 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1970 <arg value="distclean"/>
1971 </exec>
1972 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1973 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1974 <arg value="/f"/>
1975 <arg value="win32.mak"/>
1976 <arg value="clean"/>
1977 <arg value="GSDLHOME=${gs2build.home}"/>
1978 </exec>
1979 </target>
1980
1981 <target name="configure-build-src" depends="init" if="collection.building.enabled"
1982 description="Configure the build-src component">
1983 <exec executable="${build.src.home}/configure" os="${os.unix}"
1984 dir="${build.src.home}" failonerror="true">
1985 <arg value="--prefix=${gs2build.home}"/>
1986 <arg line="${gs2.opt.args} ${static.arg} ${allargs}"/>
1987 </exec>
1988 </target>
1989
1990 <!-- common-src is done separately and needs to be compiled first -->
1991 <target name="compile-build-src" depends="init" if="collection.building.enabled">
1992
1993 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
1994 <arg line="${ldlpath.arg}"/>
1995 </exec>
1996
1997 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
1998 <arg value="install"/>
1999 </exec>
2000
2001 <!-- run the setup script -->
2002 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
2003 <!--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-->
2004 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2005 <arg value="/f"/>
2006 <arg value="win32.mak"/>
2007 <arg value="GSDLHOME=${gs2build.home}"/>
2008 </exec>
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="install"/>
2013 <arg value="GSDLHOME=${gs2build.home}"/>
2014 </exec>
2015 </target>
2016
2017
2018 <!-- ======================== TESTING Targets ========================= -->
2019
2020 <target name="test" description="Run the (incomplete) JUnit test suite "
2021 depends="init">
2022 <mkdir dir="${basedir}/test"/>
2023 <junit printsummary="withOutAndErr"
2024 errorproperty="test.failed"
2025 failureproperty="test.failed"
2026 fork="${junit.fork}">
2027 <formatter type="plain"/>
2028 <classpath>
2029 <pathelement location="${build.home}/gsdl3test.jar"/>
2030 <path refid="compile.classpath"/>
2031 </classpath>
2032 <test name="${testcase}" if="testcase"/>
2033 <batchtest todir="${basedir}/test" unless="testcase">
2034 <fileset dir="${build.home}" includes="**/*Test.class" />
2035 </batchtest>
2036 </junit>
2037 <echo>
2038 *********************************************
2039 Test output can be found in directory 'test'
2040 *********************************************
2041 </echo>
2042 </target>
2043
2044 <!-- ======================== FLAX Targets ========================= -->
2045 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2046 <echo>checking out flax ...</echo>
2047 <mkdir dir="${basedir}/src/java/org/flax"/>
2048 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
2049 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
2050 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2051 <mkdir dir="${web.home}/interfaces/flax"/>
2052 <mkdir dir="${web.home}/sites/flax"/>
2053 <mkdir dir="${basedir}/flax-resources"/>
2054 <mkdir dir="${basedir}/flax-lib"/>
2055 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2056 <arg value="src/java/org/flax"/></exec>
2057 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2058 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2059 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2060 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2061 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
2062 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2063 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2064 <arg value="${web.home}/interfaces/flax"/></exec>
2065 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2066 <arg value="${web.home}/sites/flax"/></exec>
2067 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2068 <arg value="flax-resources"/></exec>
2069 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2070 <arg value="flax-lib"/></exec>
2071 <antcall target="flax-copy-files" />
2072 </target>
2073
2074 <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
2075 <echo>copying flax files ...</echo>
2076 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2077 <!-- A configuration file containing web service binding information for the axis engine -->
2078 <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
2079 <!-- 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) -->
2080 <copy file="${basedir}/flax-resources/FlaxWebService.wsdl" tofile="${web.home}/FlaxWebService.wsdl" overwrite="true"/>
2081 <copy todir="${web.home}/WEB-INF/lib">
2082 <fileset dir="${basedir}/flax-lib">
2083 <include name="*.jar"/>
2084 </fileset>
2085 </copy>
2086 </target>
2087 <target name="configure-flax-wsdl" description="Configure flax webservice with tomcat server/port">
2088 <rsr file="${web.home}/FlaxWebService.wsdl" pattern="@flaxpublicserver@:@flaxpublicport@" replacement="${tomcat.server}:${tomcat.port}"/>
2089 <echo>FLAX server for Moodle module is configured to: http://${tomcat.server}:${tomcat.port}.</echo>
2090 </target>
2091
2092 <target name="update-flax" description="update flax from repository">
2093 <echo>updating flax ...</echo>
2094 <exec executable="svn"><arg value="update"/>
2095 <arg value="src/java/org/flax"/></exec>
2096 <exec executable="svn"><arg value="update"/>
2097 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2098 <exec executable="svn"><arg value="update"/>
2099 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2100 <exec executable="svn"><arg value="update"/>
2101 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2102 <exec executable="svn"><arg value="update"/>
2103 <arg value="${web.home}/interfaces/flax"/></exec>
2104 <exec executable="svn"><arg value="update"/>
2105 <arg value="flax-resources"/></exec>
2106 <exec executable="svn"><arg value="update"/>
2107 <arg value="flax-lib"/></exec>
2108 <antcall target="flax-copy-files" />
2109 </target>
2110
2111
2112 <target name="compile-javadocs">
2113 <javadoc packagenames="org.greenstone.*"
2114 sourcepath="src/java"
2115 defaultexcludes="yes"
2116 destdir="docs/javadoc"
2117 author="true"
2118 version="true"
2119 use="true"
2120 windowtitle="Greenstone3 API">
2121 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2122 </javadoc>
2123 </target>
2124
2125<!-- ========== Some distribution targets ======================== -->
2126 <target name="remove-source">
2127 <if><bool><isset property="with.gli.and.gems"/></bool>
2128 <delete includeEmptyDirs="true">
2129 <fileset dir="." defaultexcludes="false">
2130 <patternset refid="greenstone3.source.component"/>
2131 </fileset>
2132 </delete>
2133
2134 <else>
2135 <delete includeEmptyDirs="true">
2136 <fileset dir="." defaultexcludes="false">
2137 <patternset refid="greenstone3.source.no.gli.component"/>
2138 </fileset>
2139 </delete>
2140 </else>
2141 </if>
2142 </target>
2143
2144 <target name="dist-tidy"
2145 description="'tidies-up' a greenstone3 installation for distribution.">
2146
2147 <!-- delete unneeded things -->
2148 <delete dir="${packages.home}/axis"/>
2149 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2150 <delete file="README-SVN.txt"/>
2151 <delete file="build.properties.in"/>
2152
2153 <!-- delete source files -->
2154 <antcall target="remove-source"/>
2155
2156 <!-- create empty directories -->
2157 <mkdir dir="${web.home}/applet"/>
2158 <mkdir dir="${web.home}/logs"/>
2159
2160 <!-- os specific tidy-ups -->
2161 <!-- linux, mac -->
2162 <if><bool><istrue value="${current.os.isunix}"/></bool>
2163 <delete><fileset dir="." includes="*.bat"/></delete>
2164 <if><bool><isset property="with.gli.and.gems"/></bool>
2165 <delete><fileset dir="gli" includes="*.bat"/></delete>
2166 </if>
2167 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2168 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
2169 <delete file="${basedir}/gs2build/win32cfg.h"/>
2170 <delete file="${basedir}/gs2build/win32.mak"/>
2171 <delete dir="${basedir}/winutil"/>
2172 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2173
2174 <!-- windows -->
2175 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2176 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
2177 <if><bool><isset property="with.gli.and.gems"/></bool>
2178 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2179 </if>
2180 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2181 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2182 </if></else></if>
2183
2184 </target>
2185
2186 <!-- fix up executable permissions for binary release -->
2187 <target name="fix-execute-permissions">
2188 <echo>Setting binaries to executable</echo>
2189 <chmod perm="775">
2190 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2191 </chmod>
2192 </target>
2193
2194 <!-- fix up executable permissions for source code release -->
2195 <target name="fix-execute-permissions-source">
2196 <chmod perm="775">
2197 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2198 </chmod>
2199 </target>
2200
2201
2202 <!-- ============= tweaks for making compilation static ========== -->
2203 <target name="tweak-makefiles" depends="init" if="compile.static">
2204 <antcall target="rtftohtml-add-static" />
2205 </target>
2206
2207 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2208 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2209 </target>
2210
2211</project>
2212
Note: See TracBrowser for help on using the repository browser.