source: greenstone3/trunk/build.xml@ 15037

Last change on this file since 15037 was 15037, checked in by xiao, 14 years ago

add two targets: update-flax and flax-copy-files.

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