source: trunk/gsdl3/build.xml@ 13074

Last change on this file since 13074 was 12753, checked in by kjdon, 18 years ago

changed last mod from prepare-for-dist-5 to prepare-for-dist-4

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