source: trunk/gsdl3/build.xml@ 10306

Last change on this file since 10306 was 10301, checked in by kjdon, 19 years ago

changed the configure stuff for web - only need to update global.properties.

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