source: trunk/gsdl3/build.xml@ 13826

Last change on this file since 13826 was 13816, checked in by kjdon, 17 years ago

renamed update-java-version to configure-java-version, otherwise it will be deleted from the build.xml when creating a release (all the update* targets are removed)

  • Property svn:keywords set to Author Date Id Revision
File size: 55.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:[email protected]: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="applet.home" value="${src.home}/org/greenstone/applet"/>
138 <property name="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,configure,configure-c++,compile,deploy-localsite"
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 <target name="clean-windows-c++" depends="init,clean-windows-c++-gs2building,clean-windows-c++-packages"
277 description="Remove C++ compiled code for Windows. Requires Microsoft Visual Studio"/>
278
279 <target name="compile" depends="init,compile-web,compile-packages,compile-core,compile-gs2building"
280 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
281
282 <target name="compile-windows-c++" depends="init,compile-windows-c++-gs2build,compile-windows-c++-packages"
283 description="Compile the C/C++ code for Windows. Requires Microsoft Visual Studio"/>
284
285 <target name="update" depends="init,cvsupdate,clean,configure,configure-c++,compile"
286 description="Update (thru CVS) all the source (including core, packages and gs2building), then clean, configure and recompile."/>
287
288 <target name="start" depends="init,start-tomcat"
289 description="Startup the Tomcat server." />
290
291 <target name="stop" depends="init,stop-tomcat"
292 description="Shutdown the Tomcat server."/>
293
294 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
295
296
297<!-- =========== Help targets =================================== -->
298
299 <property name="install-command" value="ant [options] prepare install"/>
300
301 <target name="usage" description="Print a help message">
302 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
303 <echo message=" Execute 'ant -help' for Ant help."/>
304 <echo>To install Greenstone3, run '${install-command}'.
305There 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.
306To log the output, use the '-logfile build.log' option.
307The README.txt file has more information about the ant targets and install process.
308 </echo>
309 </target>
310
311 <target name="help" depends="usage" description="Print a help message"/>
312
313 <target name="debug" depends="init" description="Display all the currently used properties">
314 <echoproperties/>
315 </target>
316
317<!-- ====== initialization and setup targets ================== -->
318
319 <target name="accept-properties" unless="properties.accepted">
320 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
321tomcat.server=${tomcat.server}
322tomcat.port=${tomcat.port}
323tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
324proxy.host=${proxy.host}
325proxy.port=${proxy.port}
326If these are not acceptable, please change them and rerun this target. Continue [y/n]? />
327 </input>
328 <condition property="do.abort">
329 <equals arg1="n" arg2="${properties.ok}"/>
330 </condition>
331 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
332 </target>
333
334 <target name="check-cvsroot">
335 <condition property="cvsroot.notset">
336 <or>
337 <not>
338 <isset property="env.CVSROOT"/>
339 </not>
340 <equals arg1="" arg2="${env.CVSROOT}"/>
341 </or>
342 </condition>
343 <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/>
344 </target>
345
346 <!-- this sets up some initial properties -->
347 <target name="init">
348
349 <condition property="java.too.old">
350 <or>
351 <equals arg1="1.1" arg2="${ant.java.version}"/>
352 <equals arg1="1.2" arg2="${ant.java.version}"/>
353 <equals arg1="1.3" arg2="${ant.java.version}"/>
354 </or>
355 </condition>
356 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
357
358 <available file="${indexers.home}" property="indexers.present"/>
359 <available file="${basedir}/gli" property="gli.present"/>
360 <available file="${basedir}/gs2build" property="gs2build.present"/>
361
362 <condition property="tomcat.islocal">
363 <or>
364 <not>
365 <isset property="tomcat.installed.path"/>
366 </not>
367 <equals arg1="" arg2="${tomcat.installed.path}"/>
368 </or>
369 </condition>
370
371 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo>
372 <condition property="proxy.present">
373 <and>
374 <isset property="proxy.host"/>
375 <not>
376 <equals arg1="" arg2="${proxy.host}"/>
377 </not>
378 </and>
379 </condition>
380
381 <condition property="need.macos.extra">
382 <and>
383 <isset property="current.os.ismac"/>
384 <not>
385 <isset property="disable.collection.building"/>
386 </not>
387 </and>
388 </condition>
389 </target>
390
391 <target name="setup-proxy" depends="init" if="proxy.present">
392 <condition property="ask.user">
393 <or>
394 <equals arg1="" arg2="${proxy.user}"/>
395 <equals arg1="" arg2="${proxy.password}"/>
396 </or>
397 </condition>
398 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
399 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
400 </target>
401
402 <!-- ========== Web app Targets ================================ -->
403
404 <target name="prepare-web" depends="init">
405 <mkdir dir="${web.home}/applet"/>
406 <mkdir dir="${web.home}/logs"/>
407 <condition property="need.xml.jars">
408 <equals arg1="1.5" arg2="${ant.java.version}"/>
409 </condition>
410 <antcall target="activate-xml-jars"/>
411 <antcall target="deactivate-xml-jars"/>
412 </target>
413
414 <target name="configure-java-version" depends="init"
415 description="Run this target if you have changed the default version of java since installing greenstone3">
416 <condition property="need.xml.jars">
417 <equals arg1="1.5" arg2="${ant.java.version}"/>
418 </condition>
419 <antcall target="activate-xml-jars"/>
420 <antcall target="deactivate-xml-jars"/>
421 <condition property="need.tomcat.compat">
422 <equals arg1="1.4" arg2="${ant.java.version}"/>
423 </condition>
424 <antcall target="install-tomcat-compat"/>
425 <antcall target="uninstall-tomcat-compat"/>
426 </target>
427
428 <target name="activate-xml-jars" if="need.xml.jars">
429 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
430 <copy file="${web.lib}/xercesImpl.jar.tmp" tofile="${web.lib}/xercesImpl.jar"/>
431 </target>
432
433 <target name="deactivate-xml-jars" unless="need.xml.jars">
434 <delete file="${web.lib}/xalan.jar"/>
435 <delete file="${web.lib}/xercesImpl.jar"/>
436 </target>
437
438 <target name="prepare-collections" depends="init">
439 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
440 <!-- gs2mgdemo -->
441 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
442 dest="${collect.dir}/gs2mgdemo"/>
443 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
444 dest="${collect.dir}/gs2mgdemo"/>
445 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
446 dest="${collect.dir}/gs2mgdemo/index"/>
447 <delete file="${collect.dir}/gs2mgdemo/import.zip"/>
448 <delete file="${collect.dir}/gs2mgdemo/metadata.zip"/>
449 <delete file="${collect.dir}/gs2mgdemo/index/index.zip"/>
450 <!-- gs2mgppdemo -->
451 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
452 dest="${collect.dir}/gs2mgppdemo"/>
453 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
454 dest="${collect.dir}/gs2mgppdemo"/>
455 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
456 dest="${collect.dir}/gs2mgppdemo/index"/>
457 <delete file="${collect.dir}/gs2mgppdemo/import.zip"/>
458 <delete file="${collect.dir}/gs2mgppdemo/metadata.zip"/>
459 <delete file="${collect.dir}/gs2mgppdemo/index/index.zip"/>
460 <!-- gberg -->
461 <unzip src="${collect.dir}/gberg/index/index.zip"
462 dest="${collect.dir}/gberg/index"/>
463 <delete file="${collect.dir}/gberg/index/index.zip"/>
464 </target>
465
466
467 <target name="configure-web" depends="init"
468 description="Configure only the web app config files">
469 <!-- we want a unix path in the global.properties file -->
470 <pathconvert targetos="unix" property="gsdl3.home.unix">
471 <path path="${web.home}"/>
472 </pathconvert>
473 <filter token="gsdl3home" value="${gsdl3.home.unix}"/>
474 <filter token="gsdl3version" value="${app.version}"/>
475 <filter token="tomcat.server" value="${tomcat.server}"/>
476 <filter token="tomcat.port" value="${tomcat.port}"/>
477 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
478 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
479 <chmod file="${web.classes}/global.properties" perm="600"/>
480 <chmod file="${web.classes}/log4j.properties" perm="600"/>
481 </target>
482
483 <target name="compile-web" depends="init">
484 <javac srcdir="${web.classes}"
485 destdir="${web.classes}"
486 debug="${compile.debug}"
487 deprecation="${compile.deprecation}"
488 optimize="${compile.optimize}">
489 <classpath>
490 <path refid="compile.classpath"/>
491 </classpath>
492 </javac>
493 </target>
494
495 <target name="cvsupdate-web" unless="nocvs.mode">
496 <cvs command="update -dP" dest="${web.home}"/>
497 </target>
498
499 <target name="update-web" depends="init,cvsupdate-web,configure-web"
500 description="update only the web stuff (config files)"/>
501
502
503<!-- ======================= Tomcat Targets ========================== -->
504
505 <!-- this target sets up tomcat for the first time, or resets it any subsequent times -->
506 <target name="prepare-tomcat" depends="init,download-tomcat" if="tomcat.islocal">
507 <condition property="need.tomcat.compat">
508 <equals arg1="1.4" arg2="${ant.java.version}"/>
509 </condition>
510 <antcall target="install-tomcat-compat"/>
511 </target>
512
513 <target name="download-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
514 <!-- check that packages dir is there -->
515 <mkdir dir="${packages.home}"/>
516 <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.12.zip"
517 dest="${packages.home}/apache-tomcat-5.5.12.zip"
518 usetimestamp="true"/>
519 <delete dir="${packages.home}/tomcat.bak"/>
520 <move todir="${packages.home}/tomcat.bak" failonerror="false">
521 <fileset dir="${packages.home}/tomcat"/>
522 </move>
523 <unzip src="${packages.home}/apache-tomcat-5.5.12.zip"
524 dest="${packages.home}"/>
525 <move todir="${packages.home}/tomcat">
526 <fileset dir="${packages.home}/apache-tomcat-5.5.12"/>
527 </move>
528 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
529 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
530 overwrite="true"/>
531 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
532 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
533 overwrite="true"/>
534 <!-- make sure we have execute permission for the .sh files -->
535 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
536 includes="*.sh"/>
537
538 <!-- download the compat module but don't install it unless necessary -->
539 <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.12-compat.zip"
540 dest="${packages.home}/apache-tomcat-5.5.12-compat.zip"
541 usetimestamp="true"/>
542 <unzip src="${packages.home}/apache-tomcat-5.5.12-compat.zip"
543 dest="${packages.home}"/>
544 <move todir="${packages.home}/tomcat-compat">
545 <fileset dir="${packages.home}/apache-tomcat-5.5.12"/>
546 </move>
547 </target>
548
549
550 <target name="install-tomcat-compat" if="need.tomcat.compat">
551 <copy file="${packages.home}/tomcat-compat/common/endorsed/xml-apis.jar"
552 tofile="${web.applet}/xml-apis.jar"/>
553 <copy file="${packages.home}/tomcat-compat/common/endorsed/xml-apis.jar"
554 tofile="${packages.home}/tomcat/common/endorsed/xml-apis.jar"/>
555 <copy file="${packages.home}/tomcat-compat/common/endorsed/xercesImpl.jar"
556 tofile="${web.applet}/xercesImpl.jar"/>
557 <copy file="${packages.home}/tomcat-compat/common/endorsed/xercesImpl.jar"
558 tofile="${packages.home}/tomcat/common/endorsed/xercesImpl.jar"/>
559 <copy file="${packages.home}/tomcat-compat/bin/jmx.jar"
560 tofile="${packages.home}/tomcat/bin/jmx.jar"/>
561 </target>
562 <target name="uninstall-tomcat-compat" unless="need.tomcat.compat">
563 <delete file="${web.applet}/xml-apis.jar"/>
564 <delete file="${packages.home}/tomcat/common/endorsed/xml-apis.jar"/>
565 <delete file="${web.applet}/xercesImpl.jar"/>
566 <delete file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar"/>
567 <delete file="${packages.home}/tomcat/bin/jmx.jar"/>
568 </target>
569
570 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
571
572 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
573 <!-- re-setup the server.xml file -->
574 <copy file="${basedir}/resources/tomcat/server.xml" tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
575 <filterset>
576 <filter token="port" value="${tomcat.port}"/>
577 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
578 </filterset>
579 </copy>
580 <!-- set up the greenstone3 context -->
581 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
582 <filterset>
583 <filter token="gsdl3webhome" value="${basedir}/web"/>
584 </filterset>
585 </copy>
586 </target>
587
588 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
589 <!-- re-setup the server.xml file -->
590 <!-- need to edit the config file, or do we get the user to do this???-->
591 </target>
592
593 <target name="reload" description="Reload web application"
594 depends="init,setup-catalina-ant-tasks">
595 <reload url="http://${tomcat.server}:${tomcat.port}/manager" username="admin" password="admin"
596 path="${app.path}"/>
597 </target>
598
599 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
600 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
601 <property name="tomcat.path" refid="local.tomcat.path"/>
602 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
603 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
604 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
605 <env key="GSDL3HOME" value="${basedir}"/>
606 <env key="PATH" path="${tomcat.path}"/>
607 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
608 <env key="CATALINA_HOME" value="${catalina.home}"/>
609 <env key="CLASSPATH" path="${tomcat.classpath}"/>
610 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
611 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.installed.path}/lib"/> <!-- for mac os -->
612 </exec>
613 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
614 <env key="GSDLOS" value="windows"/>
615 <env key="GSDL3HOME" value="${basedir}"/>
616 <env key="Path" path="${tomcat.path}"/>
617 <env key="PATH" path="${tomcat.path}"/>
618 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
619 <env key="CLASSPATH" path="${tomcat.classpath}"/>
620 </exec>
621 <!-- wait for the server to startup in case other targets need it running -->
622 <waitfor maxwait="5" maxwaitunit="second">
623 <and>
624 <socket server="${tomcat.server}" port="${tomcat.port}"/>
625 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
626 </and>
627 </waitfor>
628 </target>
629 <!-- windows: do we want to launch a webrowser?? -->
630 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
631 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
632 <env key="CATALINA_HOME" value="${catalina.home}"/>
633 </exec>
634 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/>
635 </target>
636
637 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
638
639 <target name="setup-catalina-ant-tasks">
640 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
641 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
642 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
643 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
644 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
645 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
646 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
647 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
648 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
649 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
650 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
651 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
652 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
653 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
654 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
655 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
656 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
657 </target>
658
659
660
661
662<!-- ======================= Axis Targets ============================ -->
663
664 <target name="prepare-axis" depends="init">
665 <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
666 dest="${packages.home}/axis-bin-1_2_1.zip"
667 usetimestamp="true"/>
668 <unzip src="${packages.home}/axis-bin-1_2_1.zip"
669 dest="${packages.home}"/>
670 <move todir="${packages.home}/axis">
671 <fileset dir="${packages.home}/axis-1_2_1"/>
672 </move>
673 <!-- install axis into greenstone web app -->
674 <copy todir="${web.lib}">
675 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
676 <include name="*.jar"/>
677 </fileset>
678 </copy>
679 <copy todir="${web.home}">
680 <fileset dir="${packages.home}/axis/webapps/axis/">
681 <include name="*.jsp"/>
682 <include name="*.jws"/>
683 </fileset>
684 </copy>
685 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
686 <copy todir="${web.classes}">
687 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
688 <include name="*.properties"/>
689 </fileset>
690 </copy>
691 </target>
692
693 <target name="soap-deploy-site" depends="get-sitename,get-siteuri,create-deployment-files"
694 description="Deploy a SOAP web service for a local Greenstone site">
695 <java classname="org.apache.axis.client.AdminClient">
696 <classpath refid="compile.classpath"/>
697 <arg value="-l"/>
698 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
699 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
700 </java>
701 </target>
702
703 <target name="soap-undeploy-site" depends="get-sitename"
704 description="Undeploy a SOAP web service for a local Greenstone site">
705 <java classname="org.apache.axis.client.AdminClient">
706 <classpath refid="compile.classpath"/>
707 <arg value="-l"/>
708 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
709 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
710 </java>
711 </target>
712
713 <!-- this target used to deploy the localsite server for the default installation -->
714 <target name="deploy-localsite" depends="init">
715 <antcall target="start-tomcat"/>
716 <antcall target="soap-deploy-site">
717 <param name="axis.sitename" value="localsite"/>
718 <param name="axis.siteuri" value="localsite"/>
719 </antcall>
720 <antcall target="stop-tomcat"/>
721 </target>
722
723 <target name="get-sitename" unless="axis.sitename">
724 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
725 </target>
726
727 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
728 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
729 <echo>${axis.sitename}, ${axis.siteuri}</echo>
730 </target>
731 <target name="check-deployment-files" depends="get-sitename">
732 <condition property="deploy.exists">
733 <and>
734 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
735 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
736 <available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
737 </and>
738 </condition>
739 </target>
740
741 <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files"
742 if="axis.sitename" unless="deploy.exists">
743 <filter token="sitename" value="${axis.sitename}"/>
744 <filter token="siteuri" value="${axis.siteuri}"/>
745 <copy file="${basedir}/resources/soap/site.wsdd.template"
746 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
747 filtering="true"/>
748 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
749 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
750 filtering="true"/>
751 <!-- create the java files and compile them -->
752 <copy file="${gsdl3.home}/SOAPServer.java.in"
753 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
754 filtering="true"/>
755 <mkdir dir="${build.home}"/>
756 <javac srcdir="${src.home}"
757 destdir="${build.home}"
758 debug="${compile.debug}"
759 deprecation="${compile.deprecation}"
760 optimize="${compile.optimize}">
761 <classpath refid="compile.classpath"/>
762 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
763 </javac>
764 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
765 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
766 </target>
767
768
769<!-- ====================== Core targets ============================== -->
770<!-- core targets refer to the core gsdl3 java src -->
771
772 <target name="prepare-core" unless="nocvs.mode">
773 <!-- just get rid of empty directories-->
774 <cvs command="update -P"/>
775 </target>
776
777 <target name="configure-core"/>
778
779 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
780 description="Update only the Greenstone core" />
781
782 <target name="cvsupdate-core" unless="nocvs.mode">
783 <cvs command="update -l"/>
784 <cvs command="update -dP bin comms dist-resources docs lib resources src winutil"/>
785 </target>
786
787 <target name="clean-core"
788 description="Clean only the Greenstone core">
789 <delete dir="${build.home}"/>
790 </target>
791
792 <target name="compile-core" depends="init"
793 description="Compile only the Greenstone core">
794 <mkdir dir="${build.home}"/>
795 <javac srcdir="${src.home}"
796 destdir="${build.home}"
797 debug="${compile.debug}"
798 deprecation="${compile.deprecation}"
799 optimize="${compile.optimize}">
800 <classpath>
801 <path refid="compile.classpath"/>
802 </classpath>
803 </javac>
804 <jar destfile="${build.home}/gsdl3.jar">
805 <fileset dir="${build.home}">
806 <include name="org/greenstone/gsdl3/**"/>
807 <exclude name="**/Test.class"/>
808 </fileset>
809 <manifest>
810 <attribute name="Built-By" value="${user.name}" />
811 </manifest>
812 </jar>
813 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
814 <jar destfile="${build.home}/GAI.jar">
815 <fileset dir="${build.home}">
816 <include name="org/greenstone/admin/**"/>
817 </fileset>
818 <manifest>
819 <attribute name="Built-By" value="${user.name}" />
820 </manifest>
821 </jar>
822
823 <jar destfile="${build.home}/phind.jar">
824 <fileset dir="${build.home}">
825 <include name="org/greenstone/applet/phind/**"/>
826 </fileset>
827 <manifest>
828 <attribute name="Built-By" value="${user.name}" />
829 </manifest>
830 </jar>
831 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
832 <jar destfile="${build.home}/anttasks.jar">
833 <fileset dir="${build.home}">
834 <include name="org/greenstone/anttasks/**"/>
835 </fileset>
836 <manifest>
837 <attribute name="Built-By" value="${user.name}" />
838 </manifest>
839 </jar>
840 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
841 <jar destfile="${build.home}/gsdl3test.jar">
842 <fileset dir="${build.home}">
843 <include name="org/greenstone/gsdl3/**/*Test.class"/>
844 <include name="org/greenstone/testing/**"/>
845 </fileset>
846 <manifest>
847 <attribute name="Built-By" value="${user.name}" />
848 </manifest>
849 </jar>
850 <jar destfile="${build.home}/server.jar">
851 <fileset dir="${build.home}">
852 <include name="org/greenstone/server/**"/>
853 </fileset>
854 <fileset file="${basedir}/resources/java/server.properties"/>
855 <manifest>
856 <attribute name="Built-By" value="${user.name}"/>
857 </manifest>
858 </jar>
859 <copy file="${build.home}/server.jar" todir="${basedir}"/>
860 </target>
861
862<!-- ================== Packages targets ================================ -->
863 <!-- these targets refer to the greenstone source packages - these need
864 updating less often, so are in separate targets to the core -->
865 <target name="prepare-packages" depends="init,prepare-indexers,prepare-windows"/>
866
867 <target name="prepare-windows" depends="init" if="current.os.iswindows">
868 <!-- need to download precompiled binaries for mg and mgpp -->
869 </target>
870
871 <target name="checkout-indexers" depends="check-cvsroot,init" if="independent-indexers" unless="nocvs.mode">
872 <cvs command="checkout -P" package="indexers" dest="${src.packages.home}"/>
873 </target>
874
875 <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
876 <antcall target="checkout-indexers"/>
877 </target>
878
879 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
880 description="Update only the source packages"/>
881
882 <target name="cvsupdate-packages" unless="nocvs.mode">
883 <cvs command="update -dP" dest="${src.packages.home}"/>
884 </target>
885
886 <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers"
887 description="Configure only the packages."/>
888
889 <target name="configure-javagdbm">
890 <echo>
891 Configuring JavaGDBM
892 </echo>
893 <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
894 dir="${javagdbm.home}">
895 <arg value="--prefix=${basedir}"/>
896 <arg value="--libdir=${lib.jni}"/>
897 </exec>
898 <exec executable="${javagdbm.home}/configure" os="${os.mac}"
899 dir="${javagdbm.home}">
900 <arg value="--prefix=${basedir}"/>
901 <arg value="--libdir=${lib.jni}"/>
902 <arg value="--with-gdbm=${gdbm.installed.path}"/>
903 </exec>
904
905 </target>
906 <target name="configure-indexers" depends="init" if="independent-indexers">
907 <echo>
908 Configuring Indexers
909 </echo>
910 <exec executable="${indexers.home}/configure" os="${os.unix}"
911 dir="${indexers.home}">
912 <arg value="--prefix=${basedir}"/>
913 <arg value="--libdir=${lib.jni}"/>
914 </exec>
915 </target>
916
917 <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
918
919 <target name="clean-javagdbm" depends="init">
920 <exec executable="make" os="${os.unix}"
921 dir="${javagdbm.home}">
922 <arg value="clean"/>
923 </exec>
924 </target>
925 <target name="clean-indexers" depends="init" if="independent-indexers">
926 <exec executable="make" os="${os.unix}"
927 dir="${indexers.home}">
928 <arg value="clean"/>
929 </exec>
930 </target>
931
932 <target name="clean-windows-c++-packages" depends="init" if="current.os.iswindows"
933 description="Clean only the C/C++ packages">
934 <exec executable="${compile.windows.c++.setup}"/>
935<!-- <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
936 <arg value="clean"/>
937 </exec>
938 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
939 <arg value="clean"/>
940 </exec>-->
941 <!-- Indexers -->
942 <!-- TODO -->
943 </target>
944
945 <target name="compile-packages"
946 description="Compile only the source packages">
947
948
949 <!-- javagdbm -->
950 <exec executable="make" os="${os.unix}"
951 dir="${javagdbm.home}">
952 </exec>
953 <exec executable="make" os="${os.unix}"
954 dir="${javagdbm.home}">
955 <arg value="install"/>
956 </exec>
957 <!-- windows: just the java stuff. -->
958 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}"
959 dir="${javagdbm.home}">
960 <arg value="compile"/>
961 <arg value="javaonly"/>
962 </exec>
963 <!-- install the jar file -->
964 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
965
966 <!-- Indexers -->
967 <!-- this may be in gs2build - we will be recompiling, but never mind -->
968 <exec executable="make" os="${os.unix}"
969 dir="${indexers.home}">
970 </exec>
971 <exec executable="make" os="${os.unix}"
972 dir="${indexers.home}">
973 <arg value="install"/>
974 </exec>
975 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
976 dir="${indexers.home}">
977 <arg value="all"/>
978 </exec>
979 <!-- install the jar and jni files -->
980 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
981 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
982 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
983 <antcall target="install-jni-files"/>
984 <!-- TODO windows -->
985 </target>
986
987 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
988
989 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
990 <copy file="${mg.home}/jni/libmgjni.so" todir="${lib.jni}"/>
991 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
992 <copy file="${mgpp.home}/jni/libmgppjni.so" todir="${lib.jni}"/>
993 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
994 </target>
995 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
996 <copy file="${mg.home}/jni/mgjni.dll" todir="${lib.jni}"/>
997 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
998 <copy file="${mgpp.home}/jni/mgppjni.dll" todir="${lib.jni}"/>
999 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1000 </target>
1001 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1002 <copy file="${mg.home}/jni/libmgjni.jnilib" todir="${lib.jni}"/>
1003 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1004 <copy file="${mgpp.home}/jni/libmgppjni.jnilib" todir="${lib.jni}"/>
1005 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1006 </target>
1007
1008 <target name="compile-packages-old"
1009 description="Compile only the packages">
1010 <echo>Compiling MG</echo>
1011 <exec executable="make" os="${os.unix}"
1012 dir="${mg.home}">
1013 </exec>
1014 <exec executable="make" os="${os.unix}"
1015 dir="${mg.home}">
1016 <arg value="install"/>
1017 </exec>
1018 <!-- windows: just the java stuff. -->
1019 <exec executable="${mg.home}/winMake.bat" os="${os.windows}"
1020 dir="${mg.home}">
1021 <arg value="compile"/>
1022 <arg value="javaonly"/>
1023 </exec>
1024 <!-- install the jar file -->
1025 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1026 <!-- mgpp -->
1027 <echo>Compiling MGPP</echo>
1028 <exec executable="make" os="${os.unix}"
1029 dir="${mgpp.home}">
1030 </exec>
1031 <exec executable="make" os="${os.unix}"
1032 dir="${mgpp.home}">
1033 <arg value="install"/>
1034 </exec>
1035 <!-- windows: just the java stuff. -->
1036 <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}"
1037 dir="${mgpp.home}">
1038 <arg value="compile"/>
1039 <arg value="javaonly"/>
1040 </exec>
1041 <!-- install the jar file -->
1042 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1043
1044 <!-- javagdbm -->
1045 <exec executable="make" os="${os.unix}"
1046 dir="${javagdbm.home}">
1047 </exec>
1048 <exec executable="make" os="${os.unix}"
1049 dir="${javagdbm.home}">
1050 <arg value="install"/>
1051 </exec>
1052 <!-- windows: just the java stuff. -->
1053 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}"
1054 dir="${javagdbm.home}">
1055 <arg value="compile"/>
1056 <arg value="javaonly"/>
1057 </exec>
1058 <!-- install the jar file -->
1059 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1060
1061 </target>
1062
1063 <target name="compile-windows-c++-packages" depends="init" if="current.os.iswindows"
1064 description="Compile only the C/C++ packages">
1065 <!-- TODO -->
1066 <exec executable="${compile.windows.c++.setup}"/>
1067 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1068 <env key="GSDL3HOME" value="${basedir}"/>
1069 </exec>
1070 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1071 <arg value="install"/>
1072 <env key="GSDL3HOME" value="${basedir}"/>
1073 </exec>
1074 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1075 <env key="GSDL3HOME" value="${basedir}"/>
1076 </exec>
1077 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1078 <arg value="install"/>
1079 <env key="GSDL3HOME" value="${basedir}"/>
1080 </exec>
1081 <exec executable="${javagdbm.home}/winMake.bat" dir="${javagdbm.home}">
1082 <env key="GSDL3HOME" value="${basedir}"/>
1083 </exec>
1084 <exec executable="${javagdbm.home}/winMake.bat" dir="${javagdbm.home}">
1085 <arg value="install"/>
1086 <env key="GSDL3HOME" value="${basedir}"/>
1087 </exec>
1088 </target>
1089
1090 <!-- ================== gs2building targets ===============-->
1091
1092
1093 <target name="update-gs2building" if="collection.building.enabled"
1094 depends="init,cvsupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1095 description="Update only the Greenstone 2 building components"/>
1096
1097 <target name="cvsupdate-gs2building" if="collection.building.enabled" depends="init,cvsupdate-gs2build,cvsupdate-gli" unless="nocvs.mode">
1098 </target>
1099 <target name="cvsupdate-gs2build" if="collection.building.enabled" depends="init" unless="nocvs.mode">
1100 <!-- Note: can't do a -d update here cos it will get all of gsdl
1101 also, an update doesn't get new files, so we do a checkout instead. -->
1102 <cvs command="checkout -P" package="gs2build" dest="${basedir}"/>
1103 </target>
1104
1105 <target name="cvsupdate-gli" if="collection.building.enabled" depends="init" unless="nocvs.mode">
1106 <cvs command="update -dP" dest="${gli.home}"/>
1107 </target>
1108
1109 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1110 </target>
1111
1112 <target name="checkout-gs2build" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode">
1113 <echo>checking out gs2build</echo>
1114 <cvs command="checkout -P" package="gs2build"/>
1115 </target>
1116
1117 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1118 <antcall target="checkout-gs2build"/>
1119 <antcall target="rename-gs2build-files"/>
1120 <antcall target="unzip-windows-packages"/>
1121 <antcall target="checkout-winbin"/>
1122 <antcall target="get-windows-binaries"/>
1123 <antcall target="delete-winbin"/>
1124 <antcall target="get-macos-extra"/>
1125 </target>
1126
1127 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1128 unless="nocvs.mode">
1129 <cvs command="checkout -P" package="winbin"/>
1130 </target>
1131
1132 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1133 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1134 <fileset dir="${basedir}/winbin/bin"/>
1135 </move>
1136 </target>
1137 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1138 <delete dir="${basedir}/winbin"/>
1139 </target>
1140
1141 <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows">
1142 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1143 dest="${gs2build.home}/packages/windows/gdbm"/>
1144 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1145 dest="${gs2build.home}/packages/windows/crypt"/>
1146 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1147 dest="${gs2build.home}/packages/windows/expat"/>
1148 </target>
1149
1150 <!-- downloads a good XML-Parser -->
1151 <target name="get-macos-extra" depends="init" if="need.macos.extra">
1152 <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1153 dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1154 usetimestamp="true"/>
1155 </target>
1156
1157 <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1158 <target name="install-macos-extra" depends="init" if="need.macos.extra">
1159 <!-- make sure these directories are present, otherwise chmod craps out
1160 this chmod is needed in case we are unpacking for a second time -->
1161 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1162 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1163 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1164 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1165 <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1166 dest="${gs2build.home}/perllib/cpan/"
1167 compression="gzip"/>
1168 </target>
1169
1170
1171 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows,gs2build-edit-setup-bat" if="collection.building.enabled"/>
1172
1173 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1174 <!-- we want a windows path in the setup.bat file -->
1175 <pathconvert targetos="windows" property="gs2build.home.windows">
1176 <path path="${gs2build.home}"/>
1177 </pathconvert>
1178 <copy file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup.bat">
1179 <filterset>
1180 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1181 </filterset>
1182 </copy>
1183 </target>
1184
1185 <target name="rename-gs2build-files-windows" if="collection.building.enabled.windows">
1186 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1187 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1188 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1189 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat"/>
1190 </target>
1191
1192 <target name="rename-gs2build-files-unix" if="collection.building.enabled.unix">
1193 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1194 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1195 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1196 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1197 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1198 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1199 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1200 <copy file="${gs2build-extra.home}/packages.Makefile.in" tofile="${gs2build.home}/packages/Makefile.in"/>
1201 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1202 </target>
1203
1204 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1205 <antcall target="checkout-gli"/>
1206 </target>
1207
1208 <target name="checkout-gli" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode">
1209 <echo>checking out gli</echo>
1210 <cvs command="checkout -P" package="gli"/>
1211 </target>
1212
1213 <target name="configure-gs2building" depends="init" if="collection.building.enabled"
1214 description="Configure only the Greenstone 2 building components">
1215 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1216 dir="${gs2build.home}">
1217 <arg value="--prefix=${gs2build.home}"/>
1218 </exec>
1219 <exec executable="${gs2build.home}/configure" os="${os.mac}"
1220 dir="${gs2build.home}">
1221 <arg value="--prefix=${gs2build.home}"/>
1222 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1223 </exec>
1224 </target>
1225
1226 <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1227 description="Clean only the Greenstone 2 building components"
1228 if="collection.building.enabled"/>
1229
1230 <target name="clean-gli" depends="init" if="collection.building.enabled">
1231 <!-- gli -->
1232 <property name="gli.home" value="${basedir}/gli"/>
1233 <!-- linux -->
1234 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1235 resolveExecutable="true"/>
1236 <!-- windows -->
1237 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1238 resolveExecutable="true"/>
1239 </target>
1240
1241 <target name="clean-gs2build" depends="init,clean-windows-c++-gs2building" if="collection.building.enabled">
1242 <!-- gs2build -->
1243 <!--linux: -->
1244 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1245 <arg value="clean"/>
1246 </exec>
1247 <!-- windows: -->
1248 </target>
1249
1250 <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
1251 <!-- gs2build -->
1252 <!--linux: -->
1253 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1254 <arg value="distclean"/>
1255 </exec>
1256 <!-- windows: -->
1257 </target>
1258
1259 <target name="clean-windows-c++-gs2building" depends="init" if="collection.building.enabled.windows"
1260 description="remove all object files and executables">
1261 <!-- run the setup script -->
1262 <exec executable="${compile.windows.c++.setup}"/>
1263 <exec executable="nmake" dir="${gs2build.home}">
1264 <arg value="/f"/>
1265 <arg value="win32.mak"/>
1266 <arg value="clean"/>
1267 </exec>
1268 </target>
1269
1270 <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
1271 description="Compile only the Greenstone 2 building components">
1272 </target>
1273
1274 <target name="compile-gli" depends="init" if="collection.building.enabled">
1275 <!-- gli -->
1276 <property name="gli.home" value="${basedir}/gli"/>
1277 <!-- linux -->
1278 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}"
1279 resolveExecutable="true"/>
1280 <!-- windows -->
1281 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
1282 resolveExecutable="true"/>
1283 </target>
1284
1285 <target name="compile-gs2build" depends="init,compile-windows-c++-gs2build" if="collection.building.enabled">
1286 <!-- gs2build -->
1287 <!--linux: make, make install -->
1288 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1289 </exec>
1290 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1291 <arg value="install"/>
1292 </exec>
1293 <antcall target="install-macos-extra"/>
1294 </target>
1295
1296 <!-- windows: -->
1297 <target name="compile-windows-c++-gs2build" depends="init" if="collection.building.enabled.windows"
1298 description="Use this if you want to compile the C++ code for the gs2build package">
1299 <!-- run the setup script -->
1300 <exec executable="${compile.windows.c++.setup}"/>
1301 <exec executable="nmake" dir="${gs2build.home}">
1302 <arg value="/f"/>
1303 <arg value="win32.mak"/>
1304 </exec>
1305 </target>
1306
1307 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1308 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1309 <env key="gsdl3path" path="${basedir}"/>
1310 <env key="gsdlpath" path="${basedir}/gs2build"/>
1311 </exec>
1312 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1313 <env key="gsdl3path" path="${basedir}"/>
1314 <env key="gsdlpath" path="${basedir}/gs2build"/>
1315 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1316 </exec>
1317 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1318 <env key="GSDL3PATH" path="${basedir}"/>
1319 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1320 </exec>
1321 <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.
1322 </echo>
1323 </target>
1324
1325
1326<!-- ======================== TESTING Targets ========================= -->
1327
1328 <target name="test" description="Run the (incomplete) JUnit test suite "
1329 depends="init">
1330 <mkdir dir="${basedir}/test"/>
1331 <junit printsummary="withOutAndErr"
1332 errorproperty="test.failed"
1333 failureproperty="test.failed"
1334 fork="${junit.fork}">
1335 <formatter type="plain"/>
1336 <classpath>
1337 <pathelement location="${build.home}/gsdl3test.jar"/>
1338 <path refid="compile.classpath"/>
1339 </classpath>
1340 <test name="${testcase}" if="testcase"/>
1341 <batchtest todir="${basedir}/test" unless="testcase">
1342 <fileset dir="${build.home}"
1343 includes="**/*Test.class"
1344 />
1345 </batchtest>
1346 </junit>
1347 <echo>
1348 *********************************************
1349 Test output can be found in directory 'test'
1350 *********************************************
1351 </echo>
1352 </target>
1353
1354</project>
1355
1356
Note: See TracBrowser for help on using the repository browser.