source: greenstone3/trunk/build.xml@ 14798

Last change on this file since 14798 was 14798, checked in by dmn, 16 years ago

better feedback for ant start

File size: 63.1 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:[email protected]: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 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
319 <echo>Tomcat: ${catalina.home}</echo>
320 <echo>Java: ${java.home}</echo>
321 </target>
322
323 <target name="stop" depends="init,stop-tomcat"
324 description="Shutdown the Tomcat server."/>
325
326 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
327
328
329<!-- =========== Help targets =================================== -->
330
331 <property name="install-command" value="ant [options] prepare install"/>
332
333 <target name="usage" description="Print a help message">
334 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
335 <echo message=" Execute 'ant -help' for Ant help."/>
336 <echo>To install Greenstone3, run '${install-command}'.
337There 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.
338To log the output, use the '-logfile build.log' option.
339The README.txt file has more information about the ant targets and install process.
340 </echo>
341 </target>
342
343 <target name="help" depends="usage" description="Print a help message"/>
344
345 <target name="debug" depends="init" description="Display all the currently used properties">
346 <echoproperties/>
347 </target>
348
349<!-- ====== initialization and setup targets ================== -->
350
351 <target name="accept-properties" unless="properties.accepted">
352 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
353tomcat.server=${tomcat.server}
354tomcat.port=${tomcat.port}
355tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
356proxy.host=${proxy.host}
357proxy.port=${proxy.port}
358If these are not acceptable, please change them and rerun this target. Continue [y/n]? />
359 </input>
360 <condition property="do.abort">
361 <equals arg1="n" arg2="${properties.ok}"/>
362 </condition>
363 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
364 </target>
365
366<!-- <target name="check-cvsroot">
367 <condition property="svnroot.notset">
368 <or>
369 <not>
370 <isset property="env.CVSROOT"/>
371 </not>
372 <equals arg1="" arg2="${env.CVSROOT}"/>
373 </or>
374 </condition>
375 <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/>
376 </target> -->
377
378 <!-- this sets up some initial properties -->
379 <target name="init">
380
381 <condition property="java.too.old">
382 <or>
383 <equals arg1="1.1" arg2="${ant.java.version}"/>
384 <equals arg1="1.2" arg2="${ant.java.version}"/>
385 <equals arg1="1.3" arg2="${ant.java.version}"/>
386 </or>
387 </condition>
388 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
389
390 <available file="${indexers.home}" property="indexers.present"/>
391 <available file="${basedir}/gli" property="gli.present"/>
392 <available file="${basedir}/gs2build" property="gs2build.present"/>
393
394 <condition property="tomcat.islocal">
395 <or>
396 <not>
397 <isset property="tomcat.installed.path"/>
398 </not>
399 <equals arg1="" arg2="${tomcat.installed.path}"/>
400 </or>
401 </condition>
402
403 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo>
404 <condition property="proxy.present">
405 <and>
406 <isset property="proxy.host"/>
407 <not>
408 <equals arg1="" arg2="${proxy.host}"/>
409 </not>
410 </and>
411 </condition>
412
413 <condition property="need.macos.extra">
414 <and>
415 <isset property="current.os.ismac"/>
416 <not>
417 <isset property="disable.collection.building"/>
418 </not>
419 </and>
420 </condition>
421 </target>
422
423 <target name="setup-proxy" depends="init" if="proxy.present">
424 <condition property="ask.user">
425 <or>
426 <equals arg1="" arg2="${proxy.user}"/>
427 <equals arg1="" arg2="${proxy.password}"/>
428 </or>
429 </condition>
430 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
431 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
432 </target>
433
434 <!-- ========== Web app Targets ================================ -->
435
436 <target name="prepare-web" depends="init,configure-java-version">
437 <mkdir dir="${web.home}/applet"/>
438 <mkdir dir="${web.home}/logs"/>
439 </target>
440
441 <!-- 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 -->
442 <target name="configure-java-version" depends="init"
443 description="Run this target if you have changed the default version of java since installing greenstone3">
444 <condition property="need.xalan.jar">
445 <equals arg1="1.5" arg2="${ant.java.version}"/>
446 </condition>
447 <antcall target="activate-xalan-jar"/>
448 <antcall target="deactivate-xalan-jar"/>
449 </target>
450
451 <target name="activate-xalan-jar" if="need.xalan.jar">
452 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
453 </target>
454
455 <target name="deactivate-xalan-jar" unless="need.xalan.jar">
456 <delete file="${web.lib}/xalan.jar"/>
457 </target>
458
459 <target name="prepare-collections" depends="init">
460 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
461 <!-- gs2mgdemo -->
462 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
463 dest="${collect.dir}/gs2mgdemo"/>
464 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
465 dest="${collect.dir}/gs2mgdemo"/>
466 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
467 dest="${collect.dir}/gs2mgdemo/index"/>
468 <delete file="${collect.dir}/gs2mgdemo/import.zip"/>
469 <delete file="${collect.dir}/gs2mgdemo/metadata.zip"/>
470 <delete file="${collect.dir}/gs2mgdemo/index/index.zip"/>
471 <!-- gs2mgppdemo -->
472 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
473 dest="${collect.dir}/gs2mgppdemo"/>
474 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
475 dest="${collect.dir}/gs2mgppdemo"/>
476 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
477 dest="${collect.dir}/gs2mgppdemo/index"/>
478 <delete file="${collect.dir}/gs2mgppdemo/import.zip"/>
479 <delete file="${collect.dir}/gs2mgppdemo/metadata.zip"/>
480 <delete file="${collect.dir}/gs2mgppdemo/index/index.zip"/>
481 <!-- gberg -->
482 <unzip src="${collect.dir}/gberg/index/index.zip"
483 dest="${collect.dir}/gberg/index"/>
484 <delete file="${collect.dir}/gberg/index/index.zip"/>
485 </target>
486
487
488 <target name="configure-web" depends="init"
489 description="Configure only the web app config files">
490 <!-- we want a unix path in the global.properties file -->
491 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
492 <path path="${web.home}"/>
493 </pathconvert>
494 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
495 <filter token="gsdl3version" value="${app.version}"/>
496 <filter token="tomcat.server" value="${tomcat.server}"/>
497 <filter token="tomcat.port" value="${tomcat.port}"/>
498 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
499 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
500 <chmod file="${web.classes}/global.properties" perm="600"/>
501 <chmod file="${web.classes}/log4j.properties" perm="600"/>
502 </target>
503
504 <target name="compile-web" depends="init">
505 <javac srcdir="${web.classes}"
506 destdir="${web.classes}"
507 debug="${compile.debug}"
508 deprecation="${compile.deprecation}"
509 optimize="${compile.optimize}">
510 <classpath>
511 <path refid="compile.classpath"/>
512 </classpath>
513 </javac>
514 </target>
515
516 <target name="svnupdate-web" unless="nosvn.mode">
517 <svn>
518 <update dir="${web.home}"/>
519 </svn>
520 </target>
521
522 <target name="update-web" depends="init,svnupdate-web,configure-web"
523 description="update only the web stuff (config files)"/>
524
525
526<!-- ======================= Tomcat Targets ========================== -->
527
528 <!-- this target downloads and installs Tomcat -->
529 <!-- we download tomcat and the compat module - its needed for 1.4, and doesn't seem to harm 1.5 -->
530 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
531
532 <!-- check that packages dir is there -->
533 <mkdir dir="${packages.home}"/>
534 <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.25.zip"
535 dest="${packages.home}/apache-tomcat-5.5.25.zip"
536 usetimestamp="true"/>
537 <unzip src="${packages.home}/apache-tomcat-5.5.25.zip"
538 dest="${packages.home}"/>
539 <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.25-compat.zip"
540 dest="${packages.home}/apache-tomcat-5.5.25-compat.zip"
541 usetimestamp="true"/>
542 <unzip src="${packages.home}/apache-tomcat-5.5.25-compat.zip"
543 dest="${packages.home}"/>
544 <!-- delete any existing tomcat -->
545 <delete dir="${packages.home}/tomcat"/>
546 <move todir="${packages.home}/tomcat">
547 <fileset dir="${packages.home}/apache-tomcat-5.5.25"/>
548 </move>
549 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
550 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
551 overwrite="true"/>
552 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
553 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
554 overwrite="true"/>
555 <!-- make sure we have execute permission for the .sh files -->
556 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
557 includes="*.sh"/>
558 </target>
559
560 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
561
562 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
563 <!-- re-setup the server.xml file -->
564 <copy file="${basedir}/resources/tomcat/server.xml" tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
565 <filterset>
566 <filter token="port" value="${tomcat.port}"/>
567 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
568 </filterset>
569 </copy>
570 <!-- set up the greenstone3 context -->
571 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
572 <filterset>
573 <filter token="gsdl3webhome" value="${basedir}/web"/>
574 </filterset>
575 </copy>
576 </target>
577
578 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
579 <!-- re-setup the server.xml file -->
580 <!-- need to edit the config file, or do we get the user to do this???-->
581 </target>
582
583 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
584 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
585 <property name="tomcat.path" refid="local.tomcat.path"/>
586 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
587 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
588 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
589 <env key="GSDL3HOME" value="${basedir}"/>
590 <env key="PATH" path="${tomcat.path}"/>
591 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
592 <env key="CATALINA_HOME" value="${catalina.home}"/>
593 <env key="CLASSPATH" path="${tomcat.classpath}"/>
594 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
595 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.installed.path}/lib"/> <!-- for mac os -->
596 </exec>
597 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
598 <env key="GSDLOS" value="windows"/>
599 <env key="GSDL3HOME" value="${basedir}"/>
600 <env key="Path" path="${tomcat.path}"/>
601 <env key="PATH" path="${tomcat.path}"/>
602 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
603 <env key="CLASSPATH" path="${tomcat.classpath}"/>
604 </exec>
605 <!-- wait for the server to startup in case other targets need it running -->
606 <waitfor maxwait="5" maxwaitunit="second">
607 <and>
608 <socket server="${tomcat.server}" port="${tomcat.port}"/>
609 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
610 </and>
611 </waitfor>
612 </target>
613
614 <!-- windows: do we want to launch a webrowser?? -->
615 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
616 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
617 <env key="CATALINA_HOME" value="${catalina.home}"/>
618 </exec>
619 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/>
620 </target>
621
622 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
623
624 <target name="setup-catalina-ant-tasks">
625 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
626 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
627 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
628 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
629 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
630 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
631 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
632 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
633 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
634 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
635 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
636 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
637 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
638 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
639 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
640 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
641 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
642 </target>
643
644
645
646
647
648
649<!-- ======================= ant Targets ============================ -->
650 <target name="prepare-ant" depends="init">
651 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
652 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
653 usetimestamp="true"/>
654 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
655 dest="${packages.home}"/>
656 <move todir="${packages.home}/ant">
657 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
658 </move>
659 </target>
660
661<!-- ======================= Axis Targets ============================ -->
662
663 <target name="prepare-axis" depends="init">
664 <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
665 dest="${packages.home}/axis-bin-1_2_1.zip"
666 usetimestamp="true"/>
667 <unzip src="${packages.home}/axis-bin-1_2_1.zip"
668 dest="${packages.home}"/>
669 <move todir="${packages.home}/axis">
670 <fileset dir="${packages.home}/axis-1_2_1"/>
671 </move>
672 <!-- install axis into greenstone web app -->
673 <copy todir="${web.lib}">
674 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
675 <include name="*.jar"/>
676 </fileset>
677 </copy>
678 <copy todir="${web.home}">
679 <fileset dir="${packages.home}/axis/webapps/axis/">
680 <include name="*.jsp"/>
681 <include name="*.jws"/>
682 </fileset>
683 </copy>
684 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
685 <copy todir="${web.classes}">
686 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
687 <include name="*.properties"/>
688 </fileset>
689 </copy>
690 </target>
691
692 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,create-deployment-files,deploy-site"
693 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
694
695 <target name="deploy-site">
696 <java classname="org.apache.axis.client.AdminClient">
697 <classpath refid="compile.classpath"/>
698 <arg value="-l"/>
699 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
700 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
701 </java>
702 </target>
703
704 <target name="soap-undeploy-site" depends="get-sitename"
705 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
706 <java classname="org.apache.axis.client.AdminClient">
707 <classpath refid="compile.classpath"/>
708 <arg value="-l"/>
709 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
710 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
711 </java>
712 </target>
713
714 <!-- this target used to deploy the preprepared localsite server -->
715 <target name="deploy-localsite" depends="init"
716 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
717 <antcall target="start-tomcat"/>
718 <antcall target="deploy-site">
719 <param name="axis.sitename" value="localsite"/>
720 </antcall>
721 <antcall target="stop-tomcat"/>
722 </target>
723
724 <target name="get-sitename" unless="axis.sitename">
725 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
726 </target>
727
728 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
729 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
730 <echo>${axis.sitename}, ${axis.siteuri}</echo>
731 </target>
732
733 <target name="check-deployment-files" depends="get-sitename">
734 <condition property="deploy.exists">
735 <and>
736 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
737 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
738 <available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
739 </and>
740 </condition>
741 </target>
742
743 <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files"
744 if="axis.sitename" unless="deploy.exists">
745 <filter token="sitename" value="${axis.sitename}"/>
746 <filter token="siteuri" value="${axis.siteuri}"/>
747 <copy file="${basedir}/resources/soap/site.wsdd.template"
748 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
749 filtering="true"/>
750 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
751 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
752 filtering="true"/>
753 <!-- create the java files and compile them -->
754 <copy file="${basedir}/resources/java/SOAPServer.java.in"
755 tofile="${src.gsdl3.home}/SOAPServer${axis.sitename}.java"
756 filtering="true"/>
757 <mkdir dir="${build.home}"/>
758 <javac srcdir="${src.home}"
759 destdir="${build.home}"
760 debug="${compile.debug}"
761 deprecation="${compile.deprecation}"
762 optimize="${compile.optimize}">
763 <classpath refid="compile.classpath"/>
764 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
765 </javac>
766 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
767 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
768 </target>
769
770
771<!-- ====================== Core targets ============================== -->
772<!-- core targets refer to the core gsdl3 java src -->
773
774 <target name="prepare-core" unless="nocvs.mode">
775 <!-- just get rid of empty directories-->
776 <svn>
777 <update dir="."/>
778 </svn>
779 </target>
780
781 <target name="configure-core"/>
782
783 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
784 description="Update only the Greenstone core" />
785
786 <target name="svnupdate-core" unless="nocvs.mode">
787
788 <svn>
789 <update dir="." recurse="false"/>
790 </svn>
791
792 <svn>
793 <update dir="bin"/>
794 <update dir="comms"/>
795 <update dir="dist-resources"/>
796 <update dir="docs"/>
797 <update dir="lib"/>
798 <update dir="resources"/>
799 <update dir="src"/>
800 <update dir="winutil"/>
801 </svn>
802
803 </target>
804
805 <target name="clean-core"
806 description="Clean only the Greenstone core">
807 <delete dir="${build.home}"/>
808 </target>
809
810 <target name="compile-core" depends="init"
811 description="Compile only the Greenstone core">
812 <mkdir dir="${build.home}"/>
813 <javac srcdir="${src.home}"
814 destdir="${build.home}"
815 debug="${compile.debug}"
816 deprecation="${compile.deprecation}"
817 optimize="${compile.optimize}">
818 <classpath>
819 <path refid="compile.classpath"/>
820 </classpath>
821 </javac>
822 <jar destfile="${build.home}/gsdl3.jar">
823 <fileset dir="${build.home}">
824 <include name="org/greenstone/gsdl3/**"/>
825 <include name="org/flax/**"/>
826 <exclude name="**/Test.class"/>
827 </fileset>
828 <manifest>
829 <attribute name="Built-By" value="${user.name}" />
830 </manifest>
831 </jar>
832 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
833 <!-- copy the localsite server in case we need it -->
834 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServerlocalsite.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServerlocalsite.class" />
835
836 <jar destfile="${build.home}/GAI.jar">
837 <fileset dir="${build.home}">
838 <include name="org/greenstone/admin/**"/>
839 </fileset>
840 <manifest>
841 <attribute name="Built-By" value="${user.name}" />
842 </manifest>
843 </jar>
844
845 <jar destfile="${build.home}/phind.jar">
846 <fileset dir="${build.home}">
847 <include name="org/greenstone/applet/phind/**"/>
848 </fileset>
849 <manifest>
850 <attribute name="Built-By" value="${user.name}" />
851 </manifest>
852 </jar>
853 <mkdir dir="${web.applet}"/>
854 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
855 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
856 <copy file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar" todir="${web.applet}"/>
857 <copy file="${packages.home}/tomcat/common/endorsed/xml-apis.jar" todir="${web.applet}"/>
858 <jar destfile="${build.home}/anttasks.jar">
859 <fileset dir="${build.home}">
860 <include name="org/greenstone/anttasks/**"/>
861 </fileset>
862 <manifest>
863 <attribute name="Built-By" value="${user.name}" />
864 </manifest>
865 </jar>
866 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
867 <jar destfile="${build.home}/gsdl3test.jar">
868 <fileset dir="${build.home}">
869 <include name="org/greenstone/gsdl3/**/*Test.class"/>
870 <include name="org/greenstone/testing/**"/>
871 </fileset>
872 <manifest>
873 <attribute name="Built-By" value="${user.name}" />
874 </manifest>
875 </jar>
876 <jar destfile="${build.home}/server.jar">
877 <fileset dir="${build.home}">
878 <include name="org/greenstone/server/**"/>
879 </fileset>
880 <fileset file="${basedir}/resources/java/server.properties"/>
881 <manifest>
882 <attribute name="Built-By" value="${user.name}"/>
883 </manifest>
884 </jar>
885 <copy file="${build.home}/server.jar" todir="${basedir}"/>
886 </target>
887
888<!-- ================== Packages targets ================================ -->
889 <!-- these targets refer to the greenstone source packages - these need
890 updating less often, so are in separate targets to the core -->
891 <target name="prepare-packages" depends="init,prepare-indexers"/>
892
893 <target name="checkout-indexers" depends="init" if="independent-indexers" unless="nocvs.mode">
894<!-- <target name="checkout-indexers" depends="check-svnroot,init" if="independent-indexers" unless="nocvs.mode"> -->
895 <svn>
896 <checkout url="${svn.root}/indexers/${branch.path}" dest="${src.packages.home}/indexers"/>
897 </svn>
898 </target>
899
900 <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
901 <antcall target="checkout-indexers"/>
902 </target>
903
904 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
905 description="Update only the source packages"/>
906
907 <target name="svnupdate-packages" unless="nocvs.mode">
908 <svn>
909 <update dir="${src.packages.home}"/>
910 </svn>
911 </target>
912
913 <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers"
914 description="Configure only the packages."/>
915
916 <target name="configure-javagdbm">
917 <echo>
918 Configuring JavaGDBM
919 </echo>
920 <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
921 dir="${javagdbm.home}">
922 <arg value="--prefix=${basedir}"/>
923 <arg value="--libdir=${lib.jni}"/>
924 </exec>
925 <exec executable="${javagdbm.home}/configure" os="${os.mac}"
926 dir="${javagdbm.home}">
927 <arg value="--prefix=${basedir}"/>
928 <arg value="--libdir=${lib.jni}"/>
929 <arg value="--with-gdbm=${gdbm.installed.path}"/>
930 </exec>
931 </target>
932
933<!-- Message from oran. I removed the condition from this line becuase it meant
934 the indexers would only be configured if collection building was DISabled.
935 Shouldn't they be configured when collection building is ENabled? -->
936
937<!-- <target name="configure-indexers" depends="init" if="independent-indexers"> -->
938<target name="configure-indexers" depends="init">
939 <echo>Configuring Indexers</echo>
940 <exec executable="${indexers.home}/configure" os="${os.unix}" dir="${indexers.home}">
941 <arg value="--prefix=${basedir}"/>
942 <arg value="--libdir=${lib.jni}"/>
943 </exec>
944 </target>
945
946 <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
947
948 <target name="clean-javagdbm" depends="init">
949 <exec executable="make" os="${os.unix}"
950 dir="${javagdbm.home}">
951 <arg value="clean"/>
952 </exec>
953 </target>
954
955 <target name="clean-indexers" depends="init" if="independent-indexers">
956 <exec executable="make" os="${os.unix}"
957 dir="${indexers.home}">
958 <arg value="clean"/>
959 </exec>
960 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
961 dir="${indexers.home}">
962 <arg value="clean"/>
963 </exec>
964
965 </target>
966
967 <target name="compile-packages" description="Compile only the source packages">
968
969 <!-- javagdbm -->
970 <echo>compile javagdbm</echo>
971 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}"/>
972 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}">
973 <arg value="install"/>
974 </exec>
975
976 <!-- windows: just the java stuff. -->
977 <echo>Windows: compile javagdbm (java only)</echo>
978 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}">
979 <arg value="compile"/>
980 <arg value="javaonly"/>
981 </exec>
982
983 <!-- install the jar file -->
984 <echo>Install the javagdbm jar file</echo>
985 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
986
987 <!-- Indexers -->
988
989 <!-- this may be in gs2build - we will be recompiling, but never mind -->
990 <echo>Indexers: make (from ${indexers.home})</echo>
991 <exec executable="make" os="${os.unix}" dir="${indexers.home}"/>
992 <echo>Indexers: make install</echo>
993 <exec executable="make" os="${os.unix}" dir="${indexers.home}">
994 <arg value="install"/>
995 </exec>
996
997 <echo>Indexers: make</echo>
998 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
999 <arg value="all"/>
1000 </exec>
1001 <echo>Indexers: make install</echo>
1002 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}" dir="${indexers.home}">
1003 <arg value="install"/>
1004 </exec>
1005
1006 <!-- install the jar and jni files -->
1007 <echo>Install the indexers' jar and jni files</echo>
1008 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1009 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1010 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1011 <antcall target="install-jni-files"/>
1012 </target>
1013
1014 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1015
1016 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1017 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1018 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1019 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1020 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1021 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1022 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1023 </target>
1024 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1025 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1026 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1027 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1028 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1029 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1030 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1031 </target>
1032 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1033 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1034 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1035 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1036 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1037 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1038 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1039 </target>
1040
1041 <!-- ================== gs2building targets ===============-->
1042
1043
1044 <target name="update-gs2building" if="collection.building.enabled"
1045 depends="init,svnupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1046 description="Update only the Greenstone 2 building components"/>
1047
1048 <target name="svnupdate-gs2building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nocvs.mode">
1049 </target>
1050 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nocvs.mode">
1051 <!-- Note: can't do a -d update here cos it will get all of gsdl
1052 also, an update doesn't get new files, so we do a checkout instead. -->
1053 <antcall target="checkout-gs2build"/>
1054 </target>
1055
1056 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nocvs.mode">
1057 <svn>
1058 <update dir="${gli.home}"/>
1059 </svn>
1060 </target>
1061
1062 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1063 </target>
1064
1065 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nocvs.mode">
1066 <echo>checking out gs2build</echo>
1067 <!-- svn checkouts -->
1068 <svn>
1069 <!-- perllib -->
1070 <checkout url="${svn.root}/gsdl/${branch.path}/perllib" destPath="gs2build/perllib"/>
1071
1072 <!-- selected packages -->
1073 <checkout url="${svn.root}/gsdl/${branch.path}/packages/cpan" destPath="gs2build/packages/cpan"/>
1074 <checkout url="${svn.root}/gsdl/${branch.path}/packages/expat" destPath="gs2build/packages/expat"/>
1075 <checkout url="${svn.root}/gsdl/${branch.path}/packages/html-tidy" destPath="gs2build/packages/html-tidy"/>
1076 <checkout url="${svn.root}/gsdl/${branch.path}/packages/isis-gdl" destPath="gs2build/packages/isis-gdl"/>
1077 <checkout url="${svn.root}/gsdl/${branch.path}/packages/kea" destPath="gs2build/packages/kea"/>
1078 <checkout url="${svn.root}/gsdl/${branch.path}/packages/pdftohtml" destPath="gs2build/packages/pdftohtml"/>
1079 <checkout url="${svn.root}/gsdl/${branch.path}/packages/rtftohtml" destPath="gs2build/packages/rtftohtml"/>
1080 <checkout url="${svn.root}/gsdl/${branch.path}/packages/w3mir" destPath="gs2build/packages/w3mir"/>
1081 <checkout url="${svn.root}/gsdl/${branch.path}/packages/wget" destPath="gs2build/packages/wget"/>
1082 <checkout url="${svn.root}/gsdl/${branch.path}/packages/windows" destPath="gs2build/packages/windows"/>
1083 <checkout url="${svn.root}/gsdl/${branch.path}/packages/wv" destPath="gs2build/packages/wv"/>
1084 <checkout url="${svn.root}/gsdl/${branch.path}/packages/xlhtml" destPath="gs2build/packages/xlhtml"/>
1085 <checkout url="${svn.root}/gsdl/${branch.path}/packages/yaz" destPath="gs2build/packages/yaz"/>
1086
1087 <!-- some of src (db2txt hashfile phind txt2db) -->
1088 <checkout url="${svn.root}/gsdl/${branch.path}/src/db2txt" destPath="gs2build/src/db2txt"/>
1089 <checkout url="${svn.root}/gsdl/${branch.path}/src/hashfile" destPath="gs2build/src/hashfile"/>
1090 <checkout url="${svn.root}/gsdl/${branch.path}/src/phind" destPath="gs2build/src/phind"/>
1091 <checkout url="${svn.root}/gsdl/${branch.path}/src/txt2db" destPath="gs2build/src/txt2db"/>
1092
1093 <!-- bin -->
1094 <checkout url="${svn.root}/gsdl/${branch.path}/bin/script" destPath="gs2build/bin/script"/>
1095
1096 <!-- mappings -->
1097 <checkout url="${svn.root}/gsdl/${branch.path}/mappings" destPath="gs2build/mappings"/>
1098
1099 <!-- etc/packages -->
1100 <checkout url="${svn.root}/gsdl/${branch.path}/etc/packages" destPath="gs2build/etc/packages"/>
1101
1102 <!-- collect -->
1103 <checkout url="${svn.root}/gsdl/${branch.path}/collect/modelcol" destPath="gs2build/collect/modelcol"/>
1104
1105 <!-- gs2build-extra -->
1106 <checkout url="${svn.root}/other-projects/trunk/gs2build-extra" destPath="gs2build/gs2build-extra"/>
1107
1108 <!-- indexers -->
1109 <checkout url="${svn.root}/indexers/${branch.path}" destPath="gs2build/indexers"/>
1110
1111
1112 </svn>
1113 <!-- regular downloads -->
1114
1115 <!-- some files from lib -->
1116 <mkdir dir="gs2build/lib"/>
1117 <get src="${svn.root}/gsdl/${branch.path}/lib/text_t.h" dest="gs2build/lib/text_t.h"/>
1118 <get src="${svn.root}/gsdl/${branch.path}/lib/text_t.cpp" dest="gs2build/lib/text_t.cpp"/>
1119 <get src="${svn.root}/gsdl/${branch.path}/lib/gsdlconf.h" dest="gs2build/lib/gsdlconf.h"/>
1120
1121 <!-- some files from etc -->
1122 <get src="${svn.root}/gsdl/${branch.path}/etc/marctodc.txt" dest="gs2build/etc/marctodc.txt"/>
1123 <get src="${svn.root}/gsdl/${branch.path}/etc/dc2marc-mapping.xml" dest="gs2build/etc/dc2marc-mapping.xml"/>
1124 <get src="${svn.root}/gsdl/${branch.path}/etc/dc2marc.xsl" dest="gs2build/etc/dc2marc.xsl"/>
1125 <get src="${svn.root}/gsdl/${branch.path}/etc/qdc2marc-mapping.xml" dest="gs2build/etc/qdc2marc-mapping.xml"/>
1126
1127 <!-- some files from the gsdl root directory -->
1128 <get src="${svn.root}/gsdl/${branch.path}/setup.bash" dest="gs2build/setup.bash"/>
1129 <get src="${svn.root}/gsdl/${branch.path}/config.sub" dest="gs2build/config.sub"/>
1130 <get src="${svn.root}/gsdl/${branch.path}/config.guess" dest="gs2build/config.guess"/>
1131 <get src="${svn.root}/gsdl/${branch.path}/config.h.in" dest="gs2build/config.h.in"/>
1132 <get src="${svn.root}/gsdl/${branch.path}/configtest.pl" dest="gs2build/configtest.pl"/>
1133 <get src="${svn.root}/gsdl/${branch.path}/install-sh" dest="gs2build/install-sh"/>
1134 <get src="${svn.root}/gsdl/${branch.path}/acconfig.h" dest="gs2build/acconfig.h"/>
1135 <get src="${svn.root}/gsdl/${branch.path}/aclocal.m4" dest="gs2build/aclocal.m4"/>
1136 <get src="${svn.root}/gsdl/${branch.path}/WIN32cfg.h" dest="gs2build/WIN32cfg.h"/>
1137
1138 </target>
1139
1140 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1141 <antcall target="checkout-gs2build"/>
1142 <antcall target="rename-gs2build-files"/>
1143 <antcall target="unzip-windows-packages"/>
1144 <antcall target="checkout-winbin"/>
1145 <antcall target="get-windows-binaries"/>
1146 <antcall target="delete-winbin"/>
1147 <antcall target="get-macos-extra"/>
1148 </target>
1149
1150 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1151 unless="nocvs.mode">
1152 <svn>
1153 <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin"/>
1154 </svn>
1155 </target>
1156
1157 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nocvs.mode">
1158 <svn>
1159 <update dir="${svn.root}/other-projects/trunk/winbin"/>
1160 </svn>
1161 </target>
1162
1163 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1164 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1165 <fileset dir="${basedir}/winbin/bin"/>
1166 </move>
1167 </target>
1168 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1169 <delete dir="${basedir}/winbin"/>
1170 </target>
1171
1172 <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows">
1173 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1174 dest="${gs2build.home}/packages/windows/gdbm"/>
1175 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1176 dest="${gs2build.home}/packages/windows/crypt"/>
1177 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1178 dest="${gs2build.home}/packages/windows/expat"/>
1179 </target>
1180
1181 <!-- downloads a good XML-Parser -->
1182 <target name="get-macos-extra" depends="init" if="need.macos.extra">
1183 <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1184 dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1185 usetimestamp="true"/>
1186 </target>
1187
1188 <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1189 <target name="install-macos-extra" depends="init,get-macos-extra" if="need.macos.extra">
1190 <!-- make sure these directories are present, otherwise chmod craps out
1191 this chmod is needed in case we are unpacking for a second time -->
1192 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1193 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1194 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1195 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1196 <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1197 dest="${gs2build.home}/perllib/cpan/"
1198 compression="gzip"/>
1199 </target>
1200
1201 <target name="install-indexer-files" depends="init" unless="indexers.present">
1202 <copy todir="${indexers.home}">
1203 <fileset dir="${gs2build.home}/indexers" />
1204 </copy>
1205 <chmod file="${indexers.home}/configure" perm="a+x"/>
1206 </target>
1207
1208 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows,gs2build-edit-setup-bat" if="collection.building.enabled"/>
1209
1210 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1211 <!-- we want a windows path in the setup.bat file -->
1212 <pathconvert targetos="windows" property="gs2build.home.windows">
1213 <path path="${gs2build.home}"/>
1214 </pathconvert>
1215 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1216 <filterset>
1217 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1218 </filterset>
1219 </move>
1220 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1221 </target>
1222
1223 <target name="rename-gs2build-files-windows" if="collection.building.enabled.windows">
1224 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1225 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1226 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1227 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat"/>
1228 </target>
1229
1230 <target name="rename-gs2build-files-unix" if="collection.building.enabled.unix">
1231 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1232 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1233 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1234 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1235 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1236 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1237 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1238 <copy file="${gs2build-extra.home}/packages.Makefile.in" tofile="${gs2build.home}/packages/Makefile.in"/>
1239 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1240 </target>
1241
1242 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1243 <antcall target="checkout-gli"/>
1244 </target>
1245
1246<!-- <target name="checkout-gli" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode"> -->
1247 <target name="checkout-gli" depends="init" if="collection.building.enabled" unless="nocvs.mode">
1248 <echo>checking out gli</echo>
1249 <svn>
1250 <checkout url="${svn.root}/gli/${branch.path}" destPath="gli"/>
1251 </svn>
1252 </target>
1253
1254 <target name="configure-gs2building" depends="init" if="collection.building.enabled"
1255 description="Configure only the Greenstone 2 building components">
1256 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1257 dir="${gs2build.home}">
1258 <arg value="--prefix=${gs2build.home}"/>
1259 </exec>
1260 <exec executable="${gs2build.home}/configure" os="${os.mac}"
1261 dir="${gs2build.home}">
1262 <arg value="--prefix=${gs2build.home}"/>
1263 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1264 </exec>
1265 </target>
1266
1267 <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1268 description="Clean only the Greenstone 2 building components"
1269 if="collection.building.enabled"/>
1270
1271 <target name="clean-gli" depends="init" if="collection.building.enabled">
1272 <!-- gli -->
1273 <property name="gli.home" value="${basedir}/gli"/>
1274 <!-- linux -->
1275 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1276 resolveExecutable="true"/>
1277 <!-- windows -->
1278 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1279 resolveExecutable="true"/>
1280 </target>
1281
1282 <target name="clean-gs2build" depends="init" if="collection.building.enabled">
1283 <!-- gs2build -->
1284 <!--linux: -->
1285 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1286 <arg value="clean"/>
1287 </exec>
1288 <!-- windows: -->
1289 <!-- run the setup script -->
1290 <exec executable="${compile.windows.c++.setup}"/>
1291 <exec executable="nmake" dir="${gs2build.home}">
1292 <arg value="/f"/>
1293 <arg value="win32.mak"/>
1294 <arg value="clean"/>
1295 </exec>
1296 </target>
1297
1298 <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
1299 <!-- gs2build -->
1300 <!--linux: -->
1301 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1302 <arg value="distclean"/>
1303 </exec>
1304 <!-- windows: -->
1305 </target>
1306
1307 <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
1308 description="Compile only the Greenstone 2 building components">
1309 </target>
1310
1311 <target name="compile-gli" depends="init" if="collection.building.enabled">
1312 <!-- gli -->
1313 <property name="gli.home" value="${basedir}/gli"/>
1314
1315 <!-- change the version number -->
1316 <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;"/>
1317 <!-- linux -->
1318 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1319 <!--remote gli-->
1320 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1321 resolveExecutable="true"/>
1322 <!-- windows -->
1323 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1324 <!--remote gli-->
1325 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1326 resolveExecutable="true"/>
1327 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1328 </target>
1329
1330 <target name="compile-gs2build" depends="init" if="collection.building.enabled">
1331 <!-- gs2build -->
1332 <!--linux: make, make install -->
1333 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1334 </exec>
1335 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1336 <arg value="install"/>
1337 </exec>
1338 <!-- run the setup script -->
1339 <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>
1340 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1341 <arg value="/f"/>
1342 <arg value="win32.mak"/>
1343 </exec>
1344 <exec executable="nmake" dir="${gs2build.home}" os="${os.windows}">
1345 <arg value="/f"/>
1346 <arg value="win32.mak"/>
1347 <arg value="install"/>
1348 </exec>
1349 <!-- LuceneWrapper jar file not installed by default -->
1350 <mkdir dir="${gs2build.home}/bin/java"/>
1351 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1352 <antcall target="install-gs2build-indexers-windows"/>
1353 <antcall target="install-macos-extra"/>
1354 </target>
1355
1356 <target name="install-gs2build-indexers-windows" depends="init" if="collection.building.enabled.windows">
1357 <copy todir="${gs2build.home}/bin/windows">
1358 <fileset dir="${gs2build.home}/indexers/bin">
1359 <include name="*.*"/>
1360 </fileset>
1361 </copy>
1362 </target>
1363
1364 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1365 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1366 <env key="gsdl3path" path="${basedir}"/>
1367 <env key="gsdlpath" path="${basedir}/gs2build"/>
1368 </exec>
1369 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1370 <env key="gsdl3path" path="${basedir}"/>
1371 <env key="gsdlpath" path="${basedir}/gs2build"/>
1372 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1373 </exec>
1374 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1375 <env key="GSDL3PATH" path="${basedir}"/>
1376 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1377 </exec>
1378 <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.
1379 </echo>
1380 </target>
1381
1382
1383<!-- ======================== TESTING Targets ========================= -->
1384
1385 <target name="test" description="Run the (incomplete) JUnit test suite "
1386 depends="init">
1387 <mkdir dir="${basedir}/test"/>
1388 <junit printsummary="withOutAndErr"
1389 errorproperty="test.failed"
1390 failureproperty="test.failed"
1391 fork="${junit.fork}">
1392 <formatter type="plain"/>
1393 <classpath>
1394 <pathelement location="${build.home}/gsdl3test.jar"/>
1395 <path refid="compile.classpath"/>
1396 </classpath>
1397 <test name="${testcase}" if="testcase"/>
1398 <batchtest todir="${basedir}/test" unless="testcase">
1399 <fileset dir="${build.home}"
1400 includes="**/*Test.class"
1401 />
1402 </batchtest>
1403 </junit>
1404 <echo>
1405 *********************************************
1406 Test output can be found in directory 'test'
1407 *********************************************
1408 </echo>
1409 </target>
1410 <target name="checkout-flax" description="check out flax source code from another repository">
1411 <echo>checking out flax ...</echo>
1412 <mkdir dir="${basedir}/src/java/org/flax"/>
1413 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1414 <mkdir dir="${basedir}/web/WEB-INF/classes/flax"/>
1415 <mkdir dir="${basedir}/web/interfaces/flax"/>
1416 <mkdir dir="${basedir}/web/sites/flax"/>
1417 <svn>
1418 <checkout url="${flax.svn.root}/flax1.0/trunk/src/java/org/flax/"
1419 destPath="${basedir}/src/java/org/flax"/>
1420 <checkout url="${flax.svn.root}/flax1.0/trunk/src/java/org/greenstone/gsdl3/flax/"
1421 destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1422 <checkout url="${flax.svn.root}/flax1.0/trunk/web/WEB-INF/classes/flax/"
1423 destPath="${basedir}/web/WEB-INF/classes/flax"/>
1424 <checkout url="${flax.svn.root}/flax1.0/trunk/web/interfaces/flax/"
1425 destPath="${basedir}/web/interfaces/flax"/>
1426 <checkout url="${flax.svn.root}/flax1.0/trunk/web/sites/flax/"
1427 destPath="${basedir}/web/sites/flax"/>
1428 </svn>
1429 <move file="${basedir}/web/WEB-INF/web.xml" tofile="${basedir}/web/WEB-INF/web.xml.greenstone3backup"/>
1430 <copy file="${basedir}/web/WEB-INF/classes/flax/web.xml" todir="${basedir}/web/WEB-INF" />
1431
1432 <property name="coll.dir" value="${basedir}/web/sites/flax/collect"/>
1433 <!-- betterfa -->
1434 <unzip src="${coll.dir}/betterfa/archives/archives.zip" dest="${coll.dir}/betterfa/archives"/>
1435 <unzip src="${coll.dir}/betterfa/import/import.zip" dest="${coll.dir}/betterfa/import"/>
1436 <unzip src="${coll.dir}/betterfa/index/index.zip" dest="${coll.dir}/betterfa/index"/>
1437 <!-- imagegue -->
1438 <unzip src="${coll.dir}/imagegue/archives/archives.zip" dest="${coll.dir}/imagegue/archives"/>
1439 <unzip src="${coll.dir}/imagegue/import/import.zip" dest="${coll.dir}/imagegue/import"/>
1440 <unzip src="${coll.dir}/imagegue/index/index.zip" dest="${coll.dir}/imagegue/index"/>
1441 <!-- wikill -->
1442 <unzip src="${coll.dir}/wikill/archives/archives.zip" dest="${coll.dir}/wikill/archives"/>
1443 <unzip src="${coll.dir}/wikill/import/import.zip" dest="${coll.dir}/wikill/import"/>
1444 <unzip src="${coll.dir}/wikill/index/index.zip" dest="${coll.dir}/wikill/index"/>
1445
1446 </target>
1447
1448</project>
1449
1450
Note: See TracBrowser for help on using the repository browser.