source: trunk/gsdl3/build.xml@ 10699

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

some fixes for Mac OS X

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