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

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

Adding in the write-env target to write out the environment, which will hopefully help debug the releasekit compilation on the mac.

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