source: greenstone3/trunk/build.xml@ 14560

Last change on this file since 14560 was 14560, checked in by shaoqun, 13 years ago

run makejar to support remote gli

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