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

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

Adding targets for checking out and compiling imagemagick from source if the checkout.imagemagick.ext property has been activated in build.properties. These changes work in conjunction with the gnome-lib/CASCADE-MAKE.sh changes just committed which will source the devel.bash in the imagemagick src extension before continuing, since gnome-lib compilation is now thought to depend on imagemagick being present in the linux/mac environment, which may not always be the case. In the latter situation, the checkout.imagemagick.ext flag can be set to true, in which case build.xml will get and compile imagemagick and proceed to hopefully successfully compile gnome-lib thereafter and GS3 can then get compiled up properly.

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