source: trunk/gsdl3/build.xml@ 13234

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

server.jar goes to top level gs3 dir not to web dir

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