source: trunk/gsdl3/build.xml@ 10656

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

gsdl3home in global.properties should be a unix style path - use pathconvert

  • Property svn:keywords set to Author Date Id Revision
File size: 56.3 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.port=${mysql.port}
284If these are not acceptable, please change them and rerun this target. Continue [y/n]?" />
285 </input>
286 <condition property="do.abort">
287 <equals arg1="n" arg2="${properties.ok}"/>
288 </condition>
289 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
290 </target>
291
292 <target name="check-cvsroot">
293 <condition property="cvsroot.notset">
294 <or>
295 <not>
296 <isset property="env.CVSROOT"/>
297 </not>
298 <equals arg1="" arg2="${env.CVSROOT}"/>
299 </or>
300 </condition>
301 <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/>
302 </target>
303
304 <!-- this sets up some initial properties -->
305 <target name="init">
306
307 <condition property="java.too.old">
308 <or>
309 <equals arg1="1.1" arg2="${ant.java.version}"/>
310 <equals arg1="1.2" arg2="${ant.java.version}"/>
311 <equals arg1="1.3" arg2="${ant.java.version}"/>
312 </or>
313 </condition>
314 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
315
316 <available file="${basedir}/packages/mgpp/text" property="mgpp.present"/>
317 <available file="${basedir}/packages/mysql/bin" property="mysql.present"/>
318 <available file="${basedir}/gli" property="gli.present"/>
319 <available file="${basedir}/gs2build" property="gs2build.present"/>
320 <available file="${basedir}/comms/soap/axis" property="axis.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="mysql.islocal">
330 <or>
331 <not>
332 <isset property="mysql.installed.path"/>
333 </not>
334 <equals arg1="" arg2="${mysql.installed.path}"/>
335 </or>
336 </condition>
337 <condition property="tomcat.islocal">
338 <or>
339 <not>
340 <isset property="tomcat.installed.path"/>
341 </not>
342 <equals arg1="" arg2="${tomcat.installed.path}"/>
343 </or>
344 </condition>
345
346 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gsdlislocal=${gsdl2.islocal} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo>
347 <condition property="proxy.present">
348 <and>
349 <isset property="proxy.host"/>
350 <not>
351 <equals arg1="" arg2="${proxy.host}"/>
352 </not>
353 </and>
354 </condition>
355 </target>
356
357 <target name="setup-proxy" depends="init" if="proxy.present">
358 <condition property="ask.user">
359 <or>
360 <equals arg1="" arg2="${proxy.user}"/>
361 <equals arg1="" arg2="${proxy.password}"/>
362 </or>
363 </condition>
364 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
365 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
366 </target>
367
368 <target name="setup-mysql-root-password" depends="init,init-mysql-vars" if="mysql.islocal">
369 <condition property="ask.root.password">
370 <or>
371 <not>
372 <isset property="mysql.root.password"/>
373 </not>
374 <equals arg1="" arg2="${mysql.root.password}"/>
375 </or>
376 </condition>
377 <getuserandpassword message="Please specify a password for the root mysql user: this is to secure your database." if="ask.root.password" username="root" pwordproperty="mysql.root.password"/>
378 </target>
379 <target name="setup-mysql-gsdl3-passwords" depends="init">
380 <condition property="ask.admin.password">
381 <or>
382 <not>
383 <isset property="mysql.admin.password"/>
384 </not>
385 <equals arg1="" arg2="${mysql.admin.password}"/>
386 </or>
387 </condition>
388 <condition property="ask.reader.password">
389 <or>
390 <not>
391 <isset property="mysql.reader.password"/>
392 </not>
393 <equals arg1="" arg2="${mysql.reader.password}"/>
394 </or>
395 </condition>
396 <getuserandpassword message="Please specify a password for the gsdl3admin mysql user: this is used by greenstone" if="ask.admin.password" username="gsdl3admin" pwordproperty="mysql.admin.password"/>
397 <getuserandpassword message="Please specify a password for the gsdl3reader mysql user: this is used by greenstone" if="ask.reader.password" username="gsdl3reader" pwordproperty="mysql.reader.password"/>
398 </target>
399
400 <!-- ========== Web app Targets ================================ -->
401
402 <target name="prepare-web">
403 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
404 <!-- gs3mgdemo -->
405 <unzip src="${collect.dir}/gs3mgdemo/import.zip"
406 dest="${collect.dir}/gs3mgdemo"/>
407 <unzip src="${collect.dir}/gs3mgdemo/archives.zip"
408 dest="${collect.dir}/gs3mgdemo"/>
409 <unzip src="${collect.dir}/gs3mgdemo/index/index.zip"
410 dest="${collect.dir}/gs3mgdemo/index"/>
411 <!-- gs2mgdemo -->
412 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
413 dest="${collect.dir}/gs2mgdemo"/>
414 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
415 dest="${collect.dir}/gs2mgdemo"/>
416 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
417 dest="${collect.dir}/gs2mgdemo/index"/>
418 <!-- gs2mgppdemo -->
419 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
420 dest="${collect.dir}/gs2mgppdemo"/>
421 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
422 dest="${collect.dir}/gs2mgppdemo"/>
423 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
424 dest="${collect.dir}/gs2mgppdemo/index"/>
425 <!-- gberg -->
426 <unzip src="${collect.dir}/gberg/index/index.zip"
427 dest="${collect.dir}/gberg/index"/>
428 <mkdir dir="${web.home}/applet"/>
429
430 <condition property="need.xml.jars">
431 <equals arg1="1.5" arg2="${ant.java.version}"/>
432 </condition>
433 <antcall target="rename-xml-jars"/>
434 </target>
435
436 <target name="rename-xml-jars" if="need.xml.jars">
437 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
438 <copy file="${web.lib}/xercesImpl.jar.tmp" tofile="${web.lib}/xercesImpl.jar"/>
439 </target>
440
441 <target name="configure-web" depends="init,setup-mysql-gsdl3-passwords"
442 description="Configure only the web app config files">
443 <!-- we want a unix path in the global.properties file -->
444 <pathconvert targetos="unix" property="gsdl3.home.unix">
445 <path path="${web.home}"/>
446 </pathconvert>
447 <filter token="gsdl3home" value="${gsdl3.home.unix}"/>
448 <filter token="mysql.port" value="${mysql.port}"/>
449 <filter token="mysql.server" value="${mysql.server}"/>
450 <filter token="mysql.admin.pword" value="${mysql.admin.password}"/>
451 <filter token="mysql.reader.pword" value="${mysql.reader.password}"/>
452 <filter token="tomcat.server" value="${tomcat.server}"/>
453 <filter token="tomcat.port" value="${tomcat.port}"/>
454 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
455 <chmod file="${web.classes}/global.properties" perm="600"/>
456 </target>
457
458 <target name="compile-web" depends="init">
459 <javac srcdir="${web.classes}"
460 destdir="${web.classes}"
461 debug="${compile.debug}"
462 deprecation="${compile.deprecation}"
463 optimize="${compile.optimize}">
464 <classpath>
465 <path refid="compile.classpath"/>
466 </classpath>
467 </javac>
468 </target>
469
470 <target name="cvsupdate-web" unless="nocvs.mode">
471 <cvs command="update -dP" dest="${web.home}"/>
472 </target>
473
474 <target name="update-web" depends="init,cvsupdate-web,configure-web"
475 description="update only the web stuff (config files)"/>
476
477
478<!-- ======================= Tomcat Targets ========================== -->
479
480 <!-- this target sets up tomcat for the first time, or resets it any subsequent times -->
481 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
482 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7.zip"
483 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
484 usetimestamp="true"/>
485 <delete dir="${basedir}/comms/jakarta/tomcat.bak"/>
486 <move todir="${basedir}/comms/jakarta/tomcat.bak" failonerror="false">
487 <fileset dir="${basedir}/comms/jakarta/tomcat"/>
488 </move>
489 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
490 dest="${basedir}/comms/jakarta"/>
491 <condition property="need.tomcat.compat">
492 <equals arg1="1.4" arg2="${ant.java.version}"/>
493 </condition>
494 <antcall target="prepare-tomcat-compat"/>
495 <move todir="${basedir}/comms/jakarta/tomcat">
496 <fileset dir="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7"/>
497 </move>
498 <copy file="${basedir}/comms/jakarta/setclasspath.bat"
499 tofile="${basedir}/comms/jakarta/tomcat/bin/setclasspath.bat"
500 overwrite="true"/>
501 <copy file="${basedir}/comms/jakarta/setclasspath.sh"
502 tofile="${basedir}/comms/jakarta/tomcat/bin/setclasspath.sh"
503 overwrite="true"/>
504 <!-- make sure we have execute permission for the .sh files -->
505 <chmod dir="${basedir}/comms/jakarta/tomcat/bin" perm="ugo+rx"
506 includes="*.sh"/>
507 </target>
508
509
510 <target name="prepare-tomcat-compat" if="need.tomcat.compat">
511 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7-compat.zip"
512 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
513 usetimestamp="true"/>
514 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
515 dest="${basedir}/comms/jakarta"/>
516 <copy file="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7/common/endorsed/xml-apis.jar"
517 tofile="${web.applet}/xml-apis.jar"/>
518 <copy file="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7/common/endorsed/xercesImpl.jar"
519 tofile="${web.applet}/xercesImpl.jar"/>
520 </target>
521
522 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
523
524 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
525 <!-- re-setup the server.xml file -->
526 <copy file="${basedir}/comms/jakarta/server.xml.in" tofile="${basedir}/comms/jakarta/tomcat/conf/server.xml" overwrite="true">
527 <filterset>
528 <filter token="port" value="${tomcat.port}"/>
529 <filter token="gsdl3home" value="${basedir}"/>
530 </filterset>
531 </copy>
532 </target>
533
534 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
535 <!-- re-setup the server.xml file -->
536 <!-- need to edit the config file, or do we get the user to do this???-->
537 </target>
538
539 <target name="reload" description="Reload web application"
540 depends="init,setup-catalina-ant-tasks">
541 <reload url="http://kanuka:7070/manager" username="admin" password="admin"
542 path="/gsdl3"/>
543 </target>
544
545 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
546 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
547 <property name="tomcat.path" refid="local.tomcat.path"/>
548 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
549 <exec executable="${catalina.home}/bin/startup.sh" os="${os.linux},${os.mac}" dir="${catalina.home}/bin" spawn="false">
550 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
551 <env key="GSDL3HOME" value="${basedir}"/>
552 <env key="PATH" path="${tomcat.path}"/>
553 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
554 <env key="CATALINA_HOME" value="${catalina.home}"/>
555 <env key="CLASSPATH" path="${tomcat.classpath}"/>
556 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
557 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}"/>
558<!-- <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}:${mysql.home}/lib/mysql"/>
559
560 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${mysql.home}/lib/mysql"/>--> <!-- for mac-->
561 </exec>
562 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
563 <env key="GSDLOS" value="windows"/>
564 <env key="GSDL3HOME" value="${basedir}"/>
565 <env key="Path" path="${tomcat.path}"/>
566 <env key="PATH" path="${tomcat.path}"/>
567 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
568 <env key="CLASSPATH" path="${tomcat.classpath}"/>
569 </exec>
570 <!-- wait for the server to startup in case other targets need it running -->
571 <waitfor maxwait="5" maxwaitunit="second">
572 <and>
573 <socket server="${tomcat.server}" port="${tomcat.port}"/>
574 <http url="http://${tomcat.server}:${tomcat.port}/gsdl3/index.html"/>
575 </and>
576 </waitfor>
577 </target>
578 <!-- windows: do we want to launch a webrowser?? -->
579 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
580 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.linux},${os.mac}" dir="${catalina.home}/bin" spawn="false">
581 <env key="CATALINA_HOME" value="${catalina.home}"/>
582 </exec>
583 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/>
584 </target>
585
586 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
587
588 <target name="setup-catalina-ant-tasks">
589 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
590 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
591 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
592 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
593 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
594 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
595 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
596 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
597 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
598 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
599 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
600 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
601 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
602 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
603 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
604 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
605 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
606 </target>
607
608
609<!-- ======================= Mysql Targets =========================== -->
610
611 <!-- this is one target that we only want to run once. -->
612 <target name="prepare-mysql" depends="init,init-mysql-vars,install-mysql,start-mysql-for-setup,setup-mysql,stop-mysql"/>
613
614 <target name="init-mysql-vars">
615 <condition property="mysql.islocal.linux">
616 <and>
617 <isset property="mysql.islocal"/>
618 <isset property="current.os.isunixnotmac"/>
619 </and>
620 </condition>
621 <condition property="mysql.islocal.mac">
622 <and>
623 <isset property="mysql.islocal"/>
624 <isset property="current.os.ismac"/>
625 </and>
626 </condition>
627 <condition property="mysql.islocal.windows">
628 <and>
629 <isset property="mysql.islocal"/>
630 <isset property="current.os.iswindows"/>
631 </and>
632 </condition>
633 </target>
634
635 <target name="install-mysql" depends="init,init-mysql-vars,install-mysql-linux,install-mysql-windows,install-mysql-mac"/>
636
637 <!-- install and set up the database -->
638 <target name="install-mysql-linux" depends="init,init-mysql-vars" if="mysql.islocal.linux" unless="mysql.present">
639 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
640 dest="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
641 usetimestamp="true"/>
642 <untar src="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
643 dest="${packages.home}"
644 compression="gzip"/>
645 <move todir="${packages.home}/mysql">
646 <fileset dir="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686"/>
647 </move>
648 <!-- file permissions are screwed up, so make executables executable -->
649 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
650 <chmod perm="a+x">
651 <fileset dir="${mysql.home}/bin" />
652 </chmod>
653 <mkdir dir="${mysql.home}/var/"/>
654 <mkdir dir="${mysql.home}/var/log/"/>
655 <chmod file="${mysql.home}/var/" perm="777"/>
656 <chmod file="${mysql.home}/var/log/" perm="777"/>
657
658 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
659 <arg value="--datadir=./data"/>
660 <arg value="--basedir=."/>
661 <arg value="--user=root"/>
662 <arg value="--force"/>
663 </exec>
664 </target>
665
666
667 <!-- install and set up the database -->
668 <target name="install-mysql-mac" depends="init,init-mysql-vars" if="mysql.islocal.mac" unless="mysql.present">
669 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
670 dest="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
671 usetimestamp="true"/>
672 <untar src="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
673 dest="${packages.home}"
674 compression="gzip"/>
675 <move todir="${packages.home}/mysql">
676 <fileset dir="${packages.home}/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc"/>
677 </move>
678 <!-- file permissions are screwed up, so make executables executable -->
679 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
680 <chmod perm="a+x">
681 <fileset dir="${mysql.home}/bin" />
682 </chmod>
683 <mkdir dir="${mysql.home}/var/"/>
684 <mkdir dir="${mysql.home}/var/log/"/>
685 <chmod file="${mysql.home}/var/" perm="777" type="dir"/>
686 <chmod file="${mysql.home}/var/log/" perm="777" type="dir"/>
687 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
688 <arg value="--datadir=./data"/>
689 <arg value="--basedir=."/>
690 <!--<arg value="- -user=root"/>
691 <arg value="- -force"/>-->
692 </exec>
693 </target>
694
695 <target name="install-mysql-windows" depends="init,init-mysql-vars" if="mysql.islocal.windows" unless="mysql.present">
696 <get src="http://www.greenstone.org/gs3files/mysql-noinstall-4.1.11-win32.zip"
697 dest="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
698 usetimestamp="true"/>
699 <!-- can we run the installer?? -->
700 <unzip src="${packages.home}/mysql-noinstall-4.1.11-win32.zip"
701 dest="${packages.home}"/>
702 <move todir="${packages.home}/mysql">
703 <fileset dir="${packages.home}/mysql-4.1.11-win32"/>
704 </move>
705 </target>
706
707 <!-- is this just linux or both??. also we probably need to do this for external mysql -->
708 <!-- had unless mysql.present -->
709 <target name="setup-mysql" depends="init,init-mysql-vars,setup-mysql-root-password,setup-mysql-gsdl3-passwords" if="mysql.islocal">
710 <!-- setup the gsdl3 mysql users -->
711 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
712 <arg value="--user=root"/>
713 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost identified by '${mysql.admin.password}';"/>
714 </exec>
715 <!--<exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
716 <arg value="- -user=root"/>
717 <arg value="- -execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@'%';"/>
718 </exec>-->
719 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
720 <arg value="--user=root"/>
721 <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost identified by '${mysql.reader.password}';"/>
722 </exec>
723 <!-- load in the demo collection database -->
724 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
725 <arg value="--user=root"/>
726 <arg value="--execute=create database localsite_gs3mgdemo;"/>
727 </exec>
728 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
729 input="${web.home}/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql">
730 <arg value="--user=root"/>
731 <arg value="localsite_gs3mgdemo"/>
732 </exec>
733 <!-- remove the anonymous user -->
734 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
735 <arg value="--user=root"/>
736 <arg value="--execute=delete from mysql.user where Host='localhost' and User='';"/>
737 </exec>
738 <!-- finally, set the root password -->
739 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
740 <arg value="--user=root"/>
741 <arg value="--execute=set password for 'root'@'localhost' = PASSWORD('${mysql.root.password}'); flush privileges; "/>
742 </exec>
743 </target>
744
745<!-- this one used initially for setup -->
746 <target name="start-mysql-for-setup" depends="init,init-mysql-vars" if="mysql.islocal">
747 <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}"
748 spawn="true" os="${os.linux},${os.mac}">
749 <arg value="--datadir=./data"/>
750 <arg value="--basedir=."/>
751 <arg value="--pid_file=gsdl3.pid"/>
752 <arg value="--socket=/tmp/mysql.sock"/>
753 <arg value="--port=${mysql.port}"/>
754 <arg value="--err-log=./var/log/mysql.log"/>
755 </exec>
756 <exec executable="${mysql.home}/bin/mysqld" dir="${mysql.home}" spawn="true" os="${os.windows}">
757 </exec>
758 <sleep seconds="2"/>
759 <!-- need to test that the server has started up -->
760 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
761 failonerror="true" outputproperty="throw.away">
762 <arg value="--user=root"/>
763 <arg value="--execute=show databases;"/>
764 </exec>
765 </target>
766
767 <target name="start-mysql" depends="init,init-mysql-vars" if="mysql.islocal"
768 description="Startup only mysql">
769 <echo>Starting up the mysql server</echo>
770 <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}"
771 spawn="true" os="${os.linux},${os.mac}">
772 <arg value="--datadir=./data"/>
773 <arg value="--basedir=."/>
774 <arg value="--pid_file=gsdl3.pid"/>
775 <arg value="--socket=/tmp/mysql.sock"/>
776 <arg value="--port=${mysql.port}"/>
777 <arg value="--err-log=./var/log/mysql.log"/>
778 </exec>
779 <exec executable="${mysql.home}/bin/mysqld" dir="${mysql.home}" spawn="true" os="${os.windows}">
780 <arg value="--port=${mysql.port}"/>
781 </exec>
782 <sleep seconds="2"/>
783 </target>
784
785 <target name="stop-mysql" depends="init,setup-mysql-root-password" if="mysql.islocal"
786 description="Shutdown only mysql">
787 <echo>Shutting down the mysql server. At the password prompt (linux only), enter the mysql root password.</echo>
788 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
789 failonerror="true" os="${os.linux},{os.mac}">
790 <arg value="--user=root"/>
791 <arg value="-p"/>
792 <arg value="--socket=/tmp/mysql.sock"/>
793 <arg value="shutdown"/>
794 </exec>
795 <!-- on windows it doesn't work unless the password is specified here -->
796 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
797 failonerror="true" os="${os.windows}">
798 <arg value="--user=root"/>
799 <arg value="-p${mysql.root.password}"/>
800 <arg value="shutdown"/>
801 </exec>
802 <echo>MYSQL database server shutdown successfully</echo>
803 </target>
804
805 <target name="restart-mysql" description="Shutdown and restart only mysql" depends="init,stop-mysql,start-mysql"/>
806
807
808<!-- ======================= Axis Targets ============================ -->
809
810 <target name="prepare-axis" depends="init">
811 <mkdir dir="${basedir}/comms/soap"/>
812 <get src="http://www.greenstone.org/gs3files/axis-bin-1_2_1.zip"
813 dest="${basedir}/comms/soap/axis-bin-1_2_1.zip"
814 usetimestamp="true"/>
815 <delete dir="${basedir}/comms/soap/axis.bak"/>
816 <move todir="${basedir}/comms/soap/axis.bak" failonerror="false">
817 <fileset dir="${basedir}/comms/soap/axis"/>
818 </move>
819 <unzip src="${basedir}/comms/soap/axis-bin-1_2_1.zip"
820 dest="${basedir}/comms/soap/"/>
821 <move todir="${basedir}/comms/soap/axis">
822 <fileset dir="${basedir}/comms/soap/axis-1_2_1"/>
823 </move>
824 <!-- install axis into greenstone web app -->
825 <copy todir="${web.lib}">
826 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/WEB-INF/lib">
827 <include name="*.jar"/>
828 </fileset>
829 </copy>
830 <copy todir="${web.home}">
831 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/">
832 <include name="*.jsp"/>
833 <include name="*.jws"/>
834 </fileset>
835 </copy>
836 <copy tofile="${web.home}/axis.html" file="${basedir}/comms/soap/axis/webapps/axis/index.html"/>
837 <copy todir="${web.classes}">
838 <fileset dir="${basedir}/comms/soap/axis/webapps/axis/WEB-INF/classes">
839 <include name="*.properties"/>
840 </fileset>
841 </copy>
842 </target>
843
844 <target name="soap-deploy-site" depends="get-sitename,get-siteuri,create-deployment-files"
845 description="Deploy a SOAP web service for a local Greenstone site">
846 <java classname="org.apache.axis.client.AdminClient">
847 <classpath refid="compile.classpath"/>
848 <arg value="-l"/>
849 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
850 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
851 </java>
852 </target>
853
854 <target name="soap-undeploy-site" depends="get-sitename"
855 description="Undeploy a SOAP web service for a local Greenstone site">
856 <java classname="org.apache.axis.client.AdminClient">
857 <classpath refid="compile.classpath"/>
858 <arg value="-l"/>
859 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
860 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
861 </java>
862 </target>
863
864 <!-- this target used to deploy the localsite server for the default installation -->
865 <target name="deploy-localsite" depends="init">
866 <antcall target="start-tomcat"/>
867 <antcall target="soap-deploy-site">
868 <param name="axis.sitename" value="localsite"/>
869 <param name="axis.siteuri" value="localsite"/>
870 </antcall>
871 <antcall target="stop-tomcat"/>
872 </target>
873
874 <target name="get-sitename" unless="axis.sitename">
875 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
876 </target>
877
878 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri">
879 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/>
880 <echo>${axis.sitename}, ${axis.siteuri}</echo>
881 </target>
882 <target name="check-deployment-files" depends="get-sitename">
883 <condition property="deploy.exists">
884 <and>
885 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
886 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
887 <available file="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class"/>
888 </and>
889 </condition>
890 </target>
891
892 <target name="create-deployment-files" depends="get-sitename,get-siteuri,check-deployment-files"
893 if="axis.sitename" unless="deploy.exists">
894 <filter token="sitename" value="${axis.sitename}"/>
895 <filter token="siteuri" value="${axis.siteuri}"/>
896 <copy file="${basedir}/resources/soap/site.wsdd.template"
897 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
898 filtering="true"/>
899 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
900 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
901 filtering="true"/>
902 <!-- create the java files and compile them -->
903 <copy file="${gsdl3.home}/SOAPServer.java.in"
904 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
905 filtering="true"/>
906 <javac srcdir="${src.home}"
907 destdir="${build.home}"
908 debug="${compile.debug}"
909 deprecation="${compile.deprecation}"
910 optimize="${compile.optimize}">
911 <classpath refid="compile.classpath"/>
912 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
913 </javac>
914 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
915 <copy file="${build.home}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" tofile="${web.classes}/org/greenstone/gsdl3/SOAPServer${axis.sitename}.class" />
916 </target>
917
918
919<!-- ====================== Core targets ============================== -->
920<!-- core targets refer to the core gsdl3 java src -->
921
922 <target name="prepare-core" unless="nocvs.mode">
923 <!-- just get rid of empty directories-->
924 <cvs command="update -P"/>
925 </target>
926
927 <target name="configure-core"/>
928
929 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
930 description="Update only the Greenstone core" />
931
932 <target name="cvsupdate-core" unless="nocvs.mode">
933 <cvs command="update -l"/>
934 <cvs command="update -dP bin comms dist-resources docs lib resources src winutil"/>
935 </target>
936
937 <target name="clean-core"
938 description="Clean only the Greenstone core">
939 <delete dir="${build.home}"/>
940 </target>
941
942 <target name="compile-core"
943 description="Compile only the Greenstone core">
944 <mkdir dir="${build.home}"/>
945 <javac srcdir="${src.home}"
946 destdir="${build.home}"
947 debug="${compile.debug}"
948 deprecation="${compile.deprecation}"
949 optimize="${compile.optimize}">
950 <classpath>
951 <path refid="compile.classpath"/>
952 </classpath>
953 </javac>
954 <jar destfile="${build.home}/gsdl3.jar">
955 <fileset dir="${build.home}">
956 <include name="org/greenstone/gsdl3/**"/>
957 <exclude name="**/Test.class"/>
958 </fileset>
959 <manifest>
960 <attribute name="Built-By" value="${user.name}" />
961 </manifest>
962 </jar>
963 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
964 <jar destfile="${build.home}/phind.jar">
965 <fileset dir="${build.home}">
966 <include name="org/greenstone/applet/phind/**"/>
967 </fileset>
968 <manifest>
969 <attribute name="Built-By" value="${user.name}" />
970 </manifest>
971 </jar>
972 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
973 <jar destfile="${build.home}/anttasks.jar">
974 <fileset dir="${build.home}">
975 <include name="org/greenstone/anttasks/**"/>
976 </fileset>
977 <manifest>
978 <attribute name="Built-By" value="${user.name}" />
979 </manifest>
980 </jar>
981 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>
982 <jar destfile="${build.home}/gsdl3test.jar">
983 <fileset dir="${build.home}">
984 <include name="org/greenstone/gsdl3/**/*Test.class"/>
985 <include name="org/greenstone/testing/**"/>
986 </fileset>
987 <manifest>
988 <attribute name="Built-By" value="${user.name}" />
989 </manifest>
990 </jar>
991 </target>
992
993<!-- ================== Packages targets ================================ -->
994 <!-- these targets refer to the greenstone packages - these need updating
995 less often, so are in separate targets to the core -->
996 <target name="prepare-packages" depends="init,prepare-mgpp,prepare-windows"/>
997
998 <target name="prepare-windows" depends="init" if="current.os.iswindows">
999 <!-- need to download precompiled binaries for mg and mgpp -->
1000 </target>
1001
1002 <target name="checkout-mgpp" depends="check-cvsroot,init" unless="nocvs.mode">
1003 <cvs command="checkout -P" package="mgpp" dest="${basedir}/packages/"/>
1004 </target>
1005
1006 <target name="prepare-mgpp" depends="init" unless="mgpp.present">
1007 <antcall target="checkout-mgpp"/>
1008 </target>
1009
1010 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
1011 description="Update only the packages"/>
1012
1013 <target name="cvsupdate-packages" unless="nocvs.mode">
1014 <cvs command="update -dP" dest="${packages.home}"/>
1015 </target>
1016
1017 <target name="configure-packages" description="Configure only the packages.">
1018 <echo>
1019 Configuring MG
1020 </echo>
1021 <exec executable="${mg.home}/configure" os="${os.linux},${os.mac}"
1022 dir="${mg.home}">
1023 <arg value="--prefix=${basedir}"/>
1024 <arg value="--libdir=${lib.jni}"/>
1025 </exec>
1026 <echo>
1027 Configuring MGPP
1028 </echo>
1029 <exec executable="${mgpp.home}/configure" os="${os.linux},${os.mac}"
1030 dir="${mgpp.home}">
1031 <arg value="--prefix=${basedir}"/>
1032 <arg value="--libdir=${lib.jni}"/>
1033 </exec>
1034 </target>
1035
1036 <target name="clean-packages"
1037 description="Clean only the packages">
1038 <!-- mg : just call the make target -->
1039 <exec executable="make" os="${os.linux},${os.mac}"
1040 dir="${mg.home}">
1041 <arg value="clean"/>
1042 </exec>
1043 <!-- mgpp -->
1044 <exec executable="make" os="${os.linux},${os.mac}"
1045 dir="${mg.home}">
1046 <arg value="clean"/>
1047 </exec>
1048 <!-- vishnu : just call the ant target -->
1049 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
1050 inheritall="false" target="clean">
1051 <property name="catalina.home" value="${catalina.home}"/>
1052 </ant>
1053 <!-- gsdl-as : just call the ant target-->
1054 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
1055 inheritall="false" target="clean">
1056 <property name="catalina.home" value="${catalina.home}"/>
1057 </ant>
1058 </target>
1059
1060 <target name="clean-windows-c++-packages" depends="init" if="current.os.iswindows"
1061 description="Clean only the C/C++ packages">
1062 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1063 <arg value="clean"/>
1064 </exec>
1065 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1066 <arg value="clean"/>
1067 </exec>
1068 </target>
1069
1070 <target name="compile-packages"
1071 description="Compile only the packages">
1072 <echo>Compiling MG</echo>
1073 <exec executable="make" os="${os.linux},${os.mac}"
1074 dir="${mg.home}">
1075 </exec>
1076 <exec executable="make" os="${os.linux},${os.mac}"
1077 dir="${mg.home}">
1078 <arg value="install"/>
1079 </exec>
1080 <!-- windows: just the java stuff. -->
1081 <exec executable="${mg.home}/winMake.bat" os="${os.windows}"
1082 dir="${mg.home}">
1083 <arg value="compile"/>
1084 <arg value="javaonly"/>
1085 </exec>
1086 <!-- install the jar file -->
1087 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1088
1089 <!-- mgpp -->
1090 <echo>Compiling MGPP</echo>
1091 <exec executable="make" os="${os.linux},${os.mac}"
1092 dir="${mgpp.home}">
1093 </exec>
1094 <exec executable="make" os="${os.linux},${os.mac}"
1095 dir="${mgpp.home}">
1096 <arg value="install"/>
1097 </exec>
1098 <!-- windows: just the java stuff. -->
1099 <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}"
1100 dir="${mgpp.home}">
1101 <arg value="compile"/>
1102 <arg value="javaonly"/>
1103 </exec>
1104 <!-- install the jar file -->
1105 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1106
1107 <!-- vishnu -->
1108 <echo>Compiling Vishnu</echo>
1109 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}"
1110 inheritall="false" target="compile">
1111 <property name="catalina.home" value="${catalina.home}"/>
1112 </ant>
1113
1114 <!-- gsdl-as -->
1115 <echo>Compiling GSDL-AS</echo>
1116 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
1117 inheritall="false" target="compile">
1118 <property name="catalina.home" value="${catalina.home}"/>
1119 </ant>
1120 </target>
1121
1122 <target name="compile-windows-c++-packages" depends="init" if="current.os.iswindows"
1123 description="Compile only the C/C++ packages">
1124 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}"/>
1125 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}">
1126 <arg value="install"/>
1127 <env key="GSDL3HOME" value="${basedir}"/>
1128 </exec>
1129 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}"/>
1130 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}">
1131 <arg value="install"/>
1132 <env key="GSDL3HOME" value="${basedir}"/>
1133 </exec>
1134 </target>
1135
1136 <!-- ================== gs2building targets ===============-->
1137
1138
1139 <target name="update-gs2building" if="gsdl2.islocal"
1140 depends="init,cvsupdate-gs2building,rename-gs2build-files,configure-gs2building,clean-gs2building,compile-gs2building"
1141 description="Update only the Greenstone 2 building components"/>
1142
1143 <target name="cvsupdate-gs2building" if="gsdl2.islocal" depends="init" unless="nocvs.mode">
1144 <cvs command="update -dP" dest="${gli.home}"/>
1145 <!-- Note: can't do a -d update here cos it will get all of gsdl
1146 also, an update doesn't get new files, so we do a checkout instead. -->
1147 <cvs command="co gs2build" dest="${basedir}"/>
1148 </target>
1149
1150 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal">
1151 </target>
1152
1153 <target name="checkout-gs2build" depends="check-cvsroot,init" unless="nocvs.mode">
1154 <echo>checking out gs2build</echo>
1155 <cvs command="checkout -P" package="gs2build"/>
1156 </target>
1157
1158 <target name="prepare-gs2build" depends="init" if="gsdl2.islocal" unless="gs2build.present">
1159 <antcall target="checkout-gs2build"/>
1160 <!-- rename the .gs2build files -->
1161 <antcall target="rename-gs2build-files"/>
1162 <antcall target="unzip-windows-packages"/>
1163 <antcall target="get-windows-binaries"/>
1164 </target>
1165
1166 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1167 unless="nocvs.mode">
1168 <cvs command="checkout -P" package="winbin"/>
1169 </target>
1170
1171 <target name="get-windows-binaries" depends="init,checkout-winbin" if="current.os.iswindows">
1172 <copy todir="${basedir}/bin">
1173 <fileset dir="${basedir}/winbin/bin" includes="mg*.exe"/>
1174 </copy>
1175 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1176 <fileset dir="${basedir}/winbin/bin"/>
1177 </move>
1178 <delete dir="${basedir}/winbin"/>
1179 </target>
1180
1181 <target name="unzip-windows-packages" depends="init">
1182 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip"
1183 dest="${gs2build.home}/packages/windows/gdbm"/>
1184 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip"
1185 dest="${gs2build.home}/packages/windows/crypt"/>
1186 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip"
1187 dest="${gs2build.home}/packages/windows/expat"/>
1188 </target>
1189
1190 <target name="rename-gs2build-files" depends="rename-gs2build-files-unix,rename-gs2build-files-windows"/>
1191
1192 <target name="rename-gs2build-files-windows" if="current.os.iswindows">
1193 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1194 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/>
1195 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/>
1196 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat">
1197 <filterset>
1198 <filter token="gsdlhome" value="${gs2build.home}"/>
1199 </filterset>
1200 </copy>
1201 </target>
1202 <target name="rename-gs2build-files-unix" if="current.os.isunix">
1203 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/>
1204 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/>
1205 <chmod file="${gs2build.home}/configure" perm="a+x"/>
1206 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/>
1207 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/>
1208 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/>
1209 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
1210 <copy file="${gs2build-extra.home}/packages.Makefile" tofile="${gs2build.home}/packages/Makefile"/>
1211 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/>
1212
1213 </target>
1214 <target name="prepare-gli" depends="init" if="gsdl2.islocal" unless="gli.present">
1215 <antcall target="checkout-gli"/>
1216 </target>
1217
1218 <target name="checkout-gli" depends="check-cvsroot,init" if="gsdl2.islocal" unless="nocvs.mode">
1219 <echo>checking out gli</echo>
1220 <cvs command="checkout -P" package="gli"/>
1221 </target>
1222
1223 <target name="configure-gs2building" depends="init" if="gsdl2.islocal"
1224 description="Configure only the Greenstone 2 building components">
1225 <exec executable="${gs2build.home}/configure" os="${os.linux},${os.mac}"
1226 dir="${gs2build.home}">
1227 <arg value="--prefix=${gs2build.home}"/>
1228 </exec>
1229 </target>
1230
1231 <target name="clean-gs2building" depends="init" if="gsdl2.islocal"
1232 description="Clean only the Greenstone 2 building components">
1233 <!-- gli -->
1234 <property name="gli.home" value="${basedir}/gli"/>
1235 <!-- linux -->
1236 <exec executable="clean.sh" os="${os.linux},${os.mac}" dir="${gli.home}"
1237 resolveExecutable="true"/>
1238 <!-- windows -->
1239 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1240 resolveExecutable="true"/>
1241 <!-- gs2build -->
1242 <!--linux: -->
1243 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
1244 <arg value="clean"/>
1245 </exec>
1246 <!-- windows: -->
1247 </target>
1248
1249 <target name="clean-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1250 description="remove all object files and executables">
1251 <!-- run the setup script -->
1252 <exec executable="${compile.windows.c++.setup}"/>
1253 <exec executable="nmake" dir="${gs2build.home}">
1254 <arg value="/f"/>
1255 <arg value="win32.mak"/>
1256 <arg value="clean"/>
1257 </exec>
1258 </target>
1259
1260 <target name="compile-gs2building" depends="init" if="gsdl2.islocal"
1261 description="Compile only the Greenstone 2 building components">
1262 <!-- gli -->
1263 <property name="gli.home" value="${basedir}/gli"/>
1264 <!-- linux -->
1265 <exec executable="makegli.sh" os="${os.linux},${os.mac}" dir="${gli.home}"
1266 resolveExecutable="true"/>
1267 <!-- windows -->
1268 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
1269 resolveExecutable="true"/>
1270 <!-- gs2build -->
1271 <!--linux: make, make install -->
1272 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
1273 </exec>
1274 <exec executable="make" os="${os.linux},${os.mac}" dir="${gs2build.home}">
1275 <arg value="install"/>
1276 </exec>
1277 </target>
1278 <!-- windows: -->
1279 <target name="compile-windows-c++-gs2building" depends="init" if="current.os.iswindows"
1280 description="Use this if you want to compile the C++ code for the gs2build package">
1281 <!-- run the setup script -->
1282 <exec executable="${compile.windows.c++.setup}"/>
1283 <exec executable="nmake" dir="${gs2build.home}">
1284 <arg value="/f"/>
1285 <arg value="win32.mak"/>
1286 </exec>
1287 </target>
1288 <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external">
1289 </target>
1290
1291 <target name="gli-local" depends="init" if="gsdl2.islocal">
1292 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux},${os.mac}" dir="${basedir}/gli" spawn="true">
1293 <env key="gsdl3path" path="${basedir}"/>
1294 <env key="gsdlpath" path="${basedir}/gs2build"/>
1295 </exec>
1296 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1297 <env key="GSDL3PATH" path="${basedir}"/>
1298 <env key="GSDLPATH" path="${basedir}/gs2build"/>
1299 </exec>
1300 <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.
1301 </echo>
1302 </target>
1303
1304 <target name="gli-external" depends="init" unless="gsdl2.islocal">
1305 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.sh" os="${os.linux},${os.mac}" dir="${gsdl2.installed.path}/gli" spawn="true">
1306 <env key="gsdl3path" path="${basedir}"/>
1307 <env key="gsdlpath" path="${gsdl2.installed.path}"/>
1308 </exec>
1309 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl2.installed.path}/gli" spawn="true">
1310 <env key="GSDL3PATH" path="${basedir}"/>
1311 <env key="GSDLPATH" path="${gsdl2.installed.path}"/>
1312 </exec>
1313 <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:
1314 (Linux/Mac OS X / Windows)
1315in gsdl3 directory: source gs3-setup.sh / gs3-setup
1316in gsdl directory: source setup.bash / setup
1317in gli directory: gli4gs3.sh / gli4gs3
1318 </echo>
1319 </target>
1320
1321
1322<!-- ======================== TESTING Targets ========================= -->
1323
1324 <target name="test" description="Run the (incomplete) JUnit test suite "
1325 depends="init">
1326 <mkdir dir="${basedir}/test"/>
1327 <junit printsummary="withOutAndErr"
1328 errorproperty="test.failed"
1329 failureproperty="test.failed"
1330 fork="${junit.fork}">
1331 <formatter type="plain"/>
1332 <classpath>
1333 <pathelement location="${build.home}/gsdl3test.jar"/>
1334 <path refid="compile.classpath"/>
1335 </classpath>
1336 <test name="${testcase}" if="testcase"/>
1337 <batchtest todir="${basedir}/test" unless="testcase">
1338 <fileset dir="${build.home}"
1339 includes="**/*Test.class"
1340 />
1341 </batchtest>
1342 </junit>
1343 <echo>
1344 *********************************************
1345 Test output can be found in directory 'test'
1346 *********************************************
1347 </echo>
1348 </target>
1349
1350
1351
1352
1353</project>
1354
1355
Note: See TracBrowser for help on using the repository browser.