source: branches/ant-install-branch/gsdl3/build.xml@ 9568

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

more stuff

  • Property svn:keywords set to Author Date Id Revision
File size: 35.8 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="javalib" value="${basedir}/lib/java"/>
54 <property name="web.home" value="${basedir}/web"/>
55 <property name="web.lib" value="${web.home}/lib"/>
56 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
57
58 <property name="javadocs" value="${basedir}/docs/javadoc"/>
59
60 <property name="app.name" value="gsdl3"/>
61 <property name="app.path" value="/${app.name}"/>
62 <property name="app.version" value="3.00alpha"/>
63 <property name="catalina.home" value="${basedir}/comms/jakarta/tomcat"/>
64
65 <property name="os.linux" value="Linux"/> <!-- mac??-->
66 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP, Windows NT,Windows ME"/> <!-- check this!!!-->
67
68 <condition property="current.os.islinux">
69 <os family="unix"/>
70 </condition>
71 <condition property="current.os.iswindows">
72 <os family="windows"/>
73 </condition>
74 <!-- ============= Base dirs for each package and component ============ -->
75 <property name="applet.home" value="${src.home}/org/greenstone/applet"/>
76 <property name="gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
77 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
78 <property name="gs2build.home" value="${basedir}/gs2build"/>
79 <property name="gli.home" value="${basedir}/gli"/>
80 <property name="vishnu.home" value="${packages.home}/vishnu"/>
81 <property name="mg.home" value="${packages.home}/mg"/>
82 <property name="mgpp.home" value="${packages.home}/mgpp"/>
83 <property name="mysql.home" value="${packages.home}/mysql"/>
84 <property name="gsdl-as.home" value="${packages.home}/gsdl-as"/>
85
86<!-- ==================== Compilation Control Options ==================== -->
87
88<!--
89
90 These properties control option settings on the Javac compiler when it
91 is invoked using the <javac> task.
92
93 compile.debug Should compilation include the debug option?
94
95 compile.deprecation Should compilation include the deprecation option?
96
97 compile.optimize Should compilation include the optimize option?
98
99-->
100
101 <property name="compile.debug" value="true"/>
102 <property name="compile.deprecation" value="true"/>
103 <property name="compile.optimize" value="true"/>
104
105<!--
106
107 Rather than relying on the CLASSPATH environment variable, Ant includes
108 features that makes it easy to dynamically construct the classpath you
109 need for each compilation. The example below constructs the compile
110 classpath to include the servlet.jar file, as well as the other components
111 that Tomcat makes available to web applications automatically, plus anything
112 that you explicitly added.
113
114-->
115
116 <path id="compile.classpath">
117 <!-- Include all jar files in our lib directory -->
118 <pathelement location="${javalib}"/>
119 <fileset dir="${javalib}">
120 <include name="*.jar"/>
121 </fileset>
122 <!-- Include the resources directory -->
123 <pathelement location="${basedir}/resources/java"/>
124 <pathelement location="${basedir}/resources/dtd"/>
125
126 <!-- Include the axis jar files -->
127 <fileset dir="${basedir}/comms/soap/axis/lib">
128 <include name="*.jar"/>
129 </fileset>
130
131 <!-- Include all elements that Tomcat exposes to applications -->
132 <pathelement location="${catalina.home}/common/classes"/>
133 <fileset dir="${catalina.home}/common/endorsed">
134 <include name="*.jar"/>
135 </fileset>
136 <fileset dir="${catalina.home}/common/lib">
137 <include name="*.jar"/>
138 </fileset>
139 <pathelement location="${catalina.home}/shared/classes"/>
140 <fileset dir="${catalina.home}/shared/lib">
141 <include name="*.jar"/>
142 </fileset>
143 </path>
144
145<!-- ==================== Primary Targets ============================= -->
146
147
148 <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
149
150 <target name="install" depends="accept-properties,init,prepare,cvsupdate,configure,clean,compile" 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.">
151 </target>
152
153 <target name="all" depends="init,compile"
154 description="Recompile the code?"/>
155
156 <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building"
157 description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
158
159 <target name="compile" depends="init,compile-extra,compile-packages,compile-core,compile-gs2building"
160 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
161
162 <target name="update" depends="init,update-packages,update-core,update-gs2building"
163 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."/>
164
165 <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building"
166 description="Do a cvs update for all sources. Doesn't reompile teh code."/>
167 <!-- this is config stuff, that can be done more than once - should be rerun is the build.properties file changes -->
168 <target name="configure" depends="init,configure-tomcat,configure-files,configure-packages,configure-core,configure-gs2building"
169 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."/>
170
171
172<!-- =========== Help targets =================================== -->
173
174 <target name="usage" description="Print a help message">
175 <echo message=" Execute 'ant -projecthelp' for build file help."/>
176 <echo message=" Execute 'ant -help' for Ant help."/>
177 <echo>put the primary targets in here</echo>
178 </target>
179
180 <target name="help" depends="usage" description="Print a help message"/>
181
182 <target name="debug" depends="init" description="Display all the currently used properties">
183 <echoproperties/>
184 </target>
185
186<!-- ====== initialization and setup targets ================== -->
187
188 <target name="accept-properties">
189 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
190tomcat.server=${tomcat.server}
191tomcat.port=${tomcat.port}
192gsdl.path=${gsdl.path} (this is the location of Greenstone 2 if you have it)
193proxy.host=${proxy.host}
194proxy.port=${proxy.port}
195If these are not acceptable, please change them and rerun this target. Continue [y/n]?" />
196 </input>
197 <condition property="do.abort">
198 <equals arg1="n" arg2="${properties.ok}"/>
199 </condition>
200 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
201 </target>
202
203 <!-- this sets up some initial properties -->
204 <target name="init">
205
206 <condition property="java.too.old">
207 <or>
208 <equals arg1="1.1" arg2="${ant.java.version}"/>
209 <equals arg1="1.2" arg2="${ant.java.version}"/>
210 <equals arg1="1.3" arg2="${ant.java.version}"/>
211 </or>
212 </condition>
213 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
214
215 <available file="${basedir}/packages/mgpp/text" property="mgpp.present"/>
216 <available file="${basedir}/comms/jakarta/tomcat" property="tomcat.present"/>
217 <available file="${basedir}/gli" property="gli.present"/>
218 <available file="${basedir}/gs2build" property="gs2build.present"/>
219 <available file="${basedir}/comms/soap/axis" property="axis.present"/>
220 <available file="${basedir}/comms/jakarta/tomcat/webapps/axis" property="axis.installed"/>
221 <condition property="gsdl2.islocal">
222 <or>
223 <not>
224 <isset property="gsdl.path"/>
225 </not>
226 <equals arg1="" arg2="${gsdl.path}"/>
227 </or>
228 </condition>
229
230 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gsdlislocal=${gsdl2.islocal} gs2build.present=${gs2build.present} gsdl.path = ${gsdl.path}</echo>
231 <condition property="proxy.present">
232 <not>
233 <equals arg1="" arg2="${proxy.host}"/>
234 </not>
235 </condition>
236 </target>
237
238 <target name="setup-proxy" depends="init" if="proxy.present">
239 <condition property="ask.user">
240 <or>
241 <equals arg1="" arg2="${proxy.user}"/>
242 <equals arg1="" arg2="${proxy.password}"/>
243 </or>
244 </condition>
245 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}"/>
246 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}"/>
247 </target>
248
249 <!-- this is all the do-once things -->
250 <target name="prepare" depends="init,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-mysql,prepare-collections">
251 </target>
252
253 <target name="prepare-collections">
254 <property name="collect.dir" value="${basedir}/web/sites/localsite/collect"/>
255 <!-- gs3mgdemo -->
256 <unzip src="${collect.dir}/gs3mgdemo/import.zip"
257 dest="${collect.dir}/gs3mgdemo"/>
258 <unzip src="${collect.dir}/gs3mgdemo/archives.zip"
259 dest="${collect.dir}/gs3mgdemo"/>
260 <unzip src="${collect.dir}/gs3mgdemo/index/index.zip"
261 dest="${collect.dir}/gs3mgdemo/index"/>
262 <!-- gs2mgdemo -->
263 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
264 dest="${collect.dir}/gs2mgdemo"/>
265 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
266 dest="${collect.dir}/gs2mgdemo"/>
267 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
268 dest="${collect.dir}/gs2mgdemo/index"/>
269 <!-- gs2mgppdemo -->
270 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
271 dest="${collect.dir}/gs2mgppdemo"/>
272 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
273 dest="${collect.dir}/gs2mgppdemo"/>
274 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
275 dest="${collect.dir}/gs2mgppdemo/index"/>
276 <!-- gberg -->
277 <unzip src="${collect.dir}/gberg/index/index.zip"
278 dest="${collect.dir}/gberg/index"/>
279 </target>
280
281
282 <target name="configure-files" depends="init">
283 <filter token="port" value="${tomcat.port}"/>
284 <filter token="hostname" value="${tomcat.server}"/>
285 <filter token="gsdl3home" value="${basedir}"/>
286 <copy file="${basedir}/web/WEB-INF/web.xml.in" tofile="${basedir}/web/WEB-INF/web.xml" filtering="true"/>
287 <copy file="${basedir}/web/sites/localsite/siteConfig.xml.in" tofile="${basedir}/web/sites/localsite/siteConfig.xml" filtering="true"/>
288 <copy file="${basedir}/web/sites/gateway/siteConfig.xml.in" tofile="${basedir}/web/sites/gateway/siteConfig.xml" filtering="true"/>
289 <!--<copy file="${basedir}/resources/java/SOAPServer.cfg.in" tofile="${basedir}/resources/java/SOAPServer.cfg" filtering="true"/>-->
290
291 </target>
292
293 <!-- this target sets up tomcat for teh first time, or resets it any subsequent times -->
294 <target name="prepare-tomcat" depends="init,setup-proxy">
295 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7.zip"
296 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
297 usetimestamp="true"/>
298 <delete dir="${basedir}/comms/jakarta/tomcat.bak"/>
299 <move todir="${basedir}/comms/jakarta/tomcat.bak" failonerror="false">
300 <fileset dir="${basedir}/comms/jakarta/tomcat"/>
301 </move>
302 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
303 dest="${basedir}/comms/jakarta"/>
304 <condition property="need.tomcat.compat">
305 <equals arg1="1.4" arg2="${ant.java.version}"/>
306 </condition>
307 <antcall target="prepare-tomcat-compat"/>
308 <move todir="${basedir}/comms/jakarta/tomcat">
309 <fileset dir="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7"/>
310 </move>
311 <!-- make sure we have execute permission for the .sh files -->
312 <chmod dir="${basedir}/comms/jakarta/tomcat/bin" perm="ugo+rx"
313 includes="*.sh"/>
314 </target>
315
316
317 <target name="prepare-tomcat-compat" if="need.tomcat.compat">
318 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7-compat.zip"
319 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
320 usetimestamp="true"/>
321 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
322 dest="${basedir}/comms/jakarta"/>
323 </target>
324
325 <target name="configure-tomcat" depends="init" if="tomcat.present">
326 <!-- re-setup the server.xml file -->
327 <copy file="${basedir}/comms/jakarta/server.xml.in" tofile="${basedir}/comms/jakarta/tomcat/conf/server.xml" overwrite="true">
328 <filterset>
329 <filter token="port" value="${tomcat.port}"/>
330 <filter token="gsdl3home" value="${basedir}"/>
331 </filterset>
332 </copy>
333 </target>
334
335 <target name="prepare-mysql" depends="init,install-mysql-linux,install-mysql-windows">
336
337 </target>
338
339 <target name="install-mysql-linux" depends="init" if="current.os.islinux">
340 <echo>linux mysql</echo>
341 <!-- get teh file -->
342 <untar src="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
343 dest="${packages.home}"
344 compression="gzip"/>
345 <move todir="${packages.dir}/mysql">
346 <fileset dir="${packages.dir}/mysql-standard-4.1.11"/>
347 </move>
348 </target>
349
350 <target name="install-mysql-windows" depends="init" if="current.os.iswindows">
351 <echo>windows is true</echo>
352 </target>
353
354 <target name="prepare-axis" depends="init">
355 <get src="http://www.greenstone.org/gs3files/axis-1_1.zip"
356 dest="${basedir}/comms/soap/axis-1_1.zip"
357 usetimestamp="true"/>
358 <delete dir="${basedir}/comms/soap/axis.bak"/>
359 <move todir="${basedir}/comms/soap/axis.bak" failonerror="false">
360 <fileset dir="${basedir}/comms/soap/axis"/>
361 </move>
362 <unzip src="${basedir}/comms/soap/axis-1_1.zip"
363 dest="${basedir}/comms/soap/"/>
364 <move todir="${basedir}/comms/soap/axis">
365 <fileset dir="${basedir}/comms/soap/axis-1_1"/>
366 </move>
367 <!-- install the webapp into tomcat -->
368 <copy todir="${basedir}/comms/jakarta/tomcat/webapps/axis">
369 <fileset dir="${basedir}/comms/soap/axis/webapps/axis"/>
370 </copy>
371 </target>
372
373<!-- ====================== Core targets ============================== -->
374<!-- core targets refer to the core gsdl3 java src -->
375
376 <target name="prepare-core"/>
377 <target name="configure-core"/>
378 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
379 description="Update only the Greenstone core" />
380
381 <target name="cvsupdate-core">
382 <cvs command="update -l"/>
383 <cvs command="update -dP bin comms dist-resources docs interfaces lib resources src web winutil"/>
384 </target>
385
386 <target name="clean-core"
387 description="Clean only the Greenstone core">
388 <delete dir="${applet.home}/phind/classes"/>
389 <delete file="${applet.home}/phind/phind.jar"/>
390 <delete dir="${gsdl3.home}/classes"/>
391 <delete file="${gsdl3.home}/gsdl3.jar"/>
392 </target>
393
394 <target name="compile-core"
395 description="Compile only the Greenstone core">
396 <mkdir dir="${build.home}"/>
397 <javac srcdir="${src.home}"
398 destdir="${build.home}"
399 debug="${compile.debug}"
400 deprecation="${compile.deprecation}"
401 optimize="${compile.optimize}">
402 <classpath>
403 <path refid="compile.classpath"/>
404 <!-- need to add in package jar files to classpath -->
405 <pathelement location="${mg.home}/java/mg.jar"/>
406 <pathelement location="${mgpp.home}/java/mgpp.jar"/>
407 <pathelement location="${vishnu.home}/vishnu.jar"/>
408 </classpath>
409 </javac>
410 <jar destfile="${build.home}/gsdl3.jar">
411 <fileset dir="${build.home}">
412 <include name="org/greenstone/gsdl3/**"/>
413 <exclude name="**/Test.class"/>
414 </fileset>
415 <manifest>
416 <attribute name="Built-By" value="${user.name}" />
417 </manifest>
418 </jar>
419 <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/>
420 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
421 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
422 <copy file="${build.home}/org/greenstone/gsdl3/LibraryServlet.class"
423 todir="${web.classes}/org/greenstone/gsdl3"/>
424 <jar destfile="${build.home}/phind.jar">
425 <fileset dir="${build.home}">
426 <include name="org/greenstone/applet/phind/**"/>
427 </fileset>
428 <manifest>
429 <attribute name="Built-By" value="${user.name}" />
430 </manifest>
431 </jar>
432 <copy file="${build.home}/phind.jar" todir="${javalib}"/>
433 <copy file="${build.home}/phind.jar" todir="${web.lib}"/>
434 <jar destfile="${build.home}/anttasks.jar">
435 <fileset dir="${build.home}">
436 <include name="org/greenstone/anttasks/**"/>
437 </fileset>
438 <manifest>
439 <attribute name="Built-By" value="${user.name}" />
440 </manifest>
441 </jar>
442 <copy file="${build.home}/anttasks.jar" todir="${javalib}"/>
443 <jar destfile="${build.home}/gsdl3test.jar">
444 <fileset dir="${build.home}">
445 <include name="org/greenstone/gsdl3/**/*Test.class"/>
446 <include name="org/greenstone/testing/**"/>
447 </fileset>
448 <manifest>
449 <attribute name="Built-By" value="${user.name}" />
450 </manifest>
451 </jar>
452 </target>
453
454<!-- ================== Packages targets ================================ -->
455 <!-- these targets refer to the greenstone packages - these need updating
456 less often, so are in separate targets to the core -->
457 <target name="prepare-packages" depends="init,prepare-mgpp"/>
458
459 <target name="prepare-mgpp" depends="init" unless="mgpp.present">
460 <cvs command="checkout -P" package="mgpp" dest="${basedir}/packages/"/>
461 </target>
462
463 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
464 description="Update only the packages"/>
465
466 <target name="cvsupdate-packages">
467 <cvs command="update -dP" dest="${packages.home}"/>
468 </target>
469
470 <target name="configure-packages" description="Configure only the packages.">
471 <echo>
472 Configuring MG
473 </echo>
474 <exec executable="configure" os="Linux"
475 dir="${mg.home}">
476 <arg value="--prefix=${basedir}"/>
477 </exec>
478 <echo>
479 Configuring MGPP
480 </echo>
481 <exec executable="configure" os="Linux"
482 dir="${mgpp.home}">
483 <arg value="--prefix=${basedir}"/>
484 </exec>
485 </target>
486
487 <target name="clean-packages"
488 description="Clean only the packages">
489 <!-- mg -->
490 <exec executable="make" os="Linux"
491 dir="${mg.home}">
492 <arg value="clean"/>
493 </exec>
494 <delete dir="${mg.home}/java/classes"/>
495 <delete file="${mg.home}/java/mg.jar"/>
496 <delete file="${mg.home}/jni/org_greenstone_mg_MGWrapper.h"/>
497 <delete file="${mg.home}/jni/org_greenstone_mg_MGPassesWrapper.h"/>
498 <!-- mgpp -->
499 <exec executable="make" os="Linux"
500 dir="${mg.home}">
501 <arg value="clean"/>
502 </exec>
503 <delete dir="${mgpp.home}/java/classes"/>
504 <delete file="${mgpp.home}/java/mgpp.jar"/>
505 <delete file="${mgpp.home}/jni/org_greenstone_mgpp_MGPPWrapper.h"/>
506 <delete file="${mgpp.home}/jni/org_greenstone_mgpp_MGPPPassesWrapper.h"/>
507 <!-- vishnu -->
508 <delete dir="${vishnu.home}/src/classes"/>
509 <delete file="${vishnu.home}/src/vishnu.jar"/>
510
511 <!-- gsdl-as : just call the ant target-->
512 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
513 inheritall="false" target="clean"/>
514 </target>
515
516 <target name="compile-packages"
517 description="Compile only the packages">
518 <!-- mg -->
519 <echo>Compiling MG</echo>
520 <!-- c code -->
521 <!-- javacode -->
522 <mkdir dir="${mg.home}/java/classes"/>
523 <javac srcdir="${mg.home}/java"
524 destdir="${mg.home}/java/classes"
525 debug="${compile.debug}"
526 deprecation="${compile.deprecation}"
527 optimize="${compile.optimize}">
528 </javac>
529 <javah classpath="${mg.home}/java/classes"
530 destdir="${mg.home}/jni">
531 <class name="org.greenstone.mg.MGWrapper"/>
532 <class name="org.greenstone.mg.MGPassesWrapper"/>
533 </javah>
534 <jar destfile="${mg.home}/java/mg.jar">
535 <fileset dir="${mg.home}/java/classes"/>
536 <manifest>
537 <attribute name="Built-By" value="${user.name}" />
538 </manifest>
539 </jar>
540 <copy file="${mg.home}/java/mg.jar" todir="${javalib}"/>
541 <!-- make the c code -->
542 <exec executable="make" os="Linux"
543 dir="${mg.home}">
544 </exec>
545 <exec executable="make" os="Linux"
546 dir="${mg.home}">
547 <arg value="install"/>
548 </exec>
549
550 <!-- mgpp -->
551 <echo>Compiling MGPP</echo>
552 <!-- javacode -->
553 <mkdir dir="${mgpp.home}/java/classes"/>
554 <javac srcdir="${mgpp.home}/java"
555 destdir="${mgpp.home}/java/classes"
556 debug="${compile.debug}"
557 deprecation="${compile.deprecation}"
558 optimize="${compile.optimize}">
559 </javac>
560 <javah classpath="${mgpp.home}/java/classes"
561 destdir="${mgpp.home}/jni">
562 <class name="org.greenstone.mgpp.MGPPWrapper"/>
563 <class name="org.greenstone.mgpp.MGPPPassesWrapper"/>
564 </javah>
565 <jar destfile="${mgpp.home}/java/mgpp.jar">
566 <fileset dir="${mgpp.home}/java/classes"/>
567 <manifest>
568 <attribute name="Built-By" value="${user.name}" />
569 </manifest>
570 </jar>
571 <copy file="${mgpp.home}/java/mgpp.jar" todir="${javalib}"/>
572 <!-- c++ code -->
573 <exec executable="make" os="Linux"
574 dir="${mgpp.home}">
575 </exec>
576 <exec executable="make" os="Linux"
577 dir="${mgpp.home}">
578 <arg value="install"/>
579 </exec>
580
581 <!-- vishnu -->
582 <echo>Compiling Vishnu</echo>
583 <mkdir dir="${vishnu.home}/classes"/>
584 <javac srcdir="${vishnu.home}/src"
585 destdir="${vishnu.home}/classes"
586 debug="${compile.debug}"
587 deprecation="${compile.deprecation}"
588 optimize="${compile.optimize}">
589 <classpath>
590 <path refid="compile.classpath"/>
591 <pathelement location="${mg.home}/java/mg.jar"/>
592 </classpath>
593 </javac>
594 <jar destfile="${vishnu.home}/vishnu.jar">
595 <fileset dir="${vishnu.home}/classes"/>
596 <manifest>
597 <attribute name="Built-By" value="${user.name}" />
598 </manifest>
599 </jar>
600 <copy file="${vishnu.home}/vishnu.jar" todir="${javalib}"/>
601 <copy file="${vishnu.home}/vishnu.jar" todir="${web.lib}"/>
602 <mkdir dir="${web.classes}/vishnu/server"/>
603 <copy file="${vishnu.home}/classes/vishnu/server/VisServlet.class"
604 todir="${web.classes}/vishnu/server"/>
605
606 <!-- gsdl-as -->
607 <echo>Compiling GSDL-AS</echo>
608 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
609 inheritall="false" target="compile"/>
610 </target>
611
612 <!-- ================== gs2building targets ===============-->
613
614
615 <target name="update-gs2building" if="gsdl2.islocal"
616 depends="init,cvsupdate-gs2building,configure-gs2building,clean-gs2building,compile-gs2building"
617 description="Update only the Greenstone 2 building components"/>
618
619 <target name="cvsupdate-gs2building" if="gsdl2.islocal" depends="init">
620 <cvs command="update -dP" dest="${gli.home}"/>
621 <!-- Note: can't do a -d update here cos it will get all of gsdl-->
622 <cvs command="update -P" dest="${gs2build.home}"/>
623 <!-- rename the .gs2build files - we may have gotten changes to the main
624 gsdl versions - make sure they are set back to the gs2build versions -->
625 <antcall target="rename-gs2build-files"/>
626 </target>
627
628 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal">
629 <echo>checking out gs2 building stuff</echo>
630 </target>
631
632 <target name="prepare-gs2build" depends="init" if="gsdl2.islocal" unless="gs2build.present">
633 <echo>checking out gs2build</echo>
634 <cvs command="co -P" package="gs2build"/>
635
636 <!-- rename the .gs2build files -->
637 <antcall target="rename-gs2build-files"/>
638 </target>
639
640 <target name="rename-gs2build-files">
641 <move file="${gs2build.home}/configure.gs2build" tofile="${gs2build.home}/configure"/>
642 <move file="${gs2build.home}/configure.in.gs2build" tofile="${gs2build.home}/configure.in"/>
643 <move file="${gs2build.home}/Makefile.in.gs2build" tofile="${gs2build.home}/Makefile.in"/>
644 <move file="${gs2build.home}/packages/configure.gs2build" tofile="${gs2build.home}/packages/configure"/>
645 <move file="${gs2build.home}/packages/Makefile.gs2build" tofile="${gs2build.home}/packages/Makefile"/>
646 <move file="${gs2build.home}/lib/Makefile.in.gs2build" tofile="${gs2build.home}/lib/Makefile.in"/>
647 </target>
648 <target name="prepare-gli" depends="init" if="gsdl2.islocal" unless="gli.present">
649 <echo>checking out gli</echo>
650 <cvs command="co -P" package="gli"/>
651 </target>
652
653 <target name="configure-gs2building" if="gsdl2.islocal"
654 description="Configure only the Greenstone 2 building components">
655 <exec executable="${gs2build.home}/configure" os="${os.linux}"
656 dir="${gs2build.home}">
657 <arg value="--prefix=${gs2build.home}"/>
658 </exec>
659 </target>
660
661 <target name="clean-gs2building" depends="init" if="gsdl2.islocal"
662 description="Clean only the Greenstone 2 building components">
663 <!-- gli -->
664 <property name="gli.home" value="${basedir}/gli"/>
665 <!-- linux -->
666 <exec executable="clean.sh" os="${os.linux}" dir="${gli.home}"
667 resolveExecutable="true"/>
668 <!-- windows -->
669 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
670 resolveExecutable="true"/>
671 <!-- gs2build -->
672 <!--linux: -->
673 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
674 <arg value="clean"/>
675 </exec>
676 <!-- windows: -->
677 </target>
678
679 <target name="compile-gs2building" depends="init" if="gsdl2.islocal"
680 description="Compile only the Greenstone 2 building components">
681 <!-- gli -->
682 <property name="gli.home" value="${basedir}/gli"/>
683 <!-- linux -->
684 <exec executable="makegli.sh" os="${os.linux}" dir="${gli.home}"
685 resolveExecutable="true"/>
686 <!-- windows -->
687 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
688 resolveExecutable="true"/>
689 <!-- gs2build -->
690 <!--linux: make, make install -->
691 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
692 </exec>
693 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
694 <arg value="install"/>
695 </exec>
696
697 <!-- windows: -->
698 </target>
699
700
701<!-- ============ running targets ========================-->
702
703 <target name="setup-catalina-ant-tasks">
704 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
705 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
706 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
707 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
708 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
709 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
710 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
711 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
712 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
713 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
714 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
715 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
716 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
717 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
718 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
719 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
720 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
721 </target>
722
723 <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external">
724 <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.
725 </echo>
726 </target>
727
728 <target name="gli-local" depends="init" if="gsdl2.islocal">
729 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux}" dir="${basedir}/gli" spawn="true">
730 <env key="GSDLHOME" path="${basedir}/gs2build"/>
731 <env key="GSDL3HOME" value="${basedir}"/>
732 </exec>
733 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
734 <env key="GSDLHOME" value="${basedir}/gs2build"/>
735 <env key="GSDL3HOME" value="${basedir}"/>
736 </exec>
737 </target>
738
739 <target name="gli-external" depends="init" unless="gsdl2.islocal">
740 <exec executable="${gsdl.path}/gli/gli4gs3.sh" os="${os.linux}" dir="${gsdl.path}/gli"/>
741 <exec executable="${gsdl.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl.path}/gli"/>
742 </target>
743
744
745 <target name="reload" description="Reload web application"
746 depends="init,setup-catalina-ant-tasks">
747 <reload url="http://kanuka:7070/manager" username="admin" password="admin"
748 path="/gsdl3"/>
749 </target>
750
751 <target name="startup" description="Launch Greenstone (Tomcat and Mysql)" depends="init">
752 <property name="tomcat.classpath" refid="compile.classpath"/>
753 <property name="tomcat.path" value="${basedir}/packages/mysql/bin:${basedir}/bin/script:${basedir}/bin:${env.PATH}"/>
754 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
755 <exec executable="${catalina.home}/bin/startup.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false">
756 <env key="GSDLOS" value="linux"/>
757 <env key="GSDL3HOME" value="${basedir}"/>
758 <env key="PATH" path="${tomcat.path}"/>
759 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
760 <env key="CLASSPATH" path="${tomcat.classpath}"/>
761 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${basedir}/lib:${mysql.home}/lib/mysql"/>
762 </exec>
763 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
764 <env key="GSDLOS" value="windows"/>
765 <env key="GSDL3HOME" value="${basedir}"/>
766 <env key="PATH" path="${tomcat.path}:${basedir}/lib"/>
767 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
768 <env key="CLASSPATH" path="${tomcat.classpath}"/>
769 </exec>
770 <!-- wait for the server to startup in case other targets need it running -->
771 <waitfor maxwait="5" maxwaitunit="second">
772 <and>
773 <socket server="${tomcat.server}" port="${tomcat.port}"/>
774 <http url="http://${tomcat.server}:${tomcat.port}/gsdl3/index.html"/>
775 </and>
776 </waitfor>
777 </target>
778
779 <target name="shutdown" description="Shutdown Greenstone (Tomcat and Mysql)" depends="init">
780 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false"/>
781 </target>
782
783 <target name="restart" description="Shutdown and restart the Greenstone servers" depends="init,shutdown,startup"/>
784
785 <target name="test" description="Run the (incomplete) JUnit test suite "
786 depends="init">
787 <mkdir dir="${basedir}/test"/>
788 <junit printsummary="withOutAndErr"
789 errorproperty="test.failed"
790 failureproperty="test.failed"
791 fork="${junit.fork}">
792 <formatter type="plain"/>
793 <classpath>
794 <pathelement location="${build.home}/gsdl3test.jar"/>
795 <path refid="compile.classpath"/>
796 </classpath>
797 <test name="${testcase}" if="testcase"/>
798 <batchtest todir="${basedir}/test" unless="testcase">
799 <fileset dir="${build.home}"
800 includes="**/*Test.class"
801 />
802 </batchtest>
803 </junit>
804 <echo>
805 *********************************************
806 Test output can be found in directory 'test'
807 *********************************************
808 </echo>
809 </target>
810
811 <target name="compile-extra" depends="init">
812 <javac srcdir="${web.home}/WEB-INF/classes"
813 destdir="${web.home}/WEB-INF/classes"
814 debug="${compile.debug}"
815 deprecation="${compile.deprecation}"
816 optimize="${compile.optimize}">
817 <classpath>
818 <path refid="compile.classpath"/>
819 </classpath>
820 </javac>
821 </target>
822
823 <target name="get-sitename">
824 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
825 <condition property="deploy.exists">
826 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
827 </condition>
828 <condition property="undeploy.exists">
829 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
830 </condition>
831 <echo>${axis.sitename}, ${deploy.exists}, ${undeploy.exists}</echo>
832 </target>
833
834 <target name="create-deployment-files" depends="get-sitename"
835 if="axis.sitename" unless="deploy.exists">
836 <filter token="sitename" value="${axis.sitename}"/>
837 <copy file="${basedir}/resources/soap/site.wsdd.template"
838 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
839 filtering="true"/>
840 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
841 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
842 filtering="true"/>
843 <!-- create the java files and compile them -->
844 <copy file="${gsdl3.home}/SOAPServer.java.in"
845 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
846 filtering="true"/>
847 <javac srcdir="${src.home}"
848 destdir="${build.home}"
849 debug="${compile.debug}"
850 deprecation="${compile.deprecation}"
851 optimize="${compile.optimize}">
852 <classpath refid="compile.classpath"/>
853 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
854 </javac>
855 <jar destfile="${build.home}/gsdl3.jar">
856 <fileset dir="${build.home}">
857 <include name="org/greenstone/gsdl3/**"/>
858 <exclude name="**/Test.class"/>
859 </fileset>
860 <manifest>
861 <attribute name="Built-By" value="${user.name}" />
862 </manifest>
863 </jar>
864 <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/>
865 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
866 </target>
867
868 <target name="axis-deploy-site" depends="get-sitename,create-deployment-files,restart">
869 <java classname="org.apache.axis.client.AdminClient">
870 <classpath refid="compile.classpath"/>
871 <arg value="-p"/>
872 <arg value="${tomcat.port}"/>
873 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
874 </java>
875 </target>
876
877 <target name="axis-undeploy-site" depends="get-sitename">
878 <java classname="org.apache.axis.client.AdminClient">
879 <classpath refid="compile.classpath"/>
880 <arg value="-p"/>
881 <arg value="${tomcat.port}"/>
882 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
883 </java>
884 </target>
885
886 <!-- mysql targets -->
887
888</project>
889
890
Note: See TracBrowser for help on using the repository browser.