source: greenstone3/trunk/build.xml@ 20235

Last change on this file since 20235 was 20235, checked in by oranfry, 15 years ago

moved tomcat/java check to init and fixed it up a little

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