source: greenstone3/branches/3.03/build.xml@ 14704

Last change on this file since 14704 was 14704, checked in by qq6, 13 years ago

upgraded tomcat from 12 to 25

  • Property svn:keywords set to Author Date Id Revision
File size: 62.9 KB
Line 
1<?xml version="1.0"?>
2
3<!-- ======================================================================
4 March 2005
5
6 Greenstone3 build and install script
7
8 kjdon
9 ====================================================================== -->
10<project name="greenstone3" default="usage" basedir=".">
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
21 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpath="${basedir}/lib/java/anttasks.jar"/>
22 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpath="${basedir}/lib/java/anttasks.jar"/>
23 <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
24 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpath="${basedir}/lib/java/anttasks.jar"/>
25
26
27<!-- ===================== Property Definitions =========================== -->
28
29<!--
30
31 Each of the following properties are used in the build script.
32 Values for these properties are set by the first place they are
33 defined, from the following list:
34
35 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
36
37 * Definitions from a "build.properties" file in the top level
38 source directory of this application.
39
40 * Definitions from a "build.properties" file in the user's
41 home directory.
42
43 * Default definitions in this build.xml file.
44
45 You will note below that property values can be composed based on the
46 contents of previously defined properties. This is a powerful technique
47 that helps you minimize the number of changes required when your development
48 environment is modified. Note that property composition is allowed within
49 "build.properties" files as well as in the "build.xml" script.
50
51-->
52
53 <property file="build.properties"/>
54 <property file="${user.home}/build.properties"/>
55
56 <!-- get properties from the environment -->
57 <property environment="env"/>
58 <property name="build.home" value="${basedir}/build"/>
59 <property name="src.home" value="${basedir}/src/java"/>
60 <property name="src.packages.home" value="${basedir}/src/packages"/>
61 <property name="packages.home" value="${basedir}/packages"/>
62 <!-- this may be set in build.properties, eg if you move the web dir to
63 tomcats webapps directory -->
64 <property name="web.home" value="${basedir}/web"/>
65 <!-- jar files needed by applets go here -->
66 <property name="web.applet" value="${web.home}/applet"/>
67 <!-- jar files needed by the servlet (and extra ones) go here -->
68 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
69 <!-- other files needed by the servlet go here -->
70 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
71 <!-- jni libraries and java wrappers go here -->
72 <property name="lib.jni" value="${basedir}/lib/jni"/>
73
74 <property name="javadocs" value="${basedir}/docs/javadoc"/>
75
76 <property name="app.name" value="greenstone3"/>
77 <property name="app.path" value="/${app.name}"/>
78
79
80 <!-- version number stuff -->
81
82 <!-- app.version defaults to trunk -->
83 <condition property="app.version" value="trunk">
84 <not><isset property="app.version"/></not>
85 </condition>
86
87 <!-- determine the 'branch path' -->
88 <condition property="branch.path" value="trunk">
89 <equals arg1="${app.version}" arg2="trunk" />
90 </condition>
91 <condition property="branch.path" value="branches/${app.version}">
92 <not><equals arg1="${app.version}" arg2="trunk" /></not>
93 </condition>
94
95
96 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
97
98 <property name="svn.root" value="http://svn.greenstone.org"/>
99<!-- <property name="cvs.root" value=":pserver:cvs_anon@cvs.scms.waikato.ac.nz:2402/usr/local/global-cvs/gsdl-src"/> -->
100 <!-- catalina home is set to tomcat basedir is already installed, otherwise
101 use greenstone's tomcat -->
102 <condition property="catalina.home" value="${tomcat.installed.path}">
103 <and>
104 <isset property="tomcat.installed.path"/>
105 <not>
106 <equals arg1="" arg2="${tomcat.installed.path}"/>
107 </not>
108 </and>
109 </condition>
110 <property name="catalina.home" value="${packages.home}/tomcat"/>
111
112 <property name="os.linux" value="Linux"/>
113 <property name="os.mac" value="Mac OS X"/>
114 <property name="os.solaris" value="SunOS"/>
115 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
116 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP,Windows NT,Windows ME"/> <!-- check this!!!-->
117
118 <!-- this is true for linux and macs -->
119 <condition property="current.os.isunix">
120 <os family="unix"/>
121 </condition>
122
123 <condition property="current.os.isunixnotmac">
124 <and>
125 <os family="unix"/>
126 <not>
127 <os family="mac"/>
128 </not>
129 </and>
130 </condition>
131 <condition property="current.os.ismac">
132 <os family="mac"/>
133 </condition>
134
135 <condition property="current.os.iswindows">
136 <os family="windows"/>
137 </condition>
138
139 <condition property="collection.building.enabled">
140 <not>
141 <isset property="disable.collection.building"/>
142 </not>
143 </condition>
144
145 <condition property="collection.building.enabled.windows">
146 <and>
147 <isset property="collection.building.enabled"/>
148 <isset property="current.os.iswindows"/>
149 </and>
150 </condition>
151
152 <condition property="collection.building.enabled.unix">
153 <and>
154 <isset property="collection.building.enabled"/>
155 <isset property="current.os.isunix"/>
156 </and>
157 </condition>
158
159 <condition property="independent-indexers">
160 <isset property="disable.collection.building"/>
161 </condition>
162
163 <!-- ============= Base dirs for each package and component ============ -->
164 <property name="src.applet.home" value="${src.home}/org/greenstone/applet"/>
165 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
166 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
167 <property name="gs2build.home" value="${basedir}/gs2build"/>
168 <property name="gli.home" value="${basedir}/gli"/>
169 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
170
171 <!--<property name="indexers.home" value="${basedir}/src/packages/indexers">-->
172 <condition property="indexers.home" value="${basedir}/src/packages/indexers">
173 <isset property="disable.collection.building"/>
174 </condition>
175 <condition property="indexers.home" value="${gs2build.home}/indexers">
176 <not>
177 <isset property="disable.collection.building"/>
178 </not>
179 </condition>
180
181 <property name="mg.home" value="${indexers.home}/mg"/>
182 <property name="mgpp.home" value="${indexers.home}/mgpp"/>
183 <property name="lucene.home" value="${indexers.home}/lucene-gs"/>
184
185
186<!-- ==================== Compilation Control Options ==================== -->
187
188<!--
189
190 These properties control option settings on the Javac compiler when it
191 is invoked using the <javac> task.
192
193 compile.debug Should compilation include the debug option?
194
195 compile.deprecation Should compilation include the deprecation option?
196
197 compile.optimize Should compilation include the optimize option?
198
199-->
200
201 <property name="compile.debug" value="true"/>
202 <property name="compile.deprecation" value="true"/>
203 <property name="compile.optimize" value="true"/>
204
205<!--
206
207 Rather than relying on the CLASSPATH environment variable, Ant includes
208 features that makes it easy to dynamically construct the classpath you
209 need for each compilation. The example below constructs the compile
210 classpath to include the servlet.jar file, as well as the other components
211 that Tomcat makes available to web applications automatically, plus anything
212 that you explicitly added.
213
214-->
215
216 <path id="compile.classpath">
217 <!-- Include all jar files and libraries in our jni lib directory -->
218 <pathelement location="${lib.jni}"/>
219 <fileset dir="${lib.jni}">
220 <include name="*.jar"/>
221 </fileset>
222 <!-- Include all jar files in our web lib directory -->
223 <pathelement location="${web.lib}"/>
224 <fileset dir="${web.lib}">
225 <include name="*.jar"/>
226 </fileset>
227
228 <!-- Include the axis jar files -->
229 <!--<fileset dir="${basedir}/comms/soap/axis/lib">
230 <include name="*.jar"/>
231 </fileset>-->
232
233 <!-- include the jar files from the source packages -->
234 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
235 so we add them in by name -->
236 <pathelement location="${lib.jni}/mg.jar"/>
237 <pathelement location="${lib.jni}/mgpp.jar"/>
238
239 <!-- Include all elements that Tomcat exposes to applications -->
240 <pathelement location="${catalina.home}/common/classes"/>
241 <fileset dir="${catalina.home}/common/endorsed">
242 <include name="*.jar"/>
243 </fileset>
244 <fileset dir="${catalina.home}/common/lib">
245 <include name="*.jar"/>
246 </fileset>
247 <pathelement location="${catalina.home}/shared/classes"/>
248 <fileset dir="${catalina.home}/shared/lib">
249 <include name="*.jar"/>
250 </fileset>
251 </path>
252
253 <path id="local.tomcat.classpath">
254 <!-- explicitly include the jni java wrappers in the classpath -->
255 <pathelement location="${lib.jni}"/>
256 <fileset dir="${lib.jni}">
257 <include name="*.jar"/>
258 </fileset>
259 </path>
260
261 <path id="local.tomcat.path">
262 <pathelement location="${basedir}/bin/script"/>
263 <pathelement location="${basedir}/bin"/>
264 <pathelement location="${lib.jni}"/>
265 <pathelement path="${env.PATH}"/>
266 <pathelement path="${env.Path}"/>
267 </path>
268
269 <target name="test-setup">
270 <echo>ant java version=${ant.java.version}</echo>
271 <echo>is unix : ${current.os.isunix}</echo>
272 <echo>is mac : ${current.os.ismac}</echo>
273 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
274 <echo>is windows : ${current.os.iswindows}</echo>
275 <echo>os.unix: ${os.unix}</echo>
276 </target>
277<!-- ==================== Primary and Global Targets ============================= -->
278
279 <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
280
281 <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections"
282 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.">
283<!-- <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections"
284 description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional cvs checkouts and downloads, so you need to be online to run this.">-->
285
286 <!-- make sure .sh files are executable -->
287 <chmod dir="${basedir}" perm="ugo+rx"
288 includes="*.sh"/>
289 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
290 includes="*.sh,*.pl"/>
291 </target>
292 <target name="install" depends="init,install-indexer-files,configure,configure-c++,compile"
293 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare install'."/>
294
295<!-- <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building,cvsupdate-web"
296 description="Do a cvs update for all sources. Doesn't recompile the code. You need to be online to run this."/>-->
297 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-gs2building,svnupdate-web"
298 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
299
300
301 <target name="configure-c++" depends="init,configure-packages,configure-core,configure-gs2building"
302 description="Configure any C/C+/+ package code and gs2building code if necessary"/>
303
304 <target name="configure" depends="init,configure-tomcat,configure-web"
305 description="Configure the installation. Includes setting up config files. Should be re-run if you change the build.properties file."/>
306
307 <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building"
308 description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
309
310 <target name="compile" depends="init,compile-web,compile-packages,compile-core,compile-gs2building"
311 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
312
313 <target name="update" depends="init,svnupdate,clean,configure,configure-c++,compile"
314 description="Update (thru Subversion) all the source (including core, packages and gs2building), then clean, configure and recompile."/>
315
316 <target name="start" depends="init,start-tomcat"
317 description="Startup the Tomcat server." />
318
319 <target name="stop" depends="init,stop-tomcat"
320 description="Shutdown the Tomcat server."/>
321
322 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
323
324
325<!-- =========== Help targets =================================== -->
326
327 <property name="install-command" value="ant [options] prepare install"/>
328
329 <target name="usage" description="Print a help message">
330 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
331 <echo message=" Execute 'ant -help' for Ant help."/>
332 <echo>To install Greenstone3, run '${install-command}'.
333There 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.
334To log the output, use the '-logfile build.log' option.
335The README.txt file has more information about the ant targets and install process.
336 </echo>
337 </target>
338
339 <target name="help" depends="usage" description="Print a help message"/>
340
341 <target name="debug" depends="init" description="Display all the currently used properties">
342 <echoproperties/>
343 </target>
344
345<!-- ====== initialization and setup targets ================== -->
346
347 <target name="accept-properties" unless="properties.accepted">
348 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
349tomcat.server=${tomcat.server}
350tomcat.port=${tomcat.port}
351tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
352proxy.host=${proxy.host}
353proxy.port=${proxy.port}
354If these are not acceptable, please change them and rerun this target. Continue [y/n]? />
355 </input>
356 <condition property="do.abort">
357 <equals arg1="n" arg2="${properties.ok}"/>
358 </condition>
359 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
360 </target>
361
362<!-- <target name="check-cvsroot">
363 <condition property="svnroot.notset">
364 <or>
365 <not>
366 <isset property="env.CVSROOT"/>
367 </not>
368 <equals arg1="" arg2="${env.CVSROOT}"/>
369 </or>
370 </condition>
371 <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/>
372 </target> -->
373
374 <!-- this sets up some initial properties -->
375 <target name="init">
376
377 <condition property="java.too.old">
378 <or>
379 <equals arg1="1.1" arg2="${ant.java.version}"/>
380 <equals arg1="1.2" arg2="${ant.java.version}"/>
381 <equals arg1="1.3" arg2="${ant.java.version}"/>
382 </or>
383 </condition>
384 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
385
386 <available file="${indexers.home}" property="indexers.present"/>
387 <available file="${basedir}/gli" property="gli.present"/>
388 <available file="${basedir}/gs2build" property="gs2build.present"/>
389
390 <condition property="tomcat.islocal">
391 <or>
392 <not>
393 <isset property="tomcat.installed.path"/>
394 </not>
395 <equals arg1="" arg2="${tomcat.installed.path}"/>
396 </or>
397 </condition>
398
399 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo>
400 <condition property="proxy.present">
401 <and>
402 <isset property="proxy.host"/>
403 <not>
404 <equals arg1="" arg2="${proxy.host}"/>
405 </not>
406 </and>
407 </condition>
408
409 <condition property="need.macos.extra">
410 <and>
411 <isset property="current.os.ismac"/>
412 <not>
413 <isset property="disable.collection.building"/>
414 </not>
415 </and>
416 </condition>
417 </target>
418
419 <target name="setup-proxy" depends="init" if="proxy.present">
420 <condition property="ask.user">
421 <or>
422 <equals arg1="" arg2="${proxy.user}"/>
423 <equals arg1="" arg2="${proxy.password}"/>
424 </or>
425 </condition>
426 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
427 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
428 </target>
429
430 <!-- ========== Web app Targets ================================ -->
431
432 <target name="prepare-web" depends="init,configure-java-version">
433 <mkdir dir="${web.home}/applet"/>
434 <mkdir dir="${web.home}/logs"/>
435 </target>
436
437 <!-- 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 -->
438 <target name="configure-java-version" depends="init"
439 description="Run this target if you have changed the default version of java since installing greenstone3">
440 <condition property="need.xalan.jar">
441 <equals arg1="1.5" arg2="${ant.java.version}"/>
442 </condition>
443 <antcall target="activate-xalan-jar"/>
444 <antcall target="deactivate-xalan-jar"/>
445 </target>
446
447 <target name="activate-xalan-jar" if="need.xalan.jar">
448 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
449 </target>
450
451 <target name="deactivate-xalan-jar" unless="need.xalan.jar">
452 <delete file="${web.lib}/xalan.jar"/>
453 </target>
454
455 <target name="prepare-collections" depends="init">
456 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
457 <!-- gs2mgdemo -->
458 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
459 dest="${collect.dir}/gs2mgdemo"/>
460 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
461 dest="${collect.dir}/gs2mgdemo"/>
462 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
463 dest="${collect.dir}/gs2mgdemo/index"/>
464 <delete file="${collect.dir}/gs2mgdemo/import.zip"/>
465 <delete file="${collect.dir}/gs2mgdemo/metadata.zip"/>
466 <delete file="${collect.dir}/gs2mgdemo/index/index.zip"/>
467 <!-- gs2mgppdemo -->
468 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
469 dest="${collect.dir}/gs2mgppdemo"/>
470 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
471 dest="${collect.dir}/gs2mgppdemo"/>
472 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
473 dest="${collect.dir}/gs2mgppdemo/index"/>
474 <delete file="${collect.dir}/gs2mgppdemo/import.zip"/>
475 <delete file="${collect.dir}/gs2mgppdemo/metadata.zip"/>
476 <delete file="${collect.dir}/gs2mgppdemo/index/index.zip"/>
477 <!-- gberg -->
478 <unzip src="${collect.dir}/gberg/index/index.zip"
479 dest="${collect.dir}/gberg/index"/>
480 <delete file="${collect.dir}/gberg/index/index.zip"/>
481 </target>
482
483
484 <target name="configure-web" depends="init"
485 description="Configure only the web app config files">
486 <!-- we want a unix path in the global.properties file -->
487 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
488 <path path="${web.home}"/>
489 </pathconvert>
490 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
491 <filter token="gsdl3version" value="${app.version}"/>
492 <filter token="tomcat.server" value="${tomcat.server}"/>
493 <filter token="tomcat.port" value="${tomcat.port}"/>
494 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
495 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
496 <chmod file="${web.classes}/global.properties" perm="600"/>
497 <chmod file="${web.classes}/log4j.properties" perm="600"/>
498 </target>
499
500 <target name="compile-web" depends="init">
501 <javac srcdir="${web.classes}"
502 destdir="${web.classes}"
503 debug="${compile.debug}"
504 deprecation="${compile.deprecation}"
505 optimize="${compile.optimize}">
506 <classpath>
507 <path refid="compile.classpath"/>
508 </classpath>
509 </javac>
510 </target>
511
512 <target name="svnupdate-web" unless="nosvn.mode">
513 <svn>
514 <update dir="${web.home}"/>
515 </svn>
516 </target>
517
518 <target name="update-web" depends="init,svnupdate-web,configure-web"
519 description="update only the web stuff (config files)"/>
520
521
522<!-- ======================= Tomcat Targets ========================== -->
523
524 <!-- this target downloads and installs Tomcat -->
525 <!-- we download tomcat and the compat module - its needed for 1.4, and doesn't seem to harm 1.5 -->
526 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
527
528 <!-- check that packages dir is there -->
529 <mkdir dir="${packages.home}"/>
530 <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.25.zip"
531 dest="${packages.home}/apache-tomcat-5.5.25.zip"
532 usetimestamp="true"/>
533 <unzip src="${packages.home}/apache-tomcat-5.5.25.zip"
534 dest="${packages.home}"/>
535 <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.25-compat.zip"
536 dest="${packages.home}/apache-tomcat-5.5.25-compat.zip"
537 usetimestamp="true"/>
538 <unzip src="${packages.home}/apache-tomcat-5.5.25-compat.zip"
539 dest="${packages.home}"/>
540 <!-- delete any existing tomcat -->
541 <delete dir="${packages.home}/tomcat"/>
542 <move todir="${packages.home}/tomcat">
543 <fileset dir="${packages.home}/apache-tomcat-5.5.25"/>
544 </move>
545 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
546 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
547 overwrite="true"/>
548 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
549 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
550 overwrite="true"/>
551 <!-- make sure we have execute permission for the .sh files -->
552 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
553 includes="*.sh"/>
554 </target>
555
556 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
557
558 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
559 <!-- re-setup the server.xml file -->
560 <copy file="${basedir}/resources/tomcat/server.xml" tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
561 <filterset>
562 <filter token="port" value="${tomcat.port}"/>
563 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
564 </filterset>
565 </copy>
566 <!-- set up the greenstone3 context -->
567 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
568 <filterset>
569 <filter token="gsdl3webhome" value="${basedir}/web"/>
570 </filterset>
571 </copy>
572 </target>
573
574 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
575 <!-- re-setup the server.xml file -->
576 <!-- need to edit the config file, or do we get the user to do this???-->
577 </target>
578
579 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
580 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
581 <property name="tomcat.path" refid="local.tomcat.path"/>
582 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
583 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
584 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
585 <env key="GSDL3HOME" value="${basedir}"/>
586 <env key="PATH" path="${tomcat.path}"/>
587 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
588 <env key="CATALINA_HOME" value="${catalina.home}"/>
589 <env key="CLASSPATH" path="${tomcat.classpath}"/>
590 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
591 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.installed.path}/lib"/> <!-- for mac os -->
592 </exec>
593 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
594 <env key="GSDLOS" value="windows"/>
595 <env key="GSDL3HOME" value="${basedir}"/>
596 <env key="Path" path="${tomcat.path}"/>
597 <env key="PATH" path="${tomcat.path}"/>
598 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
599 <env key="CLASSPATH" path="${tomcat.classpath}"/>
600 </exec>
601 <!-- wait for the server to startup in case other targets need it running -->
602 <waitfor maxwait="5" maxwaitunit="second">
603 <and>
604 <socket server="${tomcat.server}" port="${tomcat.port}"/>
605 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
606 </and>
607 </waitfor>
608 </target>
609 <!-- windows: do we want to launch a webrowser?? -->
610 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
611 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
612 <env key="CATALINA_HOME" value="${catalina.home}"/>
613 </exec>
614 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/>
615 </target>
616
617 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
618
619 <target name="setup-catalina-ant-tasks">
620 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
621 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
622 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
623 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
624 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
625 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
626 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
627 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
628 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
629 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
630 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
631 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
632 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
633 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
634 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
635 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
636 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
637 </target>
638
639
640
641
642
643
644<!-- ======================= ant Targets ============================ -->
645 <target name="prepare-ant" depends="init">
646 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
647 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
648 usetimestamp="true"/>
649 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
650 dest="${packages.home}"/>
651 <move todir="${packages.home}/ant">
652 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
653 </move>
654 </target>
655
656<!-- ======================= Axis Targets ============================ -->
657
658 <target name="prepare-axis" depends="init">
659 <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
660 dest="${packages.home}/axis-bin-1_2_1.zip"
661 usetimestamp="true"/>
662 <unzip src="${packages.home}/axis-bin-1_2_1.zip"
663 dest="${packages.home}"/>
664 <move todir="${packages.home}/axis">
665 <fileset dir="${packages.home}/axis-1_2_1"/>
666 </move>
667 <!-- install axis into greenstone web app -->
668 <copy todir="${web.lib}">
669 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
670 <include name="*.jar"/>
671 </fileset>
672 </copy>
673 <copy todir="${web.home}">
674 <fileset dir="${packages.home}/axis/webapps/axis/">
675 <include name="*.jsp"/>
676 <include name="*.jws"/>
677 </fileset>
678 </copy>
679 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
680 <copy todir="${web.classes}">
681 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
682 <include name="*.properties"/>
683 </fileset>
684 </copy>
685 </target>
686
687 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,create-deployment-files,deploy-site"
688 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
689
690 <target name="deploy-site">
691 <java classname="org.apache.axis.client.AdminClient">
692 <classpath refid="compile.classpath"/>
693 <arg value="-l"/>
694 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
695 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
696 </java>
697 </target>
698
699 <target name="soap-undeploy-site" depends="get-sitename"
700 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
701 <java classname="org.apache.axis.client.AdminClient">
702 <classpath refid="compile.classpath"/>
703 <arg value="-l"/>
704 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
705 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
706 </java>
707 </target>
708
709 <!-- this target used to deploy the preprepared localsite server -->
710 <target name="deploy-localsite" depends="init"
711 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
712 <antcall target="start-tomcat"/>
713 <antcall target="deploy-site">
714 <param name="axis.sitename" value="localsite"/>
715 </antcall>
716 <antcall target="stop-tomcat"/>
717 </target>
718
719 <target name="get-sitename" unless="axis.sitename">
720 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
721 </target>
722
723 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
724 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
725 <echo>${axis.sitename}, ${axis.siteuri}</echo>
726 </target>
727
728 <target name="check-deployment-files" depends="get-sitename">
729 <condition property="deploy.exists">
730 <and>
731 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
732 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
733 <available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
734 </and>
735 </condition>
736 </target>
737
738 <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files"
739 if="axis.sitename" unless="deploy.exists">
740 <filter token="sitename" value="${axis.sitename}"/>
741 <filter token="siteuri" value="${axis.siteuri}"/>
742 <copy file="${basedir}/resources/soap/site.wsdd.template"
743 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
744 filtering="true"/>
745 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
746 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
747 filtering="true"/>
748 <!-- create the java files and compile them -->
749 <copy file="${basedir}/resources/java/SOAPServer.java.in"
750 tofile="${src.gsdl3.home}/SOAPServer${axis.sitename}.java"
751 filtering="true"/>
752 <mkdir dir="${build.home}"/>
753 <javac srcdir="${src.home}"
754 destdir="${build.home}"
755 debug="${compile.debug}"
756 deprecation="${compile.deprecation}"
757 optimize="${compile.optimize}">
758 <classpath refid="compile.classpath"/>
759 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
760 </javac>
761 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
762 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
763 </target>
764
765
766<!-- ====================== Core targets ============================== -->
767<!-- core targets refer to the core gsdl3 java src -->
768
769 <target name="prepare-core" unless="nocvs.mode">
770 <!-- just get rid of empty directories-->
771 <svn>
772 <update dir="."/>
773 </svn>
774 </target>
775
776 <target name="configure-core"/>
777
778 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
779 description="Update only the Greenstone core" />
780
781 <target name="svnupdate-core" unless="nocvs.mode">
782
783 <svn>
784 <update dir="." recurse="false"/>
785 </svn>
786
787 <svn>
788 <update dir="bin"/>
789 <update dir="comms"/>
790 <update dir="dist-resources"/>
791 <update dir="docs"/>
792 <update dir="lib"/>
793 <update dir="resources"/>
794 <update dir="src"/>
795 <update dir="winutil"/>
796 </svn>
797
798 </target>
799
800 <target name="clean-core"
801 description="Clean only the Greenstone core">
802 <delete dir="${build.home}"/>
803 </target>
804
805 <target name="compile-core" depends="init"
806 description="Compile only the Greenstone core">
807 <mkdir dir="${build.home}"/>
808 <javac srcdir="${src.home}"
809 destdir="${build.home}"
810 debug="${compile.debug}"
811 deprecation="${compile.deprecation}"
812 optimize="${compile.optimize}">
813 <classpath>
814 <path refid="compile.classpath"/>
815 </classpath>
816 </javac>
817 <jar destfile="${build.home}/gsdl3.jar">
818 <fileset dir="${build.home}">
819 <include name="org/greenstone/gsdl3/**"/>
820 <include name="org/flax/**"/>
821 <exclude name="**/Test.class"/>
822 </fileset>
823 <manifest>
824 <attribute name="Built-By" value="${user.name}" />
825 </manifest>
826 </jar>
827 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
828 <!-- copy the localsite server in case we need it -->
829 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServerlocalsite.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServerlocalsite.class" />
830
831 <jar destfile="${build.home}/GAI.jar">
832 <fileset dir="${build.home}">
833 <include name="org/greenstone/admin/**"/>
834 </fileset>
835 <manifest>
836 <attribute name="Built-By" value="${user.name}" />
837 </manifest>
838 </jar>
839
840 <jar destfile="${build.home}/phind.jar">
841 <fileset dir="${build.home}">
842 <include name="org/greenstone/applet/phind/**"/>
843 </fileset>
844 <manifest>
845 <attribute name="Built-By" value="${user.name}" />
846 </manifest>
847 </jar>
848 <mkdir dir="${web.applet}"/>
849 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
850 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
851 <copy file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar" todir="${web.applet}"/>
852 <copy file="${packages.home}/tomcat/common/endorsed/xml-apis.jar" todir="${web.applet}"/>
853 <jar destfile="${build.home}/anttasks.jar">
854 <fileset dir="${build.home}">
855 <include name="org/greenstone/anttasks/**"/>
856 </fileset>
857 <manifest>
858 <attribute name="Built-By" value="${user.name}" />
859 </manifest>
860 </jar>
861 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
862 <jar destfile="${build.home}/gsdl3test.jar">
863 <fileset dir="${build.home}">
864 <include name="org/greenstone/gsdl3/**/*Test.class"/>
865 <include name="org/greenstone/testing/**"/>
866 </fileset>
867 <manifest>
868 <attribute name="Built-By" value="${user.name}" />
869 </manifest>
870 </jar>
871 <jar destfile="${build.home}/server.jar">
872 <fileset dir="${build.home}">
873 <include name="org/greenstone/server/**"/>
874 </fileset>
875 <fileset file="${basedir}/resources/java/server.properties"/>
876 <manifest>
877 <attribute name="Built-By" value="${user.name}"/>
878 </manifest>
879 </jar>
880 <copy file="${build.home}/server.jar" todir="${basedir}"/>
881 </target>
882
883<!-- ================== Packages targets ================================ -->
884 <!-- these targets refer to the greenstone source packages - these need
885 updating less often, so are in separate targets to the core -->
886 <target name="prepare-packages" depends="init,prepare-indexers"/>
887
888 <target name="checkout-indexers" depends="init" if="independent-indexers" unless="nocvs.mode">
889<!-- <target name="checkout-indexers" depends="check-svnroot,init" if="independent-indexers" unless="nocvs.mode"> -->
890 <svn>
891 <checkout url="${svn.root}/indexers/${branch.path}" dest="${src.packages.home}/indexers"/>
892 </svn>
893 </target>
894
895 <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
896 <antcall target="checkout-indexers"/>
897 </target>
898
899 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
900 description="Update only the source packages"/>
901
902 <target name="svnupdate-packages" unless="nocvs.mode">
903 <svn>
904 <update dir="${src.packages.home}"/>
905 </svn>
906 </target>
907
908 <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers"
909 description="Configure only the packages."/>
910
911 <target name="configure-javagdbm">
912 <echo>
913 Configuring JavaGDBM
914 </echo>
915 <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
916 dir="${javagdbm.home}">
917 <arg value="--prefix=${basedir}"/>
918 <arg value="--libdir=${lib.jni}"/>
919 </exec>
920 <exec executable="${javagdbm.home}/configure" os="${os.mac}"
921 dir="${javagdbm.home}">
922 <arg value="--prefix=${basedir}"/>
923 <arg value="--libdir=${lib.jni}"/>
924 <arg value="--with-gdbm=${gdbm.installed.path}"/>
925 </exec>
926 </target>
927
928<!-- Message from oran. I removed the condition from this line becuase it meant
929 the indexers would only be configured if collection building was DISabled.
930 Shouldn't they be configured when collection building is ENabled? -->
931
932<!-- <target name="configure-indexers" depends="init" if="independent-indexers"> -->
933<target name="configure-indexers" depends="init">
934 <echo>Configuring Indexers</echo>
935 <exec executable="${indexers.home}/configure" os="${os.unix}" dir="${indexers.home}">
936 <arg value="--prefix=${basedir}"/>
937 <arg value="--libdir=${lib.jni}"/>
938 </exec>
939 </target>
940
941 <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
942
943 <target name="clean-javagdbm" depends="init">
944 <exec executable="make" os="${os.unix}"
945 dir="${javagdbm.home}">
946 <arg value="clean"/>
947 </exec>
948 </target>
949
950 <target name="clean-indexers" depends="init" if="independent-indexers">
951 <exec executable="make" os="${os.unix}"
952 dir="${indexers.home}">
953 <arg value="clean"/>
954 </exec>
955 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
956 dir="${indexers.home}">
957 <arg value="clean"/>
958 </exec>
959
960 </target>
961
962 <target name="compile-packages" description="Compile only the source packages">
963
964 <!-- javagdbm -->
965 <echo>compile javagdbm</echo>
966 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}"/>
967 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}">
968 <arg value="install"/>
969 </exec>
970
971 <!-- windows: just the java stuff. -->
972 <echo>Windows: compile javagdbm (java only)</echo>
973 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}">
974 <arg value="compile"/>
975 <arg value="javaonly"/>
976 </exec>
977
978 <!-- install the jar file -->
979 <echo>Install the javagdbm jar file</echo>
980 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
981
982 <!-- Indexers -->
983
984 <!-- this may be in gs2build - we will be recompiling, but never mind -->
985 <echo>Indexers: make (from ${indexers.home})</echo>
986 <exec executable="make" os="${os.unix}" dir="${indexers.home}"/>
987 <echo>Indexers: make install</echo>
988 <exec executable="make" os="${os.unix}" dir="${indexers.home}">
989 <arg value="install"/>
990 </exec>
991
992 <echo>Indexers: make</echo>
993 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
994 <arg value="all"/>
995 </exec>
996 <echo>Indexers: make install</echo>
997 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
998 <arg value="install"/>
999 </exec>
1000
1001 <!-- install the jar and jni files -->
1002 <echo>Install the indexers' jar and jni files</echo>
1003 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1004 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1005 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1006 <antcall target="install-jni-files"/>
1007 </target>
1008
1009 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1010
1011 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1012 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1013 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1014 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1015 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1016 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1017 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1018 </target>
1019 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1020 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1021 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1022 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1023 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1024 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1025 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1026 </target>
1027 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1028 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1029 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1030 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1031 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1032 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1033 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1034 </target>
1035
1036 <!-- ================== gs2building targets ===============-->
1037
1038
1039 <target name="update-gs2building" if="collection.building.enabled"
1040 depends="init,svnupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1041 description="Update only the Greenstone 2 building components"/>
1042
1043 <target name="svnupdate-gs2building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nocvs.mode">
1044 </target>
1045 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nocvs.mode">
1046 <!-- Note: can't do a -d update here cos it will get all of gsdl
1047 also, an update doesn't get new files, so we do a checkout instead. -->
1048 <antcall target="checkout-gs2build"/>
1049 </target>
1050
1051 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nocvs.mode">
1052 <svn>
1053 <update dir="${gli.home}"/>
1054 </svn>
1055 </target>
1056
1057 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1058 </target>
1059
1060 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nocvs.mode">
1061 <echo>checking out gs2build</echo>
1062 <!-- svn checkouts -->
1063 <svn>
1064 <!-- perllib -->
1065 <checkout url="${svn.root}/gsdl/${branch.path}/perllib" destPath="gs2build/perllib"/>
1066
1067 <!-- selected packages -->
1068 <checkout url="${svn.root}/gsdl/${branch.path}/packages/cpan" destPath="gs2build/packages/cpan"/>
1069 <checkout url="${svn.root}/gsdl/${branch.path}/packages/expat" destPath="gs2build/packages/expat"/>
1070 <checkout url="${svn.root}/gsdl/${branch.path}/packages/html-tidy" destPath="gs2build/packages/html-tidy"/>
1071 <checkout url="${svn.root}/gsdl/${branch.path}/packages/isis-gdl" destPath="gs2build/packages/isis-gdl"/>
1072 <checkout url="${svn.root}/gsdl/${branch.path}/packages/kea" destPath="gs2build/packages/kea"/>
1073 <checkout url="${svn.root}/gsdl/${branch.path}/packages/pdftohtml" destPath="gs2build/packages/pdftohtml"/>
1074 <checkout url="${svn.root}/gsdl/${branch.path}/packages/rtftohtml" destPath="gs2build/packages/rtftohtml"/>
1075 <checkout url="${svn.root}/gsdl/${branch.path}/packages/w3mir" destPath="gs2build/packages/w3mir"/>
1076 <checkout url="${svn.root}/gsdl/${branch.path}/packages/wget" destPath="gs2build/packages/wget"/>
1077 <checkout url="${svn.root}/gsdl/${branch.path}/packages/windows" destPath="gs2build/packages/windows"/>
1078 <checkout url="${svn.root}/gsdl/${branch.path}/packages/wv" destPath="gs2build/packages/wv"/>
1079 <checkout url="${svn.root}/gsdl/${branch.path}/packages/xlhtml" destPath="gs2build/packages/xlhtml"/>
1080 <checkout url="${svn.root}/gsdl/${branch.path}/packages/yaz" destPath="gs2build/packages/yaz"/>
1081
1082 <!-- some of src (db2txt hashfile phind txt2db) -->
1083 <checkout url="${svn.root}/gsdl/${branch.path}/src/db2txt" destPath="gs2build/src/db2txt"/>
1084 <checkout url="${svn.root}/gsdl/${branch.path}/src/hashfile" destPath="gs2build/src/hashfile"/>
1085 <checkout url="${svn.root}/gsdl/${branch.path}/src/phind" destPath="gs2build/src/phind"/>
1086 <checkout url="${svn.root}/gsdl/${branch.path}/src/txt2db" destPath="gs2build/src/txt2db"/>
1087
1088 <!-- bin -->
1089 <checkout url="${svn.root}/gsdl/${branch.path}/bin/script" destPath="gs2build/bin/script"/>
1090
1091 <!-- mappings -->
1092 <checkout url="${svn.root}/gsdl/${branch.path}/mappings" destPath="gs2build/mappings"/>
1093
1094 <!-- etc/packages -->
1095 <checkout url="${svn.root}/gsdl/${branch.path}/etc/packages" destPath="gs2build/etc/packages"/>
1096
1097 <!-- collect -->
1098 <checkout url="${svn.root}/gsdl/${branch.path}/collect/modelcol" destPath="gs2build/collect/modelcol"/>
1099
1100 <!-- gs2build-extra -->
1101 <checkout url="${svn.root}/other-projects/trunk/gs2build-extra" destPath="gs2build/gs2build-extra"/>
1102
1103 <!-- indexers -->
1104 <checkout url="${svn.root}/indexers/${branch.path}" destPath="gs2build/indexers"/>
1105
1106
1107 </svn>
1108 <!-- regular downloads -->
1109
1110 <!-- some files from lib -->
1111 <mkdir dir="gs2build/lib"/>
1112 <get src="${svn.root}/gsdl/${branch.path}/lib/text_t.h" dest="gs2build/lib/text_t.h"/>
1113 <get src="${svn.root}/gsdl/${branch.path}/lib/text_t.cpp" dest="gs2build/lib/text_t.cpp"/>
1114 <get src="${svn.root}/gsdl/${branch.path}/lib/gsdlconf.h" dest="gs2build/lib/gsdlconf.h"/>
1115
1116 <!-- some files from etc -->
1117 <get src="${svn.root}/gsdl/${branch.path}/etc/marctodc.txt" dest="gs2build/etc/marctodc.txt"/>
1118 <get src="${svn.root}/gsdl/${branch.path}/etc/dc2marc-mapping.xml" dest="gs2build/etc/dc2marc-mapping.xml"/>
1119 <get src="${svn.root}/gsdl/${branch.path}/etc/dc2marc.xsl" dest="gs2build/etc/dc2marc.xsl"/>
1120 <get src="${svn.root}/gsdl/${branch.path}/etc/qdc2marc-mapping.xml" dest="gs2build/etc/qdc2marc-mapping.xml"/>
1121
1122 <!-- some files from the gsdl root directory -->
1123 <get src="${svn.root}/gsdl/${branch.path}/setup.bash" dest="gs2build/setup.bash"/>
1124 <get src="${svn.root}/gsdl/${branch.path}/config.sub" dest="gs2build/config.sub"/>
1125 <get src="${svn.root}/gsdl/${branch.path}/config.guess" dest="gs2build/config.guess"/>
1126 <get src="${svn.root}/gsdl/${branch.path}/config.h.in" dest="gs2build/config.h.in"/>
1127 <get src="${svn.root}/gsdl/${branch.path}/configtest.pl" dest="gs2build/configtest.pl"/>
1128 <get src="${svn.root}/gsdl/${branch.path}/install-sh" dest="gs2build/install-sh"/>
1129 <get src="${svn.root}/gsdl/${branch.path}/acconfig.h" dest="gs2build/acconfig.h"/>
1130 <get src="${svn.root}/gsdl/${branch.path}/aclocal.m4" dest="gs2build/aclocal.m4"/>
1131 <get src="${svn.root}/gsdl/${branch.path}/WIN32cfg.h" dest="gs2build/WIN32cfg.h"/>
1132
1133 </target>
1134
1135 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1136 <antcall target="checkout-gs2build"/>
1137 <antcall target="rename-gs2build-files"/>
1138 <antcall target="unzip-windows-packages"/>
1139 <antcall target="checkout-winbin"/>
1140 <antcall target="get-windows-binaries"/>
1141 <antcall target="delete-winbin"/>
1142 <antcall target="get-macos-extra"/>
1143 </target>
1144
1145 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1146 unless="nocvs.mode">
1147 <svn>
1148 <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin"/>
1149 </svn>
1150 </target>
1151
1152 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nocvs.mode">
1153 <svn>
1154 <update dir="${svn.root}/other-projects/trunk/winbin"/>
1155 </svn>
1156 </target>
1157
1158 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1159 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1160 <fileset dir="${basedir}/winbin/bin"/>
1161 </move>
1162 </target>
1163 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1164 <delete dir="${basedir}/winbin"/>
1165 </target>
1166
1167 <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows">
1168 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1169 dest="${gs2build.home}/packages/windows/gdbm"/>
1170 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1171 dest="${gs2build.home}/packages/windows/crypt"/>
1172 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1173 dest="${gs2build.home}/packages/windows/expat"/>
1174 </target>
1175
1176 <!-- downloads a good XML-Parser -->
1177 <target name="get-macos-extra" depends="init" if="need.macos.extra">
1178 <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1179 dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1180 usetimestamp="true"/>
1181 </target>
1182
1183 <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1184 <target name="install-macos-extra" depends="init,get-macos-extra" if="need.macos.extra">
1185 <!-- make sure these directories are present, otherwise chmod craps out
1186 this chmod is needed in case we are unpacking for a second time -->
1187 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1188 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1189 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1190 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1191 <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1192 dest="${gs2build.home}/perllib/cpan/"
1193 compression="gzip"/>
1194 </target>
1195
1196 <target name="install-indexer-files" depends="init" unless="indexers.present">
1197 <copy todir="${indexers.home}">
1198 <fileset dir="${gs2build.home}/indexers" />
1199 </copy>
1200 <chmod file="${indexers.home}/configure" perm="a+x"/>
1201 </target>
1202
1203 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows,gs2build-edit-setup-bat" if="collection.building.enabled"/>
1204
1205 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1206 <!-- we want a windows path in the setup.bat file -->
1207 <pathconvert targetos="windows" property="gs2build.home.windows">
1208 <path path="${gs2build.home}"/>
1209 </pathconvert>
1210 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1211 <filterset>
1212 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1213 </filterset>
1214 </move>
1215 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1216 </target>
1217
1218 <target name="rename-gs2build-files-windows" if="collection.building.enabled.windows">
1219 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1220 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1221 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1222 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat"/>
1223 </target>
1224
1225 <target name="rename-gs2build-files-unix" if="collection.building.enabled.unix">
1226 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1227 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1228 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1229 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1230 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1231 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1232 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1233 <copy file="${gs2build-extra.home}/packages.Makefile.in" tofile="${gs2build.home}/packages/Makefile.in"/>
1234 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1235 </target>
1236
1237 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1238 <antcall target="checkout-gli"/>
1239 </target>
1240
1241<!-- <target name="checkout-gli" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode"> -->
1242 <target name="checkout-gli" depends="init" if="collection.building.enabled" unless="nocvs.mode">
1243 <echo>checking out gli</echo>
1244 <svn>
1245 <checkout url="${svn.root}/gli/${branch.path}" destPath="gli"/>
1246 </svn>
1247 </target>
1248
1249 <target name="configure-gs2building" depends="init" if="collection.building.enabled"
1250 description="Configure only the Greenstone 2 building components">
1251 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1252 dir="${gs2build.home}">
1253 <arg value="--prefix=${gs2build.home}"/>
1254 </exec>
1255 <exec executable="${gs2build.home}/configure" os="${os.mac}"
1256 dir="${gs2build.home}">
1257 <arg value="--prefix=${gs2build.home}"/>
1258 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1259 </exec>
1260 </target>
1261
1262 <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1263 description="Clean only the Greenstone 2 building components"
1264 if="collection.building.enabled"/>
1265
1266 <target name="clean-gli" depends="init" if="collection.building.enabled">
1267 <!-- gli -->
1268 <property name="gli.home" value="${basedir}/gli"/>
1269 <!-- linux -->
1270 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1271 resolveExecutable="true"/>
1272 <!-- windows -->
1273 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1274 resolveExecutable="true"/>
1275 </target>
1276
1277 <target name="clean-gs2build" depends="init" if="collection.building.enabled">
1278 <!-- gs2build -->
1279 <!--linux: -->
1280 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1281 <arg value="clean"/>
1282 </exec>
1283 <!-- windows: -->
1284 <!-- run the setup script -->
1285 <exec executable="${compile.windows.c++.setup}"/>
1286 <exec executable="nmake" dir="${gs2build.home}">
1287 <arg value="/f"/>
1288 <arg value="win32.mak"/>
1289 <arg value="clean"/>
1290 </exec>
1291 </target>
1292
1293 <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
1294 <!-- gs2build -->
1295 <!--linux: -->
1296 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1297 <arg value="distclean"/>
1298 </exec>
1299 <!-- windows: -->
1300 </target>
1301
1302 <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
1303 description="Compile only the Greenstone 2 building components">
1304 </target>
1305
1306 <target name="compile-gli" depends="init" if="collection.building.enabled">
1307 <!-- gli -->
1308 <property name="gli.home" value="${basedir}/gli"/>
1309
1310 <!-- change the version number -->
1311 <rsr file="${gli.home}/src/org/greenstone/gatherer/Gatherer.java" pattern="^(.*)String\s*PROGRAM_VERSION\s*=\s*&quot;(.*)&quot;" replacement="$1String PROGRAM_VERSION = &quot;${app.version}&quot;"/>
1312 <!-- linux -->
1313 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1314 <!--remote gli-->
1315 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1316 resolveExecutable="true"/>
1317 <!-- windows -->
1318 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1319 <!--remote gli-->
1320 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1321 resolveExecutable="true"/>
1322 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1323 </target>
1324
1325 <target name="compile-gs2build" depends="init" if="collection.building.enabled">
1326 <!-- gs2build -->
1327 <!--linux: make, make install -->
1328 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1329 </exec>
1330 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1331 <arg value="install"/>
1332 </exec>
1333 <!-- run the setup script -->
1334 <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>
1335 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1336 <arg value="/f"/>
1337 <arg value="win32.mak"/>
1338 </exec>
1339 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1340 <arg value="/f"/>
1341 <arg value="win32.mak"/>
1342 <arg value="install"/>
1343 </exec>
1344 <!-- LuceneWrapper jar file not installed by default -->
1345 <mkdir dir="${gs2build.home}/bin/java"/>
1346 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1347 <antcall target="install-gs2build-indexers-windows"/>
1348 <antcall target="install-macos-extra"/>
1349 </target>
1350
1351 <target name="install-gs2build-indexers-windows" depends="init" if="collection.building.enabled.windows">
1352 <copy todir="${gs2build.home}/bin/windows">
1353 <fileset dir="${gs2build.home}/indexers/bin">
1354 <include name="*.*"/>
1355 </fileset>
1356 </copy>
1357 </target>
1358
1359 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1360 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1361 <env key="gsdl3path" path="${basedir}"/>
1362 <env key="gsdlpath" path="${basedir}/gs2build"/>
1363 </exec>
1364 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1365 <env key="gsdl3path" path="${basedir}"/>
1366 <env key="gsdlpath" path="${basedir}/gs2build"/>
1367 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1368 </exec>
1369 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1370 <env key="GSDL3PATH" path="${basedir}"/>
1371 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1372 </exec>
1373 <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 gli4gs3.sh/bat from the greenstone3/gli directory.
1374 </echo>
1375 </target>
1376
1377
1378<!-- ======================== TESTING Targets ========================= -->
1379
1380 <target name="test" description="Run the (incomplete) JUnit test suite "
1381 depends="init">
1382 <mkdir dir="${basedir}/test"/>
1383 <junit printsummary="withOutAndErr"
1384 errorproperty="test.failed"
1385 failureproperty="test.failed"
1386 fork="${junit.fork}">
1387 <formatter type="plain"/>
1388 <classpath>
1389 <pathelement location="${build.home}/gsdl3test.jar"/>
1390 <path refid="compile.classpath"/>
1391 </classpath>
1392 <test name="${testcase}" if="testcase"/>
1393 <batchtest todir="${basedir}/test" unless="testcase">
1394 <fileset dir="${build.home}"
1395 includes="**/*Test.class"
1396 />
1397 </batchtest>
1398 </junit>
1399 <echo>
1400 *********************************************
1401 Test output can be found in directory 'test'
1402 *********************************************
1403 </echo>
1404 </target>
1405 <target name="checkout-flax" description="check out flax source code from another repository">
1406 <echo>checking out flax ...</echo>
1407 <mkdir dir="${basedir}/src/java/org/flax"/>
1408 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1409 <mkdir dir="${basedir}/web/WEB-INF/classes/flax"/>
1410 <mkdir dir="${basedir}/web/interfaces/flax"/>
1411 <mkdir dir="${basedir}/web/sites/flax"/>
1412 <svn>
1413 <checkout url="${flax.svn.root}/flax1.0/trunk/src/java/org/flax/"
1414 destPath="${basedir}/src/java/org/flax"/>
1415 <checkout url="${flax.svn.root}/flax1.0/trunk/src/java/org/greenstone/gsdl3/flax/"
1416 destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1417 <checkout url="${flax.svn.root}/flax1.0/trunk/web/WEB-INF/classes/flax/"
1418 destPath="${basedir}/web/WEB-INF/classes/flax"/>
1419 <checkout url="${flax.svn.root}/flax1.0/trunk/web/interfaces/flax/"
1420 destPath="${basedir}/web/interfaces/flax"/>
1421 <checkout url="${flax.svn.root}/flax1.0/trunk/web/sites/flax/"
1422 destPath="${basedir}/web/sites/flax"/>
1423 </svn>
1424 <move file="${basedir}/web/WEB-INF/web.xml" tofile="${basedir}/web/WEB-INF/web.xml.greenstone3backup"/>
1425 <copy file="${basedir}/web/WEB-INF/classes/flax/web.xml" todir="${basedir}/web/WEB-INF" />
1426
1427 <property name="coll.dir" value="${basedir}/web/sites/flax/collect"/>
1428 <!-- betterfa -->
1429 <unzip src="${coll.dir}/betterfa/archives/archives.zip" dest="${coll.dir}/betterfa/archives"/>
1430 <unzip src="${coll.dir}/betterfa/import/import.zip" dest="${coll.dir}/betterfa/import"/>
1431 <unzip src="${coll.dir}/betterfa/index/index.zip" dest="${coll.dir}/betterfa/index"/>
1432 <!-- imagegue -->
1433 <unzip src="${coll.dir}/imagegue/archives/archives.zip" dest="${coll.dir}/imagegue/archives"/>
1434 <unzip src="${coll.dir}/imagegue/import/import.zip" dest="${coll.dir}/imagegue/import"/>
1435 <unzip src="${coll.dir}/imagegue/index/index.zip" dest="${coll.dir}/imagegue/index"/>
1436 <!-- wikill -->
1437 <unzip src="${coll.dir}/wikill/archives/archives.zip" dest="${coll.dir}/wikill/archives"/>
1438 <unzip src="${coll.dir}/wikill/import/import.zip" dest="${coll.dir}/wikill/import"/>
1439 <unzip src="${coll.dir}/wikill/index/index.zip" dest="${coll.dir}/wikill/index"/>
1440
1441 </target>
1442
1443</project>
1444
1445
Note: See TracBrowser for help on using the repository browser.