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

Last change on this file since 25446 was 25446, checked in by ak19, 12 years ago

Related to commit 25445. Whenever the web/logs folder is created, the web/logs/tmp folder is also created so that when an exception happens during transformation of in-memory stylesheets, the stylesheet XSLT and source XML files are written out to this tmp folder to perform the failed transformation on physical files for better error reporting.

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