source: greenstone3/trunk/build.xml@ 14165

Last change on this file since 14165 was 14165, checked in by oranfry, 16 years ago

updated the build script to work with svn

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