source: trunk/gsdl3/build.xml@ 10087

Last change on this file since 10087 was 10082, checked in by kjdon, 19 years ago

configure mg/mgpp so that libdir is the new jni lib dir

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