source: greenstone3/trunk/build.xml@ 14814

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

further ant message improvements

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