source: trunk/gsdl3/build.xml@ 13283

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

modified the prepare-for-dist targets as now we are using installshield to create an installer. So linux is the main source, the other platforms bits are used just to get the binaries.

  • Property svn:keywords set to Author Date Id Revision
File size: 59.3 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++-gs2build,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,cvsupdate-gs2build,cvsupdate-gli" unless="nocvs.mode">
980 </target>
981 <target name="cvsupdate-gs2build" if="gsdl2.islocal" depends="init" unless="nocvs.mode">
982 <!-- Note: can't do a -d update here cos it will get all of gsdl
983 also, an update doesn't get new files, so we do a checkout instead. -->
984 <cvs command="co gs2build" dest="${basedir}"/>
985 </target>
986
987 <target name="cvsupdate-gli" if="gsdl2.islocal" depends="init" unless="nocvs.mode">
988 <cvs command="update -dP" dest="${gli.home}"/>
989 </target>
990
991 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal">
992 </target>
993
994 <target name="checkout-gs2build" depends="check-cvsroot,init" unless="nocvs.mode">
995 <echo>checking out gs2build</echo>
996 <cvs command="checkout -P" package="gs2build"/>
997 </target>
998
999 <target name="prepare-gs2build" depends="init" if="gsdl2.islocal" unless="gs2build.present">
1000 <antcall target="checkout-gs2build"/>
1001 <!-- rename the .gs2build files -->
1002 <antcall target="rename-gs2build-files"/>
1003 <antcall target="unzip-windows-packages"/>
1004 <antcall target="checkout-winbin"/>
1005 <antcall target="get-windows-binaries"/>
1006 <antcall target="get-macos-extra"/>
1007 </target>
1008
1009 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1010 unless="nocvs.mode">
1011 <cvs command="checkout -P" package="winbin"/>
1012 </target>
1013
1014 <target name="get-windows-binaries" depends="init" if="current.os.iswindows">
1015<!-- <copy todir="${basedir}/bin">
1016 <fileset dir="${basedir}/winbin/bin" includes="mg*.exe"/>
1017 </copy>-->
1018 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1019 <fileset dir="${basedir}/winbin/bin"/>
1020 </move>
1021 <delete dir="${basedir}/winbin"/>
1022 </target>
1023
1024 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
1025 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1026 dest="${gs2build.home}/packages/windows/gdbm"/>
1027 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1028 dest="${gs2build.home}/packages/windows/crypt"/>
1029 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1030 dest="${gs2build.home}/packages/windows/expat"/>
1031 </target>
1032
1033 <!-- downloads a good XML-Parser -->
1034 <target name="get-macos-extra" depends="init" if="need.macos.extra">
1035 <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1036 dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1037 usetimestamp="true"/>
1038 </target>
1039
1040 <!-- untars the XML-Parser. need to do this after compiling in gs2build-->
1041 <target name="install-macos-extra" depends="init" if="need.macos.extra">
1042 <!-- make sure these directories are present, otherwise chmod craps out
1043 this chmod is needed in case we are unpacking for a second time -->
1044 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.8"/>
1045 <mkdir dir="${gs2build.home}/perllib/cpan/perl-5.6"/>
1046 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.8" perm="ug+w" includes="**"/>
1047 <chmod dir="${gs2build.home}/perllib/cpan/perl-5.6" perm="ug+w" includes="**"/>
1048 <untar src="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1049 dest="${gs2build.home}/perllib/cpan/"
1050 compression="gzip"/>
1051 </target>
1052
1053 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows"/>
1054
1055 <target name="rename-gs2build-files-windows" if="current.os.iswindows">
1056 <!-- we want a windows path in the setup.bat file -->
1057 <pathconvert targetos="windows" property="gs2build.home.windows">
1058 <path path="${gs2build.home}"/>
1059 </pathconvert>
1060
1061 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1062 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1063 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1064 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat">
1065 <filterset>
1066 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1067 </filterset>
1068 </copy>
1069 </target>
1070 <target name="rename-gs2build-files-unix" if="current.os.isunix">
1071 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1072 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1073 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1074 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1075 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1076 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1077 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1078 <copy file="${gs2build-extra.home}/packages.Makefile" tofile="${gs2build.home}/packages/Makefile"/>
1079 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1080
1081 </target>
1082 <target name="prepare-gli" depends="init" if="gsdl2.islocal" unless="gli.present">
1083 <antcall target="checkout-gli"/>
1084 </target>
1085
1086 <target name="checkout-gli" depends="check-cvsroot,init" if="gsdl2.islocal" unless="nocvs.mode">
1087 <echo>checking out gli</echo>
1088 <cvs command="checkout -P" package="gli"/>
1089 </target>
1090
1091 <target name="configure-gs2building" depends="init" if="gsdl2.islocal"
1092 description="Configure only the Greenstone 2 building components">
1093 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.solaris}"
1094 dir="${gs2build.home}">
1095 <arg value="--prefix=${gs2build.home}"/>
1096 </exec>
1097 <exec executable="${gs2build.home}/configure" os="${os.mac}"
1098 dir="${gs2build.home}">
1099 <arg value="--prefix=${gs2build.home}"/>
1100 <arg value="--with-gdbm=${gdbm.installed.path}"/>
1101 </exec>
1102 </target>
1103
1104 <target name="clean-gs2building" depends="init,clean-gli,clean-gs2build"
1105 description="Clean only the Greenstone 2 building components"/>
1106 <target name="clean-gli" depends="init" if="gsdl2.islocal">
1107 <!-- gli -->
1108 <property name="gli.home" value="${basedir}/gli"/>
1109 <!-- linux -->
1110 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1111 resolveExecutable="true"/>
1112 <!-- windows -->
1113 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1114 resolveExecutable="true"/>
1115 </target>
1116 <target name="clean-gs2build" depends="init" if="gsdl2.islocal">
1117 <!-- gs2build -->
1118 <!--linux: -->
1119 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1120 <arg value="clean"/>
1121 </exec>
1122 <!-- windows: -->
1123 </target>
1124 <target name="distclean-gs2build" depends="init" if="gsdl2.islocal">
1125 <!-- gs2build -->
1126 <!--linux: -->
1127 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1128 <arg value="distclean"/>
1129 </exec>
1130 <!-- windows: -->
1131 </target>
1132
1133 <target name="clean-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1134 description="remove all object files and executables">
1135 <!-- run the setup script -->
1136 <exec executable="${compile.windows.c++.setup}"/>
1137 <exec executable="nmake" dir="${gs2build.home}">
1138 <arg value="/f"/>
1139 <arg value="win32.mak"/>
1140 <arg value="clean"/>
1141 </exec>
1142 </target>
1143
1144 <target name="compile-gs2building" depends="init,compile-gs2build,compile-gli" if="gsdl2.islocal"
1145 description="Compile only the Greenstone 2 building components">
1146 </target>
1147 <target name="compile-gli" depends="init" if="gsdl2.islocal">
1148 <!-- gli -->
1149 <property name="gli.home" value="${basedir}/gli"/>
1150 <!-- linux -->
1151 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}"
1152 resolveExecutable="true"/>
1153 <!-- windows -->
1154 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
1155 resolveExecutable="true"/>
1156 </target>
1157 <target name="compile-gs2build" depends="init" if="gsdl2.islocal">
1158 <!-- gs2build -->
1159 <!--linux: make, make install -->
1160 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1161 </exec>
1162 <exec executable="make" os="${os.unix}" dir="${gs2build.home}">
1163 <arg value="install"/>
1164 </exec>
1165 <antcall target="install-macos-extra"/>
1166 </target>
1167 <!-- windows: -->
1168 <target name="compile-windows-c++-gs2build" depends="init" if="current.os.iswindows"
1169 description="Use this if you want to compile the C++ code for the gs2build package">
1170 <!-- run the setup script -->
1171 <exec executable="${compile.windows.c++.setup}"/>
1172 <exec executable="nmake" dir="${gs2build.home}">
1173 <arg value="/f"/>
1174 <arg value="win32.mak"/>
1175 </exec>
1176 </target>
1177
1178 <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external">
1179 </target>
1180
1181 <target name="gli-local" depends="init" if="gsdl2.islocal">
1182 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1183 <env key="gsdl3path" path="${basedir}"/>
1184 <env key="gsdlpath" path="${basedir}/gs2build"/>
1185 </exec>
1186 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1187 <env key="gsdl3path" path="${basedir}"/>
1188 <env key="gsdlpath" path="${basedir}/gs2build"/>
1189 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1190 </exec>
1191 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1192 <env key="GSDL3PATH" path="${basedir}"/>
1193 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1194 </exec>
1195 <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.
1196 </echo>
1197 </target>
1198
1199 <target name="gli-external" depends="init" unless="gsdl2.islocal">
1200 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.sh" os="${os.linux},${os.solaris}" dir="${gsdl2.installed.path}/gli" spawn="true">
1201 <env key="gsdl3path" path="${basedir}"/>
1202 <env key="gsdlpath" path="${gsdl2.installed.path}"/>
1203 </exec>
1204 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.sh" os="${os.mac}" dir="${gsdl2.installed.path}/gli" spawn="true">
1205 <env key="gsdl3path" path="${basedir}"/>
1206 <env key="gsdlpath" path="${gsdl2.installed.path}"/>
1207 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.installed.path}/lib"/>
1208 </exec>
1209 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl2.installed.path}/gli" spawn="true">
1210 <env key="GSDL3PATH" path="${basedir}"/>
1211 <env key="GSDLPATH" path="${gsdl2.installed.path}"/>
1212 </exec>
1213 <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:
1214 (Linux/Mac OS X / Windows)
1215in greenstone3 directory: source gs3-setup.sh / gs3-setup
1216in gsdl directory: source setup.bash / setup
1217in gli directory: gli4gs3.sh / gli4gs3
1218 </echo>
1219 </target>
1220
1221
1222<!-- ======================== TESTING Targets ========================= -->
1223
1224 <target name="test" description="Run the (incomplete) JUnit test suite "
1225 depends="init">
1226 <mkdir dir="${basedir}/test"/>
1227 <junit printsummary="withOutAndErr"
1228 errorproperty="test.failed"
1229 failureproperty="test.failed"
1230 fork="${junit.fork}">
1231 <formatter type="plain"/>
1232 <classpath>
1233 <pathelement location="${build.home}/gsdl3test.jar"/>
1234 <path refid="compile.classpath"/>
1235 </classpath>
1236 <test name="${testcase}" if="testcase"/>
1237 <batchtest todir="${basedir}/test" unless="testcase">
1238 <fileset dir="${build.home}"
1239 includes="**/*Test.class"
1240 />
1241 </batchtest>
1242 </junit>
1243 <echo>
1244 *********************************************
1245 Test output can be found in directory 'test'
1246 *********************************************
1247 </echo>
1248 </target>
1249
1250
1251<!-- ====================== DISTRIBUTION Targets ========================= -->
1252
1253 <!-- these two, do we need tomcat and axis for compilation??-->
1254 <target name="prepare-for-dist-windows" depends="init">
1255 <cvs command="export -D '1 second ago'" package="mgpp"
1256 dest="${src.packages.home}"
1257 cvsRoot="${cvs.root}" />
1258 <cvs command="export -D '1 second ago'" package="gs2build"
1259 cvsRoot="${cvs.root}" />
1260 <antcall target="unzip-windows-packages"/>
1261 <antcall target="checkout-winbin"/>
1262 <antcall target="get-windows-binaries"/>
1263 <antcall target="get-perl-for-windows"/>
1264 <antcall target="rename-gs2build-files-windows"/>
1265 <!-- -->
1266 <antcall target="compile-windows-c++"/>
1267 <antcall target="compile-packages"/>
1268 </target>
1269
1270 <target name="prepare-for-dist-macos-1" depends="init">
1271 <cvs command="export -D '1 second ago'" package="mgpp"
1272 dest="${src.packages.home}"
1273 cvsRoot="${cvs.root}" />
1274 <cvs command="export -D '1 second ago'" package="gs2build"
1275 cvsRoot="${cvs.root}" />
1276 <antcall target="rename-gs2build-files-unix"/>
1277 <antcall target="delete-windows-files"/>
1278 <antcall target="get-macos-extra"/>
1279 <antcall target="configure-c++"/>
1280 </target>
1281 <target name="prepare-for-dist-macos-2" depends="init">
1282 <antcall target="compile-packages"/>
1283 <antcall target="compile-gs2build"/>
1284 </target>
1285
1286 <target name="prepare-for-dist-linux-1" depends="init">
1287 <cvs command="export -D '1 second ago'" package="mgpp"
1288 dest="${src.packages.home}"
1289 cvsRoot="${cvs.root}" />
1290 <cvs command="export -D '1 second ago'" package="gs2build"
1291 cvsRoot="${cvs.root}" />
1292 <cvs command="export -D '1 second ago'" package="gli"
1293 cvsRoot="${cvs.root}" />
1294 <delete file="${gli.home}/gli.bat"/>
1295 <delete file="${gli.home}/gli.sh"/>
1296 <antcall target="rename-gs2build-files-unix"/>
1297 <antcall target="unzip-windows-packages"/>
1298 <!--<antcall target="checkout-winbin"/>
1299 <antcall target="get-windows-binaries"/>
1300 <antcall target="get-perl-for-windows"/>-->
1301 <antcall target="get-macos-extra"/>
1302 <antcall target="delete-windows-files"/>
1303 <antcall target="prepare-tomcat"/>
1304 <delete file="${packages.home}/apache-tomcat-5.5.12.zip"/>
1305 <delete file="${packages.home}/apache-tomcat-5.5.12-compat.zip"/>
1306 <antcall target="configure-tomcat"/>
1307 <antcall target="prepare-axis"/>
1308 <delete file="${packages.home}/axis-bin-1_2_1.zip"/>
1309 <!-- delete old axis dir -->
1310 <delete dir="${packages.home}/axis"/>
1311 <antcall target="prepare-web"/>
1312 <antcall target="prepare-collections"/>
1313 <mkdir dir="Linux/bin"/>
1314 <mkdir dir="Linux/lib/jni"/>
1315 <mkdir dir="Darwin/bin"/>
1316 <mkdir dir="Darwin/lib/jni"/>
1317 <mkdir dir="Windows/lib/jni"/>
1318 <mkdir dir="Windows/bin"/>
1319 <mkdir dir="source"/>
1320 <mkdir dir="gs2build/bin/windows"/>
1321 <mkdir dir="gs2build/bin/linux"/>
1322 </target>
1323
1324
1325 <target name="prepare-for-dist-linux-2" depends="init">
1326 <antcall target="configure-c++"/>
1327 </target>
1328
1329 <target name="prepare-for-dist-linux-3" depends="init">
1330 <antcall target="compile"/>
1331 </target>
1332
1333 <!-- need to compile linux and windows and mac bits, and copy to linux side
1334 then this target should rearrange the files for the installer-->
1335 <target name="prepare-for-dist-linux-4" depends="init">
1336 <antcall target="clean-packages-c++"/>
1337 <antcall target="distclean-packages-c++"/>
1338 <antcall target="clean-gs2build"/>
1339 <antcall target="distclean-gs2build"/>
1340 <antcall target="install-macos-extra"/>
1341 <xslt in="build.xml" out="dist-build.xml" style="dist-resources/convert-build-xml.xsl"/>
1342 <delete dir="${basedir}/build"/>
1343 <delete dir="${basedir}/dist-resources"/>
1344
1345 <!-- copy all the binaries into Linux dir-->
1346 <copy todir="Linux">
1347 <fileset dir="${basedir}">
1348 <include name="*.sh"/>
1349 </fileset>
1350 </copy>
1351 <move todir="Darwin">
1352 <fileset dir="${basedir}">
1353 <include name="*.sh"/>
1354 </fileset>
1355 </move>
1356 <move todir="Windows">
1357 <fileset dir="${basedir}">
1358 <include name="*.bat"/>
1359 </fileset>
1360 </move>
1361 <move todir="Linux/bin">
1362 <fileset dir="bin">
1363 <exclude name="script/**"/>
1364 </fileset>
1365 </move>
1366 <move todir="Linux/lib/jni">
1367 <fileset dir="lib/jni"/>
1368 </move>
1369 <!-- gs2build bits -->
1370 <!-- Unix binaries -->
1371 <mkdir dir="${gs2build.home}/Unix"/>
1372 <move todir="${gs2build.home}/Unix/bin/linux">
1373 <fileset dir="${gs2build.home}/bin/linux"/>
1374 </move>
1375 <move todir="${gs2build.home}/Unix/bin/darwin">
1376 <fileset dir="${gs2build.home}/bin/darwin"/>
1377 </move>
1378 <!-- windows binaries -->
1379 <mkdir dir="${gs2build.home}/Windows"/>
1380 <move todir="${gs2build.home}/Windows/bin/windows">
1381 <fileset dir="${gs2build.home}/bin/windows"/>
1382 </move>
1383 <!-- the source files - only install these if source is selected -->
1384 <mkdir dir="${gs2build.home}/source"/>
1385
1386 <!-- windows specific source-->
1387 <mkdir dir="${gs2build.home}/source/Windows"/>
1388 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1389 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/source/Windows/win32.mak"/>
1390 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/source/Windows/setup.bat"/>
1391 <move file="${gs2build.home}/WIN32cfg.h" tofile="${gs2build.home}/source/Windows/WIN32cfg.h"/>
1392
1393 <!-- unix specific source -->
1394 <mkdir dir="${gs2build.home}/source/Unix"/>
1395 <move todir="${gs2build.home}/source/Unix/">
1396 <fileset dir="${gs2build.home}">
1397 <include name="config*"/>
1398 <include name="ac*"/>
1399 <include name="install-sh"/>
1400 <include name="setup.bash"/>
1401 <include name="Makefile.in"/>
1402 </fileset>
1403 </move>
1404 <!-- general source files -->
1405 <move todir="${gs2build.home}/source/src" failonerror="false">
1406 <fileset dir="${gs2build.home}/src"/>
1407 </move>
1408 <move todir="${gs2build.home}/source/lib" failonerror="false">
1409 <fileset dir="${gs2build.home}/lib"/>
1410 </move>
1411 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/source/lib/win32.mak"/>
1412 <move todir="${gs2build.home}/source/packages" failonerror="false">
1413 <fileset dir="${gs2build.home}/packages"/>
1414 </move>
1415
1416 <!-- clean up -->
1417 <delete dir="${gs2build-extra.home}"/>
1418
1419 </target>
1420
1421 <target name="get-perl-for-windows" if="current.os.iswindows">
1422 <get src="http://www.greenstone.org/gs3files/perl-for-windows.zip"
1423 dest="${gs2build.home}/bin/windows/perl-for-windows.zip"
1424 usetimestamp="true"/>
1425 <unzip src="${gs2build.home}/bin/windows/perl-for-windows.zip"
1426 dest="${gs2build.home}/bin/windows"/>
1427 <delete file="${gs2build.home}/bin/windows/perl-for-windows.zip"/>
1428 </target>
1429
1430 <target name="delete-windows-files" depends="init" unless="current.os.iswindows">
1431 <delete dir="${basedir}/winutil"/>
1432 <delete>
1433 <fileset dir="${lib.jni}" includes="*.dll"/>
1434 </delete>
1435 </target>
1436
1437 <target name="install-for-dist" depends="accept-properties,init,configure,configure-tomcat">
1438 <condition property="need.xml.jars">
1439 <equals arg1="1.5" arg2="${ant.java.version}"/>
1440 </condition>
1441 <antcall target="rename-xml-jars"/>
1442 <antcall target="rename-gs2build-files-windows"/>
1443 <antcall target="deploy-localsite"/>
1444 </target>
1445
1446 <target name="prepare-for-source-dist" depends="init">
1447 <cvs command="export -D '1 second ago'" package="mgpp"
1448 dest="${src.packages.home}"
1449 cvsRoot="${cvs.root}" />
1450 <cvs command="export -D '1 second ago'" package="gs2build"
1451 cvsRoot="${cvs.root}" />
1452 <cvs command="export -D '1 second ago'" package="gli"
1453 cvsRoot="${cvs.root}" />
1454 <delete file="${gli.home}/gli.bat"/>
1455 <delete file="${gli.home}/gli.sh"/>
1456 <antcall target="rename-gs2build-files-unix"/>
1457 <antcall target="prepare-collections"/>
1458 <antcall target="prepare-axis"/>
1459 <delete file="${packages.home}/axis-bin-1_2_1.zip"/>
1460 <!-- delete old axis dir -->
1461 <delete dir="${packages.home}/axis"/>
1462 <!-- download the mac XML parser just in case: it will only be unpacked if on a mac -->
1463 <get src="http://www.greenstone.org/gs3files/XML-Parser.tar.gz"
1464 dest="${gs2build.home}/perllib/cpan/XML-Parser.tar.gz"
1465 usetimestamp="true"/>
1466 <xslt in="build.xml" out="dist-build.xml" style="dist-resources/convert-build-xml-source.xsl"/>
1467 <delete dir="${basedir}/dist-resources"/>
1468
1469 </target>
1470
1471 <target name="prepare-for-source" depends="init,unzip-windows-packages,rename-gs2build-files-windows,prepare-tomcat,prepare-web"/>
1472</project>
1473
1474
Note: See TracBrowser for help on using the repository browser.