source: trunk/gsdl3/build.xml@ 13921

Last change on this file since 13921 was 13921, checked in by shaoqun, 15 years ago

1.5 needs tomcat-compat

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