source: trunk/gsdl3/build.xml@ 13847

Last change on this file since 13847 was 13847, checked in by shaoqun, 17 years ago

added a target to download and unpack ant

  • Property svn:keywords set to Author Date Id Revision
File size: 54.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"
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
663
664<!-- ======================= ant Targets ============================ -->
665 <target name="prepare-ant" depends="init">
666 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
667 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
668 usetimestamp="true"/>
669 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
670 dest="${packages.home}"/>
671 <move todir="${packages.home}/ant">
672 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
673 </move>
674 </target>
675
676<!-- ======================= Axis Targets ============================ -->
677
678 <target name="prepare-axis" depends="init">
679 <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
680 dest="${packages.home}/axis-bin-1_2_1.zip"
681 usetimestamp="true"/>
682 <unzip src="${packages.home}/axis-bin-1_2_1.zip"
683 dest="${packages.home}"/>
684 <move todir="${packages.home}/axis">
685 <fileset dir="${packages.home}/axis-1_2_1"/>
686 </move>
687 <!-- install axis into greenstone web app -->
688 <copy todir="${web.lib}">
689 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
690 <include name="*.jar"/>
691 </fileset>
692 </copy>
693 <copy todir="${web.home}">
694 <fileset dir="${packages.home}/axis/webapps/axis/">
695 <include name="*.jsp"/>
696 <include name="*.jws"/>
697 </fileset>
698 </copy>
699 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
700 <copy todir="${web.classes}">
701 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
702 <include name="*.properties"/>
703 </fileset>
704 </copy>
705 </target>
706
707 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,create-deployment-files,deploy-site"
708 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
709
710 <target name="deploy-site">
711 <java classname="org.apache.axis.client.AdminClient">
712 <classpath refid="compile.classpath"/>
713 <arg value="-l"/>
714 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
715 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
716 </java>
717 </target>
718
719 <target name="soap-undeploy-site" depends="get-sitename"
720 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
721 <java classname="org.apache.axis.client.AdminClient">
722 <classpath refid="compile.classpath"/>
723 <arg value="-l"/>
724 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
725 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
726 </java>
727 </target>
728
729 <!-- this target used to deploy the preprepared localsite server -->
730 <target name="deploy-localsite" depends="init"
731 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
732 <antcall target="start-tomcat"/>
733 <antcall target="deploy-site">
734 <param name="axis.sitename" value="localsite"/>
735 </antcall>
736 <antcall target="stop-tomcat"/>
737 </target>
738
739 <target name="get-sitename" unless="axis.sitename">
740 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
741 </target>
742
743 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
744 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
745 <echo>${axis.sitename}, ${axis.siteuri}</echo>
746 </target>
747
748 <target name="check-deployment-files" depends="get-sitename">
749 <condition property="deploy.exists">
750 <and>
751 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
752 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
753 <available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
754 </and>
755 </condition>
756 </target>
757
758 <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files"
759 if="axis.sitename" unless="deploy.exists">
760 <filter token="sitename" value="${axis.sitename}"/>
761 <filter token="siteuri" value="${axis.siteuri}"/>
762 <copy file="${basedir}/resources/soap/site.wsdd.template"
763 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
764 filtering="true"/>
765 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
766 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
767 filtering="true"/>
768 <!-- create the java files and compile them -->
769 <copy file="${gsdl3.home}/SOAPServer.java.in"
770 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
771 filtering="true"/>
772 <mkdir dir="${build.home}"/>
773 <javac srcdir="${src.home}"
774 destdir="${build.home}"
775 debug="${compile.debug}"
776 deprecation="${compile.deprecation}"
777 optimize="${compile.optimize}">
778 <classpath refid="compile.classpath"/>
779 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
780 </javac>
781 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
782 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
783 </target>
784
785
786<!-- ====================== Core targets ============================== -->
787<!-- core targets refer to the core gsdl3 java src -->
788
789 <target name="prepare-core" unless="nocvs.mode">
790 <!-- just get rid of empty directories-->
791 <cvs command="update -P"/>
792 </target>
793
794 <target name="configure-core"/>
795
796 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
797 description="Update only the Greenstone core" />
798
799 <target name="cvsupdate-core" unless="nocvs.mode">
800 <cvs command="update -l"/>
801 <cvs command="update -dP bin comms dist-resources docs lib resources src winutil"/>
802 </target>
803
804 <target name="clean-core"
805 description="Clean only the Greenstone core">
806 <delete dir="${build.home}"/>
807 </target>
808
809 <target name="compile-core" depends="init"
810 description="Compile only the Greenstone core">
811 <mkdir dir="${build.home}"/>
812 <javac srcdir="${src.home}"
813 destdir="${build.home}"
814 debug="${compile.debug}"
815 deprecation="${compile.deprecation}"
816 optimize="${compile.optimize}">
817 <classpath>
818 <path refid="compile.classpath"/>
819 </classpath>
820 </javac>
821 <jar destfile="${build.home}/gsdl3.jar">
822 <fileset dir="${build.home}">
823 <include name="org/greenstone/gsdl3/**"/>
824 <exclude name="**/Test.class"/>
825 </fileset>
826 <manifest>
827 <attribute name="Built-By" value="${user.name}" />
828 </manifest>
829 </jar>
830 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
831 <!-- copy the localsite server in case we need it -->
832 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServerlocalsite.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServerlocalsite.class" />
833
834 <jar destfile="${build.home}/GAI.jar">
835 <fileset dir="${build.home}">
836 <include name="org/greenstone/admin/**"/>
837 </fileset>
838 <manifest>
839 <attribute name="Built-By" value="${user.name}" />
840 </manifest>
841 </jar>
842
843 <jar destfile="${build.home}/phind.jar">
844 <fileset dir="${build.home}">
845 <include name="org/greenstone/applet/phind/**"/>
846 </fileset>
847 <manifest>
848 <attribute name="Built-By" value="${user.name}" />
849 </manifest>
850 </jar>
851 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
852 <jar destfile="${build.home}/anttasks.jar">
853 <fileset dir="${build.home}">
854 <include name="org/greenstone/anttasks/**"/>
855 </fileset>
856 <manifest>
857 <attribute name="Built-By" value="${user.name}" />
858 </manifest>
859 </jar>
860 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
861 <jar destfile="${build.home}/gsdl3test.jar">
862 <fileset dir="${build.home}">
863 <include name="org/greenstone/gsdl3/**/*Test.class"/>
864 <include name="org/greenstone/testing/**"/>
865 </fileset>
866 <manifest>
867 <attribute name="Built-By" value="${user.name}" />
868 </manifest>
869 </jar>
870 <jar destfile="${build.home}/server.jar">
871 <fileset dir="${build.home}">
872 <include name="org/greenstone/server/**"/>
873 </fileset>
874 <fileset file="${basedir}/resources/java/server.properties"/>
875 <manifest>
876 <attribute name="Built-By" value="${user.name}"/>
877 </manifest>
878 </jar>
879 <copy file="${build.home}/server.jar" todir="${basedir}"/>
880 </target>
881
882<!-- ================== Packages targets ================================ -->
883 <!-- these targets refer to the greenstone source packages - these need
884 updating less often, so are in separate targets to the core -->
885 <target name="prepare-packages" depends="init,prepare-indexers"/>
886
887 <target name="checkout-indexers" depends="check-cvsroot,init" if="independent-indexers" unless="nocvs.mode">
888 <cvs command="checkout -P" package="indexers" dest="${src.packages.home}"/>
889 </target>
890
891 <target name="prepare-indexers" depends="init" if="independent-indexers" unless="indexers.present">
892 <antcall target="checkout-indexers"/>
893 </target>
894
895 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
896 description="Update only the source packages"/>
897
898 <target name="cvsupdate-packages" unless="nocvs.mode">
899 <cvs command="update -dP" dest="${src.packages.home}"/>
900 </target>
901
902 <target name="configure-packages" depends="init,configure-javagdbm,configure-indexers"
903 description="Configure only the packages."/>
904
905 <target name="configure-javagdbm">
906 <echo>
907 Configuring JavaGDBM
908 </echo>
909 <exec executable="${javagdbm.home}/configure" os="${os.linux},${os.solaris}"
910 dir="${javagdbm.home}">
911 <arg value="--prefix=${basedir}"/>
912 <arg value="--libdir=${lib.jni}"/>
913 </exec>
914 <exec executable="${javagdbm.home}/configure" os="${os.mac}"
915 dir="${javagdbm.home}">
916 <arg value="--prefix=${basedir}"/>
917 <arg value="--libdir=${lib.jni}"/>
918 <arg value="--with-gdbm=${gdbm.installed.path}"/>
919 </exec>
920
921 </target>
922 <target name="configure-indexers" depends="init" if="independent-indexers">
923 <echo>
924 Configuring Indexers
925 </echo>
926 <exec executable="${indexers.home}/configure" os="${os.unix}"
927 dir="${indexers.home}">
928 <arg value="--prefix=${basedir}"/>
929 <arg value="--libdir=${lib.jni}"/>
930 </exec>
931 </target>
932
933 <target name="clean-packages" depends="init,clean-javagdbm,clean-indexers" description="Clean only the packages"/>
934
935 <target name="clean-javagdbm" depends="init">
936 <exec executable="make" os="${os.unix}"
937 dir="${javagdbm.home}">
938 <arg value="clean"/>
939 </exec>
940 </target>
941 <target name="clean-indexers" depends="init" if="independent-indexers">
942 <exec executable="make" os="${os.unix}"
943 dir="${indexers.home}">
944 <arg value="clean"/>
945 </exec>
946 </target>
947
948 <target name="clean-windows-c++-packages" depends="init" if="current.os.iswindows"
949 description="Clean only the C/C++ packages">
950 <exec executable="${compile.windows.c++.setup}"/>
951<!-- <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
952 <arg value="clean"/>
953 </exec>
954 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
955 <arg value="clean"/>
956 </exec>-->
957 <!-- Indexers -->
958 <!-- TODO -->
959 </target>
960
961 <target name="compile-packages"
962 description="Compile only the source packages">
963
964
965 <!-- javagdbm -->
966 <exec executable="make" os="${os.unix}"
967 dir="${javagdbm.home}">
968 </exec>
969 <exec executable="make" os="${os.unix}"
970 dir="${javagdbm.home}">
971 <arg value="install"/>
972 </exec>
973 <!-- windows: just the java stuff. -->
974 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}"
975 dir="${javagdbm.home}">
976 <arg value="compile"/>
977 <arg value="javaonly"/>
978 </exec>
979 <!-- install the jar file -->
980 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
981
982 <!-- Indexers -->
983 <!-- this may be in gs2build - we will be recompiling, but never mind -->
984 <exec executable="make" os="${os.unix}"
985 dir="${indexers.home}">
986 </exec>
987 <exec executable="make" os="${os.unix}"
988 dir="${indexers.home}">
989 <arg value="install"/>
990 </exec>
991 <exec executable="${indexers.home}/winMake.bat" os="${os.windows}"
992 dir="${indexers.home}">
993 <arg value="all"/>
994 </exec>
995 <!-- install the jar and jni files -->
996 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
997 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
998 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
999 <antcall target="install-jni-files"/>
1000 </target>
1001
1002 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1003
1004 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1005 <copy file="${mg.home}/jni/libmgjni.so" todir="${lib.jni}"/>
1006 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1007 <copy file="${mgpp.home}/jni/libmgppjni.so" todir="${lib.jni}"/>
1008 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1009 </target>
1010 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1011 <copy file="${mg.home}/jni/mgjni.dll" todir="${lib.jni}"/>
1012 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1013 <copy file="${mgpp.home}/jni/mgppjni.dll" todir="${lib.jni}"/>
1014 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1015 </target>
1016 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1017 <copy file="${mg.home}/jni/libmgjni.jnilib" todir="${lib.jni}"/>
1018 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1019 <copy file="${mgpp.home}/jni/libmgppjni.jnilib" todir="${lib.jni}"/>
1020 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1021 </target>
1022
1023 <target name="compile-windows-c++-packages" depends="init" if="current.os.iswindows"
1024 description="Compile only the C/C++ packages">
1025 <!-- TODO -->
1026 <exec executable="${compile.windows.c++.setup}"/>
1027 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1028 <env key="GSDL3HOME" value="${basedir}"/>
1029 </exec>
1030 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1031 <arg value="install"/>
1032 <env key="GSDL3HOME" value="${basedir}"/>
1033 </exec>
1034 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1035 <env key="GSDL3HOME" value="${basedir}"/>
1036 </exec>
1037 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1038 <arg value="install"/>
1039 <env key="GSDL3HOME" value="${basedir}"/>
1040 </exec>
1041 <exec executable="${javagdbm.home}/winMake.bat" dir="${javagdbm.home}">
1042 <env key="GSDL3HOME" value="${basedir}"/>
1043 </exec>
1044 <exec executable="${javagdbm.home}/winMake.bat" dir="${javagdbm.home}">
1045 <arg value="install"/>
1046 <env key="GSDL3HOME" value="${basedir}"/>
1047 </exec>
1048 </target>
1049
1050 <!-- ================== gs2building targets ===============-->
1051
1052
1053 <target name="update-gs2building" if="collection.building.enabled"
1054 depends="init,cvsupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1055 description="Update only the Greenstone 2 building components"/>
1056
1057 <target name="cvsupdate-gs2building" if="collection.building.enabled" depends="init,cvsupdate-gs2build,cvsupdate-gli" unless="nocvs.mode">
1058 </target>
1059 <target name="cvsupdate-gs2build" if="collection.building.enabled" depends="init" unless="nocvs.mode">
1060 <!-- Note: can't do a -d update here cos it will get all of gsdl
1061 also, an update doesn't get new files, so we do a checkout instead. -->
1062 <cvs command="checkout -P" package="gs2build" dest="${basedir}"/>
1063 </target>
1064
1065 <target name="cvsupdate-gli" if="collection.building.enabled" depends="init" unless="nocvs.mode">
1066 <cvs command="update -dP" dest="${gli.home}"/>
1067 </target>
1068
1069 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1070 </target>
1071
1072 <target name="checkout-gs2build" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode">
1073 <echo>checking out gs2build</echo>
1074 <cvs command="checkout -P" package="gs2build"/>
1075 </target>
1076
1077 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1078 <antcall target="checkout-gs2build"/>
1079 <antcall target="rename-gs2build-files"/>
1080 <antcall target="unzip-windows-packages"/>
1081 <antcall target="checkout-winbin"/>
1082 <antcall target="get-windows-binaries"/>
1083 <antcall target="delete-winbin"/>
1084 <antcall target="get-macos-extra"/>
1085 </target>
1086
1087 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1088 unless="nocvs.mode">
1089 <cvs command="checkout -P" package="winbin"/>
1090 </target>
1091
1092 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1093 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1094 <fileset dir="${basedir}/winbin/bin"/>
1095 </move>
1096 </target>
1097 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1098 <delete dir="${basedir}/winbin"/>
1099 </target>
1100
1101 <target name="unzip-windows-packages" depends="init" if="collection.building.enabled.windows">
1102 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1103 dest="${gs2build.home}/packages/windows/gdbm"/>
1104 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1105 dest="${gs2build.home}/packages/windows/crypt"/>
1106 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1107 dest="${gs2build.home}/packages/windows/expat"/>
1108 </target>
1109
1110 <!-- downloads a good XML-Parser -->
1111 <target name="get-macos-extra" depends="init" if="need.macos.extra">
1112 <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1113 dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1114 usetimestamp="true"/>
1115 </target>
1116
1117 <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1118 <target name="install-macos-extra" depends="init" if="need.macos.extra">
1119 <!-- make sure these directories are present, otherwise chmod craps out
1120 this chmod is needed in case we are unpacking for a second time -->
1121 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1122 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1123 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1124 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1125 <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1126 dest="${gs2build.home}/perllib/cpan/"
1127 compression="gzip"/>
1128 </target>
1129
1130
1131 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows,gs2build-edit-setup-bat" if="collection.building.enabled"/>
1132
1133 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1134 <!-- we want a windows path in the setup.bat file -->
1135 <pathconvert targetos="windows" property="gs2build.home.windows">
1136 <path path="${gs2build.home}"/>
1137 </pathconvert>
1138 <copy file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup.bat">
1139 <filterset>
1140 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1141 </filterset>
1142 </copy>
1143 </target>
1144
1145 <target name="rename-gs2build-files-windows" if="collection.building.enabled.windows">
1146 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1147 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1148 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1149 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat"/>
1150 </target>
1151
1152 <target name="rename-gs2build-files-unix" if="collection.building.enabled.unix">
1153 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1154 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1155 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1156 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1157 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1158 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1159 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1160 <copy file="${gs2build-extra.home}/packages.Makefile.in" tofile="${gs2build.home}/packages/Makefile.in"/>
1161 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1162 </target>
1163
1164 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1165 <antcall target="checkout-gli"/>
1166 </target>
1167
1168 <target name="checkout-gli" depends="check-cvsroot,init" if="collection.building.enabled" unless="nocvs.mode">
1169 <echo>checking out gli</echo>
1170 <cvs command="checkout -P" package="gli"/>
1171 </target>
1172
1173 <target name="configure-gs2building" depends="init" if="collection.building.enabled"
1174 description="Configure only the Greenstone 2 building components">
1175 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1176 dir="${gs2build.home}">
1177 <arg value="--prefix=${gs2build.home}"/>
1178 </exec>
1179 <exec executable="${gs2build.home}/configure" os="${os.mac}"
1180 dir="${gs2build.home}">
1181 <arg value="--prefix=${gs2build.home}"/>
1182 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1183 </exec>
1184 </target>
1185
1186 <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1187 description="Clean only the Greenstone 2 building components"
1188 if="collection.building.enabled"/>
1189
1190 <target name="clean-gli" depends="init" if="collection.building.enabled">
1191 <!-- gli -->
1192 <property name="gli.home" value="${basedir}/gli"/>
1193 <!-- linux -->
1194 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1195 resolveExecutable="true"/>
1196 <!-- windows -->
1197 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1198 resolveExecutable="true"/>
1199 </target>
1200
1201 <target name="clean-gs2build" depends="init,clean-windows-c++-gs2building" if="collection.building.enabled">
1202 <!-- gs2build -->
1203 <!--linux: -->
1204 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1205 <arg value="clean"/>
1206 </exec>
1207 <!-- windows: -->
1208 </target>
1209
1210 <target name="distclean-gs2build" depends="init" if="collection.building.enabled">
1211 <!-- gs2build -->
1212 <!--linux: -->
1213 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1214 <arg value="distclean"/>
1215 </exec>
1216 <!-- windows: -->
1217 </target>
1218
1219 <target name="clean-windows-c++-gs2building" depends="init" if="collection.building.enabled.windows"
1220 description="remove all object files and executables">
1221 <!-- run the setup script -->
1222 <exec executable="${compile.windows.c++.setup}"/>
1223 <exec executable="nmake" dir="${gs2build.home}">
1224 <arg value="/f"/>
1225 <arg value="win32.mak"/>
1226 <arg value="clean"/>
1227 </exec>
1228 </target>
1229
1230 <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="collection.building.enabled"
1231 description="Compile only the Greenstone 2 building components">
1232 </target>
1233
1234 <target name="compile-gli" depends="init" if="collection.building.enabled">
1235 <!-- gli -->
1236 <property name="gli.home" value="${basedir}/gli"/>
1237 <!-- linux -->
1238 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}"
1239 resolveExecutable="true"/>
1240 <!-- windows -->
1241 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
1242 resolveExecutable="true"/>
1243 </target>
1244
1245 <target name="compile-gs2build" depends="init,compile-windows-c++-gs2build" if="collection.building.enabled">
1246 <!-- gs2build -->
1247 <!--linux: make, make install -->
1248 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1249 </exec>
1250 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1251 <arg value="install"/>
1252 </exec>
1253 <antcall target="install-macos-extra"/>
1254 </target>
1255
1256 <!-- windows: -->
1257 <target name="compile-windows-c++-gs2build" depends="init" if="collection.building.enabled.windows"
1258 description="Use this if you want to compile the C++ code for the gs2build package">
1259 <!-- run the setup script -->
1260 <exec executable="${compile.windows.c++.setup}"/>
1261 <exec executable="nmake" dir="${gs2build.home}">
1262 <arg value="/f"/>
1263 <arg value="win32.mak"/>
1264 </exec>
1265 </target>
1266
1267 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1268 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1269 <env key="gsdl3path" path="${basedir}"/>
1270 <env key="gsdlpath" path="${basedir}/gs2build"/>
1271 </exec>
1272 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1273 <env key="gsdl3path" path="${basedir}"/>
1274 <env key="gsdlpath" path="${basedir}/gs2build"/>
1275 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1276 </exec>
1277 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1278 <env key="GSDL3PATH" path="${basedir}"/>
1279 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1280 </exec>
1281 <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.
1282 </echo>
1283 </target>
1284
1285
1286<!-- ======================== TESTING Targets ========================= -->
1287
1288 <target name="test" description="Run the (incomplete) JUnit test suite "
1289 depends="init">
1290 <mkdir dir="${basedir}/test"/>
1291 <junit printsummary="withOutAndErr"
1292 errorproperty="test.failed"
1293 failureproperty="test.failed"
1294 fork="${junit.fork}">
1295 <formatter type="plain"/>
1296 <classpath>
1297 <pathelement location="${build.home}/gsdl3test.jar"/>
1298 <path refid="compile.classpath"/>
1299 </classpath>
1300 <test name="${testcase}" if="testcase"/>
1301 <batchtest todir="${basedir}/test" unless="testcase">
1302 <fileset dir="${build.home}"
1303 includes="**/*Test.class"
1304 />
1305 </batchtest>
1306 </junit>
1307 <echo>
1308 *********************************************
1309 Test output can be found in directory 'test'
1310 *********************************************
1311 </echo>
1312 </target>
1313
1314</project>
1315
1316
Note: See TracBrowser for help on using the repository browser.