source: trunk/gsdl3/build.xml@ 10201

Last change on this file since 10201 was 10197, checked in by kjdon, 19 years ago

a bit of mac stuff for mysql

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