source: greenstone3/trunk/build.xml@ 20233

Last change on this file since 20233 was 20233, checked in by oranfry, 15 years ago
  • build.xml: fail if user tries to combine tomcat6 and java1.4
  • gs3-setup.sh: if search4j not present, warn they may need java 1.5
File size: 75.4 KB
Line 
1<?xml version="1.0"?>
2<!-- ======================================================================
3 March 2005
4
5 Greenstone3 build and install script
6
7 kjdon
8 ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
10
11 <!-- ============ classpath =================== -->
12 <path id="project.classpath">
13 <fileset dir="lib/java">
14 <include name="**/*.jar"/>
15 </fileset>
16 </path>
17
18 <!-- ============ self defined tasks =================== -->
19 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
20 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
21 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
22 <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
23 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
24 <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
25
26 <!-- ===================== Property Definitions =========================== -->
27
28 <!--
29
30 Each of the following properties are used in the build script.
31 Values for these properties are set by the first place they are
32 defined, from the following list:
33
34 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
35
36 * Definitions from a "build.properties" file in the top level
37 source directory of this application.
38
39 * Definitions from a "build.properties" file in the user's
40 home directory.
41
42 * Default definitions in this build.xml file.
43
44 You will note below that property values can be composed based on the
45 contents of previously defined properties. This is a powerful technique
46 that helps you minimize the number of changes required when your development
47 environment is modified. Note that property composition is allowed within
48 "build.properties" files as well as in the "build.xml" script.
49
50 -->
51
52 <!-- create build.properties if it has not been created yet -->
53 <if>
54 <bool><not><available file="build.properties"/></not></bool>
55 <copy file="build.properties.in" tofile="build.properties"/>
56 </if>
57
58 <!-- create the packages dir if it has not been created yet -->
59 <mkdir dir="packages"/>
60
61 <!--the first three properties have to be put on the top to be used by build.properties-->
62 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
63 <property name="src.packages.home" value="${basedir}/src/packages"/>
64 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
65
66 <property file="build.properties"/>
67 <if><bool><available file="${user.home}/build.properties"/></bool>
68 <property file="${user.home}/build.properties"/>
69 </if>
70
71 <!-- get properties from the environment -->
72 <property environment="env"/>
73
74 <!-- get the filesets defining components and executables -->
75 <import file="resources/xml/components.xml"/>
76 <import file="resources/xml/executables.xml"/>
77
78 <!-- version properties for external packages -->
79 <!-- for Java versions < 1.4, we print out the message that Java is too old.
80 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 6.0-->
81 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-6.0.20">
82 <equals arg1="1.4" arg2="${ant.java.version}"/>
83 </condition>
84 <condition property="tomcat.version.major" value="5" else="6">
85 <equals arg1="1.4" arg2="${ant.java.version}"/>
86 </condition>
87
88 <!--
89 the next block checks if tomcat is present in the 'packages' directory, and if so, figures
90 out its major version number (5, 6, etc.)
91 then it checks if your java is new enough to run that tomcat and if not fails with an explanation
92 -->
93 <condition property="packages.tomcat.ispresent" value="true" else="false">
94 <available file="packages/tomcat"/>
95 </condition>
96
97 <if><bool><istrue value="${packages.tomcat.ispresent}"/></bool>
98 <exec os="${os.unix}" outputproperty="packages.tomcat.detected.version" dir="packages/tomcat/bin" executable="sh">
99 <arg value="-c"/>
100 <arg value="./catalina.sh version | grep '^Server version: ' | sed 's@[^0-9]*\([0-9]\).*@\1@g'"/>
101 </exec>
102 <!--
103 totally untested, so commented out for now
104 <exec os="${os.windows}" outputproperty="packages.tomcat.detected.version" dir="packages/tomcat/bin" executable="cmd.exe">
105 <arg value="/c"/>
106 <arg value="catalina.bat version | grep '^Server version: ' | sed 's@[^0-9]*\([0-9]\).*@\1@g'"/>
107 </exec>
108 -->
109 <property name="packages.tomcat.detected.version" value="unknown"/>
110 </if>
111
112 <if>
113 <bool>
114 <and>
115 <istrue value="${packages.tomcat.ispresent}"/>
116 <equals arg1="${packages.tomcat.detected.version}" arg2="6"/>
117 <equals arg1="1.4" arg2="${ant.java.version}"/>
118 </and>
119 </bool>
120 <fail>Your java version (1.4) is too old to work with the bundled version of Apache Tomcat. Please upgrade your java to version 1.5 or greater. Alternatively, you may remove the bundled Apache Tomcat from the 'packages' folder and then run 'ant prepare-tomcat'.</fail>
121 </if>
122
123
124 <property name="axis.zip.version" value="axis-bin-1_2_1.zip"/>
125 <property name="axis.dir.version" value="axis-1_2_1"/>
126 <property name="sqlite.targz.version" value="sqlite-amalgamation-3.5.9.tar.gz"/>
127
128 <property name="build.home" value="${basedir}/build"/>
129 <property name="src.home" value="${basedir}/src/java"/>
130 <property name="packages.home" value="${basedir}/packages"/>
131 <!-- this may be set in build.properties, eg if you move the web dir to
132 tomcats webapps directory -->
133 <property name="web.home" value="${basedir}/web"/>
134 <!-- jar files needed by applets go here -->
135 <property name="web.applet" value="${web.home}/applet"/>
136
137 <!-- jar files needed by the servlet (and extra ones) go here -->
138 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
139 <!-- other files needed by the servlet go here -->
140 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
141 <!--- flax: the WordNet home -->
142 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
143
144 <!-- jni libraries and java wrappers go here -->
145 <property name="lib.jni" value="${basedir}/lib/jni"/>
146
147 <!-- other jar files needed for installation (but not runtime) go here -->
148 <property name="lib.java" value="${basedir}/lib/java"/>
149
150 <property name="javadocs" value="${basedir}/docs/javadoc"/>
151
152 <property name="app.name" value="greenstone3"/>
153 <property name="app.path" value="/${app.name}"/>
154
155 <property name="admin.dir" value="${basedir}/admin"/>
156
157 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
158 <property name="app.version" value="trunk"/>
159 <property name="branch.path" value="trunk"/>
160 <property name="branch.revision" value="HEAD"/>
161
162 <!--constants -->
163 <property name="svn.root" value="http://svn.greenstone.org"/>
164
165 <!-- catalina home is set to tomcat basedir if already installed, otherwise
166 use greenstone's tomcat -->
167 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
168 <and>
169 <isset property="tomcat.installed.path"/>
170 <not>
171 <equals arg1="" arg2="${tomcat.installed.path}"/>
172 </not>
173 </and>
174 </condition>
175
176 <property name="os.linux" value="Linux"/>
177 <property name="os.mac" value="Mac OS X"/>
178 <property name="os.solaris" value="SunOS"/>
179 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
180 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista"/> <!-- check this!!!-->
181
182 <!-- this is true for linux and macs -->
183 <condition property="current.os.isunix">
184 <os family="unix"/>
185 </condition>
186
187 <condition property="current.os.isunixnotmac">
188 <and>
189 <os family="unix"/>
190 <not>
191 <os family="mac"/>
192 </not>
193 </and>
194 </condition>
195
196 <condition property="current.os.ismac">
197 <os family="mac"/>
198 </condition>
199
200 <condition property="current.os.iswindows">
201 <os family="windows"/>
202 </condition>
203
204 <!-- is there a better way to do this?? what about solaris?? -->
205 <condition property="os.bin.dir" value="windows">
206 <os family="windows"/>
207 </condition>
208 <condition property="os.bin.dir" value="darwin">
209 <os family="mac"/>
210 </condition>
211 <condition property="os.bin.dir" value="linux">
212 <and>
213 <os family="unix"/>
214 <not>
215 <os family="mac"/>
216 </not>
217 </and>
218 </condition>
219
220
221 <condition property="collection.building.disabled">
222 <isset property="disable.collection.building"/>
223 </condition>
224
225 <condition property="collection.building.enabled">
226 <not>
227 <isset property="disable.collection.building"/>
228 </not>
229 </condition>
230
231 <condition property="collection.building.enabled.windows">
232 <and>
233 <isset property="collection.building.enabled"/>
234 <isset property="current.os.iswindows"/>
235 </and>
236 </condition>
237
238 <condition property="collection.building.enabled.unix">
239 <and>
240 <isset property="collection.building.enabled"/>
241 <isset property="current.os.isunix"/>
242 </and>
243 </condition>
244
245 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
246 <isset property="compile.static"/>
247 </condition>
248
249 <!-- where is search4j tool -->
250 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
251 <isset property="current.os.iswindows"/>
252 </condition>
253
254
255 <!-- ============= Base dirs for each package and component ============ -->
256 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
257 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
258 <property name="gli.home" value="${basedir}/gli"/>
259 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
260
261 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}/common-src">
262 <isset property="disable.collection.building"/>
263 </condition>
264
265 <property name="build.src.home" value="${gs2build.home}/build-src"/>
266 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
267 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
268 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
269 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
270
271 <!-- ==================== Compilation Control Options ==================== -->
272
273 <!--
274
275 These properties control option settings on the Javac compiler when it
276 is invoked using the <javac> task.
277
278 compile.debug Should compilation include the debug option?
279
280 compile.deprecation Should compilation include the deprecation option?
281
282 compile.optimize Should compilation include the optimize option?
283
284 -->
285
286 <property name="compile.debug" value="true"/>
287 <property name="compile.deprecation" value="true"/>
288 <property name="compile.optimize" value="true"/>
289
290 <!--
291
292 Rather than relying on the CLASSPATH environment variable, Ant includes
293 features that makes it easy to dynamically construct the classpath you
294 need for each compilation. The example below constructs the compile
295 classpath to include the servlet.jar file, as well as the other components
296 that Tomcat makes available to web applications automatically, plus anything
297 that you explicitly added.
298
299 -->
300
301 <!-- All elements that Tomcat 5 exposes to applications -->
302 <path id="tomcat5">
303 <pathelement location="${catalina.home}/common/classes"/>
304 <fileset dir="${catalina.home}/common/endorsed">
305 <include name="*.jar"/>
306 </fileset>
307 <fileset dir="${catalina.home}/common/lib">
308 <include name="*.jar"/>
309 </fileset>
310 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
311 <pathelement location="${catalina.home}/shared/classes"/>
312 <fileset dir="${catalina.home}/shared/lib">
313 <include name="*.jar"/>
314 </fileset>
315 </path>
316
317 <!-- All elements that Tomcat 6 exposes to applications -->
318 <path id="tomcat6">
319 <fileset dir="${catalina.home}/lib">
320 <include name="*.jar"/>
321 </fileset>
322 </path>
323
324 <path id="compile.classpath">
325 <!-- Include all jar files and libraries in our jni lib directory -->
326 <pathelement location="${lib.jni}"/>
327 <fileset dir="${lib.jni}">
328 <include name="*.jar"/>
329 </fileset>
330 <!-- Include all jar files in our web lib directory -->
331 <pathelement location="${web.lib}"/>
332 <fileset dir="${web.lib}">
333 <include name="*.jar"/>
334 </fileset>
335
336 <pathelement location="${lib.java}"/>
337 <fileset dir="${lib.java}">
338 <include name="*.jar"/>
339 </fileset>
340
341 <!-- include the jar files from the source packages -->
342 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
343 so we add them in by name -->
344 <pathelement location="${lib.jni}/mg.jar"/>
345 <pathelement location="${lib.jni}/mgpp.jar"/>
346
347 <!-- Include all elements that Tomcat exposes to applications -->
348 <path refid="tomcat${tomcat.version.major}"/>
349
350 </path>
351
352 <path id="local.tomcat.classpath">
353 <!-- explicitly include the jni java wrappers in the classpath -->
354 <pathelement location="${lib.jni}"/>
355 <fileset dir="${lib.jni}">
356 <include name="*.jar"/>
357 </fileset>
358 </path>
359
360 <path id="local.tomcat.path">
361 <pathelement location="${basedir}/bin/script"/>
362 <pathelement location="${basedir}/bin"/>
363 <pathelement location="${lib.jni}"/>
364 <pathelement path="${env.PATH}"/>
365 <pathelement path="${env.Path}"/>
366 <pathelement path="${wn.home}/bin"/>
367 </path>
368
369 <target name="test-setup">
370 <echo>ant java version=${ant.java.version}</echo>
371 <echo>is unix : ${current.os.isunix}</echo>
372 <echo>is mac : ${current.os.ismac}</echo>
373 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
374 <echo>is windows : ${current.os.iswindows}</echo>
375 <echo>os.unix: ${os.unix}</echo>
376 </target>
377
378 <!-- ==================== Primary and Global Targets ============================= -->
379
380 <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
381 description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional subversion checkouts and downloads, so you need to be online to run this.">
382
383 <!-- make sure .sh files are executable -->
384 <chmod dir="${basedir}" perm="ugo+rx"
385 includes="*.sh"/>
386 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
387 includes="*.sh,*.pl"/>
388 </target>
389
390 <!-- install-common-src and install-collection-building are mutually exclusive and either one or the other will be done depending on whether collection building is enabled or not -->
391 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
392 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
393
394 <target name="install-common-src" depends="init"
395 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
396 <antcall target="configure-common-src"/>
397 <antcall target="compile-common-src"/>
398 <antcall target="install-auxiliary-jar-files"/>
399 <antcall target="install-jni-files"/>
400 </target>
401
402 <target name="install-collection-building" depends="init" if="collection.building.enabled"
403 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
404 <antcall target="configure-collection-building"/>
405 <antcall target="tweak-makefiles" />
406 <antcall target="compile-collection-building"/>
407 </target>
408
409
410 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
411 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
412
413 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
414 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
415
416 <target name="configure" depends="init,configure-tomcat,configure-web"
417 description="Configure the installation (not the C++ code). Includes setting up config files. Should be re-run if you change the build.properties file."/>
418
419 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
420 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
421
422 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
423 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
424
425 <target name="update" depends="init,svnupdate,clean,install"
426 description="Update (thru Subversion) all the source (including common-src or collection-building, and runtime), then clean, and re-install. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/>
427
428 <target name="start" depends="init,start-tomcat"
429 description="Startup the Tomcat server." >
430 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
431 <echo>Tomcat: ${catalina.home}</echo>
432 <echo>Java : ${java.home}</echo>
433 <echo>URL : http://${tomcat.server}:${tomcat.port}${app.path}/</echo>
434 <!-- assuming that index.html is not needed here -->
435 </target>
436
437 <target name="stop" depends="init,stop-tomcat"
438 description="Shutdown the Tomcat server."/>
439
440 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
441
442
443 <!-- =========== Help targets =================================== -->
444
445 <property name="install-command" value="ant [options] prepare install"/>
446
447 <target name="usage" description="Print a help message">
448 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
449 <echo message=" Execute 'ant -help' for Ant help."/>
450 <echo>To install Greenstone3, run '${install-command}'.
451 There 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.
452 To log the output, use the '-logfile build.log' option.
453 The README.txt file has more information about the ant targets and install process.
454 </echo>
455 </target>
456
457 <target name="help" depends="usage" description="Print a help message"/>
458
459 <target name="debug" depends="init" description="Display all the currently used properties">
460 <echoproperties/>
461 </target>
462
463 <!-- ====== initialization and setup targets ================== -->
464
465 <target name="accept-properties" unless="properties.accepted">
466 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
467 tomcat.server=${tomcat.server}
468 tomcat.port=${tomcat.port}
469 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
470 proxy.host=${proxy.host}
471 proxy.port=${proxy.port}
472 disable.collection.building=${disable.collection.building}
473 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
474 </input>
475 <condition property="do.abort">
476 <equals arg1="n" arg2="${properties.ok}"/>
477 </condition>
478 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
479 </target>
480
481 <!-- this sets up some initial properties -->
482 <target name="init">
483
484 <!-- has the gs3-setup script been run?? -->
485 <condition property="gs3-setup-not-done">
486 <not>
487 <isset property="env.GSDL3HOME"/>
488 </not>
489 </condition>
490
491 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
492
493 <condition property="java.too.old">
494 <or>
495 <equals arg1="1.1" arg2="${ant.java.version}"/>
496 <equals arg1="1.2" arg2="${ant.java.version}"/>
497 <equals arg1="1.3" arg2="${ant.java.version}"/>
498 </or>
499 </condition>
500 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
501
502 <available file="${basedir}/gli" property="gli.present"/>
503 <available file="${basedir}/common-src" property="common.src.present"/>
504 <available file="${basedir}/gs2build" property="gs2build.present"/>
505
506 <condition property="tomcat.islocal">
507 <or>
508 <not><isset property="tomcat.installed.path"/></not>
509 <equals arg1="" arg2="${tomcat.installed.path}"/>
510 </or>
511 </condition>
512
513 <echo>tomcat.port = ${tomcat.port}</echo>
514
515 <condition property="proxy.present">
516 <and>
517 <isset property="proxy.host"/>
518 <not><equals arg1="" arg2="${proxy.host}"/></not>
519 </and>
520 </condition>
521
522 </target>
523
524 <target name="setup-proxy" depends="init" if="proxy.present">
525 <condition property="ask.user">
526 <or>
527 <equals arg1="" arg2="${proxy.user}"/>
528 <equals arg1="" arg2="${proxy.password}"/>
529 </or>
530 </condition>
531
532 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
533 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
534 </target>
535
536 <!-- ========== Web app Targets ================================ -->
537
538 <target name="prepare-web" depends="init">
539 <mkdir dir="${web.home}/applet"/>
540 <mkdir dir="${web.home}/logs"/>
541 </target>
542
543 <!-- if we are using java 1.5+, we need the xalan.jar file in web/WEB-INF/lib, but if we are using java 1.4, we can't have it there -->
544 <target name="configure-java-version" depends="init"
545 description="Activates or deactivates some jar libraries as needed depending on your java version">
546
547 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
548 <condition property="need.xalan.jar">
549 <or>
550 <equals arg1="1.5" arg2="${ant.java.version}"/>
551 <equals arg1="1.6" arg2="${ant.java.version}"/>
552 </or>
553 </condition>
554
555 <!-- if they have xalan.jar but dont need it -->
556 <if>
557 <bool>
558 <and>
559 <isset property="have.xalan.jar"/>
560 <not><isset property="need.xalan.jar"/></not>
561 </and>
562 </bool>
563 <antcall target="deactivate-xalan-jar"/>
564 </if>
565
566 <!-- if they need xalan.jar but dont have it -->
567 <if>
568 <bool>
569 <and>
570 <not><isset property="have.xalan.jar"/></not>
571 <isset property="need.xalan.jar"/>
572 </and>
573 </bool>
574 <antcall target="activate-xalan-jar"/>
575 </if>
576
577 </target>
578
579 <target name="activate-xalan-jar">
580 <echo>activating xalan.jar</echo>
581 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
582 <if>
583 <bool>
584 <and>
585 <isset property="current.os.ismac"/>
586 <available file="${catalina.home}/common/endorsed" type="dir"/>
587 </and>
588 </bool>
589 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
590 </if>
591 </target>
592
593 <target name="deactivate-xalan-jar">
594 <echo>deactivating xalan.jar</echo>
595 <delete file="${web.lib}/xalan.jar"/>
596 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
597 </target>
598
599
600 <target name="prepare-collections" depends="init">
601 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
602 <property name="index.zip" value="index.zip"/>
603
604 <echo message="installing collections..."/>
605 <antcall target="gs2mgdemo-install"/>
606 <antcall target="gs2mgppdemo-install"/>
607 <antcall target="gberg-install"/>
608 </target>
609
610 <target name="gs2mgdemo-prepare" if="collect.dir">
611 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
612
613 <condition property="gs2mgdemo.present">
614 <and>
615 <available file="${gs2mgdemo.dir}/${index.zip}"/>
616 </and>
617 </condition>
618 </target>
619
620 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
621 <echo> installing gs2mgdemo</echo>
622 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
623 <echo>collection gs2mgdemo installed</echo>
624 </target>
625
626 <target name="gs2mgppdemo-prepare" if="collect.dir">
627 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
628
629 <condition property="gs2mgppdemo.present">
630 <and>
631 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
632 </and>
633 </condition>
634 </target>
635
636 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
637 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
638 <echo>collection gs2mgppdemo installed</echo>
639 </target>
640
641 <target name="gberg-prepare" if="collect.dir">
642 <property name="gberg.dir" value="${collect.dir}/gberg"/>
643 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
644 </target>
645
646 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
647 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
648 <echo>collection gberg installed</echo>
649 </target>
650
651 <target name="configure-web" depends="init"
652 description="Configure only the web app config files">
653 <!-- we want a unix path in the global.properties file -->
654 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
655 <path path="${web.home}"/>
656 </pathconvert>
657 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
658 <filter token="gsdl3version" value="${app.version}"/>
659 <filter token="tomcat.server" value="${tomcat.server}"/>
660 <filter token="tomcat.port" value="${tomcat.port}"/>
661 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
662 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
663 <chmod file="${web.classes}/global.properties" perm="600"/>
664 <chmod file="${web.classes}/log4j.properties" perm="600"/>
665 </target>
666
667 <target name="compile-web" depends="init">
668 <javac srcdir="${web.classes}"
669 destdir="${web.classes}"
670 debug="${compile.debug}"
671 deprecation="${compile.deprecation}"
672 optimize="${compile.optimize}">
673 <classpath><path refid="compile.classpath"/></classpath>
674 </javac>
675 </target>
676
677 <target name="compile-classpath-jars" depends="init">
678 <if><bool><available file="admin/cp.mf"/></bool>
679 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
680 </if>
681 <if><bool><available file="${lib.java}/cp.mf"/></bool>
682 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
683 </if>
684 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
685 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
686 </if>
687 <if><bool><available file="${web.lib}/cp.mf"/></bool>
688 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
689 </if>
690 <jar destfile="cp.jar">
691 <manifest>
692 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
693 </manifest>
694 </jar>
695 </target>
696
697 <target name="clean-classpath-jars" depends="init">
698 <delete file="admin/cp.jar"/>
699 <delete file="${lib.java}/cp.jar"/>
700 <delete file="${lib.jni}/cp.jar"/>
701 <delete file="${web.lib}/cp.jar"/>
702 <delete file="cp.jar"/>
703 </target>
704
705
706 <target name="svnupdate-web" unless="nosvn.mode">
707 <svn>
708 <update dir="${web.home}" revision="${branch.revision}"/>
709 </svn>
710 </target>
711
712 <target name="update-web" depends="init,svnupdate-web,configure-web"
713 description="update only the web stuff (config files)"/>
714
715 <!-- ======================= Tomcat Targets ========================== -->
716
717 <!-- this target downloads and installs Tomcat -->
718 <!-- we download tomcat (version 6 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
719 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
720 description="downloads the appropriate version of Tomcat (Tomcat 5 if using Java 1.4, Tomcat 6 if using Java 1.5 or higher). If you want to change which version of Java you are using between 1.4 and 1.5/6 then you need to run prepare-tomcat">
721 <if>
722 <bool>
723 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
724 </bool>
725
726 <!-- check that packages dir is there -->
727 <mkdir dir="${packages.home}"/>
728 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
729 dest="${packages.home}/${tomcat.version}.zip"
730 usetimestamp="true"/>
731 <unzip src="${packages.home}/${tomcat.version}.zip"
732 dest="${packages.home}"/>
733
734 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
735 we would need to have the tomcat compat package to work with Java 1.4-->
736 <if>
737 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
738 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
739 dest="${packages.home}/${tomcat.version}-compat.zip"
740 usetimestamp="true"/>
741 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
742 dest="${packages.home}"/>
743 </if>
744
745 <!-- delete any existing tomcat -->
746 <delete dir="${packages.home}/tomcat"/>
747 <move todir="${packages.home}/tomcat">
748 <fileset dir="${packages.home}/${tomcat.version}"/>
749 </move>
750 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
751 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
752 overwrite="true"/>
753 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
754 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
755 overwrite="true"/>
756 <!-- make sure we have execute permission for the .sh files -->
757 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
758 includes="*.sh"/>
759
760 <echo file="${packages.home}/tomcat/.flagfile">
761 the timestamp of this file is the time that tomcat was extracted from the zip files.
762 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
763 </echo>
764
765 <!-- this is not strictly a prepare tomcat thing, but if one changes
766 Java, then they need to change tomcat as well, so might as well call
767 it here -->
768 <antcall target="configure-java-version"/>
769 <else>
770 <echo>Tomcat has been prepared, will not prepare</echo>
771 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
772 </else>
773
774 </if>
775
776 </target>
777
778 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
779
780 <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
781 <!-- re-setup the server.xml file -->
782 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
783 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
784 <filterset>
785 <filter token="port" value="${tomcat.port}"/>
786 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
787 </filterset>
788 </copy>
789 <!-- set up the greenstone3 context -->
790 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
791 <filterset>
792 <filter token="gsdl3webhome" value="${web.home}"/>
793 </filterset>
794 </copy>
795 </target>
796
797 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
798 <!-- re-setup the server.xml file -->
799 <!-- need to edit the config file, or do we get the user to do this???-->
800 </target>
801
802 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
803 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
804 <property name="tomcat.path" refid="local.tomcat.path"/>
805 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
806 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
807 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
808 <env key="GSDL3HOME" value="${basedir}"/>
809 <env key="PATH" path="${tomcat.path}"/>
810 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
811 <env key="CATALINA_HOME" value="${catalina.home}"/>
812 <env key="CLASSPATH" path="${tomcat.classpath}"/>
813 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
814 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here??-->
815 <env key="WNHOME" path="${wn.home}"/>
816 </exec>
817 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
818 <env key="GSDLOS" value="windows"/>
819 <env key="GSDL3HOME" value="${basedir}"/>
820 <env key="Path" path="${tomcat.path}"/>
821 <env key="PATH" path="${tomcat.path}"/>
822 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
823 <env key="CATALINA_HOME" value="${catalina.home}"/>
824 <env key="CLASSPATH" path="${tomcat.classpath}"/>
825 </exec>
826 <!-- wait for the server to startup in case other targets need it running -->
827 <waitfor maxwait="5" maxwaitunit="second">
828 <and>
829 <socket server="${tomcat.server}" port="${tomcat.port}"/>
830 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
831 </and>
832 </waitfor>
833 </target>
834
835 <!-- windows: do we want to launch a webrowser?? -->
836 <!-- shouldn't this test whether anything is running first? -->
837 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
838 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
839 <env key="CATALINA_HOME" value="${catalina.home}"/>
840 </exec>
841 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
842 <env key="CATALINA_HOME" value="${catalina.home}"/>
843 </exec>
844 </target>
845
846 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
847
848 <target name="setup-catalina-ant-tasks">
849 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
850 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
851 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
852 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
853 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
854 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
855 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
856 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
857 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
858 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
859 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
860 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
861 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
862 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
863 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
864 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
865 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
866 </target>
867
868
869 <!-- ======================= ant Targets ============================ -->
870 <target name="prepare-ant" depends="init">
871 <if>
872 <bool>
873 <not><available file="${packages.home}/ant/.flagfile"/></not>
874 </bool>
875
876 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
877 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
878 usetimestamp="true"/>
879 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
880 dest="${packages.home}"/>
881 <move todir="${packages.home}/ant">
882 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
883 </move>
884 <echo file="${packages.home}/ant/.flagfile">
885 the timestamp of this file is the time that ant was extracted from the zip files.
886 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
887 </echo>
888
889 <else>
890 <echo>Ant has been prepared, will not prepare</echo>
891 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
892 </else>
893
894 </if>
895 </target>
896
897 <!-- ======================= Axis Targets ============================ -->
898
899 <target name="prepare-axis" depends="init">
900
901 <if>
902 <bool>
903 <not><available file="${packages.home}/axis/.flagfile"/></not>
904 </bool>
905
906 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
907 dest="${packages.home}/${axis.zip.version}"
908 usetimestamp="true"/>
909 <unzip src="${packages.home}/${axis.zip.version}"
910 dest="${packages.home}"/>
911 <move todir="${packages.home}/axis">
912 <fileset dir="${packages.home}/${axis.dir.version}"/>
913 </move>
914 <!-- install axis into greenstone web app -->
915 <copy todir="${web.lib}">
916 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
917 <include name="*.jar"/>
918 </fileset>
919 </copy>
920 <copy todir="${web.home}">
921 <fileset dir="${packages.home}/axis/webapps/axis/">
922 <include name="*.jsp"/>
923 <include name="*.jws"/>
924 </fileset>
925 </copy>
926 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
927 <copy todir="${web.classes}">
928 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
929 <include name="*.properties"/>
930 </fileset>
931 </copy>
932 <echo file="${packages.home}/axis/.flagfile">
933 the timestamp of this file is the time that axis was extracted from the zip files.
934 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
935 </echo>
936
937 <else>
938 <echo>Axis has been prepared, will not prepare</echo>
939 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
940 </else>
941
942 </if>
943 </target>
944
945 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
946 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
947
948 <target name="deploy-site">
949 <java classname="org.apache.axis.client.AdminClient">
950 <classpath refid="compile.classpath"/>
951 <arg value="-l"/>
952 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
953 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
954 </java>
955 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
956 </target>
957
958 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
959 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
960 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
961 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
962 tofile="${basedir}/resources/soap/undeploy.wsdd"
963 filtering="true"
964 overwrite="true"/>
965 <java classname="org.apache.axis.client.AdminClient">
966 <classpath refid="compile.classpath"/>
967 <arg value="-l"/>
968 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
969 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
970 </java>
971 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
972 </target>
973
974 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
975 with the default servicename of localsite-->
976 <target name="deploy-localsite" depends="init"
977 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
978 <antcall target="start-tomcat"/>
979 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
980 <antcall target="create-deployment-files">
981 <param name="axis.sitename" value="localsite"/>
982 <param name="axis.servicesname" value="${base.webservice.name}"/>
983 <param name="axis.siteuri" value="localsite"/>
984 </antcall>
985 <antcall target="deploy-site">
986 <param name="axis.sitename" value="localsite"/>
987 <param name="axis.servicesname" value="${base.webservice.name}"/>
988 <param name="axis.siteuri" value="localsite"/>
989 </antcall>
990 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
991 </target>
992
993 <target name="get-sitename" unless="axis.sitename">
994 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
995Press Enter for default:localsite</input>
996 </target>
997
998 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
999 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1000To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1001Or press Enter for undeploying the default:localsite /&gt;</input>
1002 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1003 </target>
1004
1005 <target name="get-webservices" unless="axis.servicesname">
1006 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1007Choose from: ${web.services.list}
1008Or press Enter for default:${base.webservice.name} /&gt;</input>
1009 <echo>${axis.servicesname}</echo>
1010 </target>
1011
1012 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1013 <input addproperty="axis.siteuri" defaultvalue="${axis.servicesname}${axis.sitename}">What name do you want the service to have? (Press Enter for default:${axis.servicesname}${axis.sitename})</input>
1014 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1015 </target>
1016
1017 <target name="set-soapmethod" description="Determines whether the service in the wsdd should have the style attribute set to message or the provider attribute set to java:RPC" if="axis.servicesname">
1018 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1019 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1020 </condition>
1021
1022 <!--everything else defaults to java:RPC at present-->
1023 <condition property="soap.method" value="provider='java:RPC'">
1024 <not>
1025 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1026 </not>
1027 </condition>
1028 </target>
1029
1030 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1031 <filter token="sitename" value="${axis.sitename}"/>
1032 <filter token="siteuri" value="${axis.siteuri}"/>
1033 <filter token="servicesname" value="${axis.servicesname}"/>
1034 <filter token="soapmethod" value="${soap.method}"/>
1035 <copy file="${basedir}/resources/soap/site.wsdd.template"
1036 tofile="${basedir}/resources/soap/deploy.wsdd"
1037 filtering="true"
1038 overwrite="true"/>
1039 <!-- create the java files and compile them -->
1040 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1041 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1042 filtering="true"
1043 overwrite="true"/>
1044 <mkdir dir="${build.home}"/>
1045 <javac srcdir="${src.home}"
1046 destdir="${build.home}"
1047 debug="${compile.debug}"
1048 deprecation="${compile.deprecation}"
1049 optimize="${compile.optimize}">
1050 <classpath refid="compile.classpath"/>
1051 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1052 </javac>
1053 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1054 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1055 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1056 overwrite="true" />
1057 </target>
1058
1059
1060 <!-- ====================== Core targets ============================== -->
1061 <!-- core targets refer to the core gsdl3 java src -->
1062
1063 <target name="prepare-core"/>
1064
1065 <target name="configure-core"/>
1066
1067 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1068 description="Update only the Greenstone core" />
1069
1070 <target name="svnupdate-core" unless="nosvn.mode">
1071 <svn>
1072 <update dir="." revision="${branch.revision}"/>
1073 </svn>
1074 </target>
1075
1076 <target name="clean-core"
1077 description="Clean only the Greenstone core">
1078 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1079 <delete dir="${build.home}"/>
1080 </target>
1081
1082 <target name="compile-core" depends="init"
1083 description="Compile only the Greenstone core">
1084 <mkdir dir="${build.home}"/>
1085 <javac srcdir="${src.home}"
1086 destdir="${build.home}"
1087 debug="${compile.debug}"
1088 deprecation="${compile.deprecation}"
1089 optimize="${compile.optimize}">
1090 <classpath>
1091 <path refid="compile.classpath"/>
1092 </classpath>
1093 </javac>
1094 <jar destfile="${build.home}/gsdl3.jar">
1095 <fileset dir="${build.home}">
1096 <include name="org/greenstone/gsdl3/**"/>
1097 <include name="org/flax/**"/>
1098 <exclude name="**/Test.class"/>
1099 </fileset>
1100 <manifest>
1101 <attribute name="Built-By" value="${user.name}" />
1102 </manifest>
1103 </jar>
1104 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1105 <!-- copy the localsite server in case we need it -->
1106 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1107
1108 <!-- Greenstone Administrator Interface -->
1109 <jar destfile="${build.home}/GAI.jar">
1110 <fileset dir="${build.home}">
1111 <include name="org/greenstone/admin/**"/>
1112 </fileset>
1113 <manifest>
1114 <attribute name="Built-By" value="${user.name}" />
1115 </manifest>
1116 </jar>
1117 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1118 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1119 <jar destfile="${build.home}/phind.jar">
1120 <fileset dir="${build.home}">
1121 <include name="org/greenstone/applet/phind/**"/>
1122 </fileset>
1123 <manifest>
1124 <attribute name="Built-By" value="${user.name}" />
1125 </manifest>
1126 </jar>
1127 <mkdir dir="${web.applet}"/>
1128 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1129 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1130 <if>
1131 <bool><istrue value="${tomcat.islocal}"/></bool>
1132 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1133 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1134 </if>
1135
1136
1137 <!-- skip anttasks for now
1138 <jar destfile="${build.home}/anttasks.jar">
1139 <fileset dir="${build.home}">
1140 <include name="org/greenstone/anttasks/**"/>
1141 </fileset>
1142 <manifest>
1143 <attribute name="Built-By" value="${user.name}" />
1144 </manifest>
1145 </jar>
1146 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1147 <jar destfile="${build.home}/gsdl3test.jar">
1148 <fileset dir="${build.home}">
1149 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1150 <include name="org/greenstone/testing/**"/>
1151 </fileset>
1152 <manifest>
1153 <attribute name="Built-By" value="${user.name}" />
1154 </manifest>
1155 </jar>
1156 <jar destfile="${build.home}/server.jar">
1157 <fileset dir="${build.home}">
1158 <include name="org/greenstone/server/**"/>
1159 </fileset>
1160 <fileset file="${basedir}/resources/java/server.properties"/>
1161 <manifest>
1162 <attribute name="Built-By" value="${user.name}"/>
1163 </manifest>
1164 </jar>
1165 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1166 </target>
1167
1168 <!-- ================== Packages targets ================================ -->
1169 <!-- these targets refer to the greenstone source packages - these need
1170 updating less often, so are in separate targets to the core -->
1171 <target name="prepare-packages" depends="init"/>
1172
1173 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1174 description="Update only the source packages"/>
1175
1176 <target name="svnupdate-packages" unless="nosvn.mode">
1177 <svn>
1178 <update dir="${src.packages.home}" revision="${branch.revision}"/>
1179 </svn>
1180 </target>
1181
1182
1183 <target name="configure-packages" depends="init,configure-javagdbm"
1184 description="Configure only the packages."/>
1185
1186 <target name="configure-javagdbm">
1187 <echo>
1188 Configuring JavaGDBM
1189 </echo>
1190
1191 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1192 <arg value="--prefix=${basedir}"/>
1193 <arg value="--libdir=${lib.jni}"/>
1194 <arg value="--with-gdbm=${gdbm.home}"/>
1195 </exec>
1196 </target>
1197
1198 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1199
1200 <target name="clean-javagdbm" depends="init">
1201 <exec executable="make" os="${os.unix}"
1202 dir="${javagdbm.home}" failonerror="true">
1203 <arg value="clean"/>
1204 </exec>
1205 </target>
1206
1207 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1208
1209 <target name="distclean-javagdbm" depends="init">
1210 <exec executable="make" os="${os.unix}"
1211 dir="${javagdbm.home}" failonerror="true">
1212 <arg value="distclean"/>
1213 </exec>
1214 </target>
1215
1216 <target name="compile-packages" description="Compile only the source packages">
1217
1218 <!-- unix: -->
1219 <echo>compile javagdbm</echo>
1220 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1221 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1222 <arg value="install"/>
1223 </exec>
1224
1225 <!-- windows: just the java stuff. -->
1226 <echo>Windows: compile javagdbm (java only)</echo>
1227 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1228 <arg value="compile"/>
1229 <arg value="javaonly"/>
1230 </exec>
1231
1232 <!-- install the jar file -->
1233 <echo>Install the javagdbm jar file</echo>
1234 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1235
1236
1237 <!-- Search4j -->
1238 <antcall target="compile-search4j"/>
1239 </target>
1240
1241 <target name="compile-search4j">
1242
1243 <!-- windows -->
1244 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1245 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1246 <arg value="/f"/>
1247 <arg value="win32.mak"/>
1248 <arg value='BINDIR="${basedir}\bin"'/>
1249 </exec>
1250 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1251 <arg value="/f"/>
1252 <arg value="win32.mak"/>
1253 <arg value="install"/>
1254 <arg value='BINDIR="${basedir}\bin"'/>
1255 </exec>
1256
1257 <!-- unix -->
1258 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1259 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1260 <arg value="--bindir=${basedir}/bin"/>
1261 <arg value="${static.arg}"/>
1262 </exec>
1263 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1264 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1265 <arg value="install"/>
1266 </exec>
1267
1268 <!-- else warn -->
1269 <else>
1270 <fail>this target does not support the current os</fail>
1271
1272 </else></if></else></if>
1273
1274 </target>
1275
1276 <target name="install-auxiliary-jar-files" depends="init">
1277 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1278 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1279 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>
1280 </target>
1281
1282 <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1283
1284 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1285 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1286 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1287 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1288 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1289 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1290 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1291 </target>
1292 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1293 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1294 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1295 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1296 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1297 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1298 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1299 </target>
1300 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1301 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1302 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1303 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1304 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1305 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1306 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1307 </target>
1308
1309 <!-- ========common-src targets =================================-->
1310 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1311 collection building is not enabled -->
1312
1313 <target name="update-common-src" depends="init" if="collection.building.disabled">
1314 </target>
1315
1316 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1317 <svn>
1318 <update dir="${common.src.home}" revision="${branch.revision}"/>
1319 </svn>
1320 </target>
1321
1322 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1323 <antcall target="checkout-common-src"/>
1324 <antcall target="unzip-windows-packages"/>
1325 </target>
1326
1327 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1328 <echo>checking out common-src</echo>
1329 <svn>
1330 <checkout url="${svn.root}/gsdl/trunk/common-src" destPath="common-src" revision="${branch.revision}"/>
1331 </svn>
1332 </target>
1333
1334 <target name="configure-common-src" depends="init">
1335 <exec executable="${common.src.home}/configure" os="${os.unix}"
1336 dir="${common.src.home}" failonerror="true">
1337 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1338 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1339 <arg line="${static.arg}"/>
1340 </exec>
1341 </target>
1342
1343 <target name="clean-common-src" depends="init">
1344 <!-- unix: -->
1345 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1346 <arg value="clean"/>
1347 </exec>
1348 <!-- windows: -->
1349 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1350 <arg value="/f"/>
1351 <arg value="win32.mak"/>
1352 <arg value="clean"/>
1353 <arg value="GSDLHOME=${gs2build.home}"/>
1354 </exec>
1355 </target>
1356 <target name="distclean-common-src" depends="init">
1357 <!-- unix: -->
1358 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1359 <arg value="distclean"/>
1360 </exec>
1361 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1362 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1363 <arg value="/f"/>
1364 <arg value="win32.mak"/>
1365 <arg value="clean"/>
1366 <arg value="GSDLHOME=${gs2build.home}"/>
1367 </exec>
1368 </target>
1369 <target name="compile-common-src" depends="init">
1370 <!-- unix: -->
1371 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1372 </exec>
1373 <!-- windows: -->
1374 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1375 <arg value="/f"/>
1376 <arg value="win32.mak"/>
1377 <arg value="GSDLHOME=${gs2build.home}"/>
1378 </exec>
1379 </target>
1380
1381 <!-- ======= collection-building targets ===========================-->
1382
1383 <target name="update-collection-building" if="collection.building.enabled"
1384 depends="init,svnupdate-collection-building,gs2build-edit-setup-bat,configure-common-src,clean-common-src,compile-common-src,configure-collection-building,clean-collection-building,compile-collection-building"
1385 description="Update (SVN update, configure, compile etc) only the collection building components"/>
1386
1387 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1388 description="SVN update the collection building components">
1389 </target>
1390
1391 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1392 </target>
1393
1394 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1395 description="Configure the collection building components">
1396 </target>
1397
1398 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1399 description="Clean only the collection building components"
1400 if="collection.building.enabled"/>
1401
1402 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1403 description="Distclean only the collection building components"
1404 if="collection.building.enabled"/>
1405
1406 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1407 description="Compile only the collection building components">
1408 <!-- make install for common-src -->
1409 <!-- unix: -->
1410 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1411 <arg value="install"/>
1412 </exec>
1413
1414 <!-- windows: -->
1415 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1416 <arg value="/f"/>
1417 <arg value="win32.mak"/>
1418 <arg value="install"/>
1419 </exec>
1420
1421 <!-- install gs2build indexers for windows -->
1422 <if>
1423 <bool><istrue value="${current.os.iswindows}"/></bool>
1424 <copy todir="${gs2build.home}/bin/windows">
1425 <fileset dir="${gs2build.home}/common-src/indexers/bin">
1426 <include name="*.*"/>
1427 </fileset>
1428 </copy>
1429 </if>
1430
1431 <!-- LuceneWrapper jar file not installed by default -->
1432 <mkdir dir="${gs2build.home}/bin/java"/>
1433 <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1434
1435 </target>
1436
1437 <!-- ============== gli targets ================================= -->
1438 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1439 <svn>
1440 <update dir="${gli.home}" revision="${branch.revision}"/>
1441
1442 <!-- some files from cgi-bin: necessary for remote GLI server -->
1443 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gliserver.pl" destPath="${web.home}/WEB-INF/cgi/gliserver.pl" revision="${branch.revision}"/>
1444 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gsdlCGI.pm" destPath="${web.home}/WEB-INF/cgi/gsdlCGI.pm" revision="${branch.revision}"/>
1445 </svn>
1446 </target>
1447
1448 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1449 <!-- checkout -->
1450 <if><bool><not><istrue value="${nosvn.mode}"/></not></bool>
1451 <svn>
1452 <checkout url="${svn.root}/gli/${branch.path}" destPath="gli" revision="${branch.revision}"/>
1453
1454 <!-- some files from cgi-bin: necessary for remote GLI server -->
1455 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gliserver.pl" destPath="${web.home}/WEB-INF/cgi/gliserver.pl" revision="${branch.revision}"/>
1456 <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gsdlCGI.pm" destPath="${web.home}/WEB-INF/cgi/gsdlCGI.pm" revision="${branch.revision}"/>
1457 </svn>
1458 </if>
1459 </target>
1460
1461 <target name="clean-gli" depends="init" if="collection.building.enabled">
1462 <!-- gli -->
1463 <property name="gli.home" value="${basedir}/gli"/>
1464 <!-- linux -->
1465 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1466 resolveExecutable="true"/>
1467 <!-- windows -->
1468 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1469 resolveExecutable="true"/>
1470 </target>
1471
1472 <target name="compile-gli" depends="init" if="collection.building.enabled">
1473 <!-- gli -->
1474 <property name="gli.home" value="${basedir}/gli"/>
1475
1476 <!-- linux -->
1477 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1478 <!--remote gli-->
1479 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1480 resolveExecutable="true"/>
1481 <!-- windows -->
1482 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1483 <!--remote gli-->
1484 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1485 resolveExecutable="true"/>
1486 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1487 </target>
1488
1489 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1490 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1491 <env key="gsdl3path" path="${basedir}"/>
1492 <env key="gsdlpath" path="${gs2build.home}"/>
1493 </exec>
1494 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1495 <env key="gsdl3path" path="${basedir}"/>
1496 <env key="gsdlpath" path="${gs2build.home}"/>
1497 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
1498 </exec>
1499 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1500 <env key="GSDL3PATH" path="${basedir}"/>
1501 <env key="GSDLPATH" path="${gs2build.home}"/>
1502 </exec>
1503 <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 gli.sh/bat from the greenstone3/gli directory.
1504 </echo>
1505 </target>
1506
1507 <!-- ================ gs2build targets =========================== -->
1508
1509 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1510 <echo>svn updating gs2build</echo>
1511 <svn>
1512 <update dir="{gs2build.home}" revision="${branch.revision}"/>
1513 </svn>
1514 </target>
1515
1516 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1517 <antcall target="checkout-gs2build"/>
1518 <antcall target="unzip-windows-packages"/>
1519 <antcall target="checkout-winbin"/>
1520 <antcall target="get-windows-binaries"/>
1521 <antcall target="delete-winbin"/>
1522 </target>
1523
1524 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1525 <echo>checking out gs2build</echo>
1526 <svn>
1527 <checkout url="${svn.root}/gs2build" destPath="gs2build" revision="${branch.revision}"/>
1528 </svn>
1529 </target>
1530
1531 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1532 unless="nosvn.mode">
1533 <svn>
1534 <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin" revision="${branch.revision}"/>
1535 </svn>
1536 </target>
1537
1538 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1539 <svn>
1540 <update dir="winbin" revision="${branch.revision}"/>
1541 </svn>
1542 </target>
1543
1544 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1545 <move todir="${gs2build.home}/bin/windows" failonerror="false">
1546 <fileset dir="${basedir}/winbin/bin"/>
1547 </move>
1548 </target>
1549
1550 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1551 <delete dir="${basedir}/winbin"/>
1552 </target>
1553
1554 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
1555 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
1556 dest="${common.src.home}/packages/windows/crypt"/>
1557 <unzip src="${common.src.home}/packages/windows/expat/expat.zip"
1558 dest="${common.src.home}/packages/windows/expat"/>
1559 <untar compression="gzip"
1560 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
1561 dest="${common.src.home}/packages/sqlite"/>
1562 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
1563 dest="${common.src.home}/indexers/packages/windows/iconv"/>
1564 </target>
1565
1566 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1567 <!-- we want a windows path in the setup.bat file -->
1568 <pathconvert targetos="windows" property="gs2build.home.windows">
1569 <path path="${gs2build.home}"/>
1570 </pathconvert>
1571 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1572 <filterset>
1573 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1574 </filterset>
1575 </move>
1576 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1577 </target>
1578
1579
1580 <target name="clean-build-src" depends="init" if="collection.building.enabled">
1581 <!-- unix: -->
1582 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1583 <arg value="clean"/>
1584 </exec>
1585 <!-- windows: -->
1586 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1587 <arg value="/f"/>
1588 <arg value="win32.mak"/>
1589 <arg value="clean"/>
1590 <arg value="GSDLHOME=${gs2build.home}"/>
1591 </exec>
1592 </target>
1593
1594
1595 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
1596 <!-- unix: -->
1597 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1598 <arg value="distclean"/>
1599 </exec>
1600 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
1601 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1602 <arg value="/f"/>
1603 <arg value="win32.mak"/>
1604 <arg value="clean"/>
1605 <arg value="GSDLHOME=${gs2build.home}"/>
1606 </exec>
1607 </target>
1608
1609 <target name="configure-build-src" depends="init" if="collection.building.enabled"
1610 description="Configure the build-src component">
1611 <exec executable="${build.src.home}/configure" os="${os.unix}"
1612 dir="${build.src.home}" failonerror="true">
1613 <arg value="--prefix=${gs2build.home}"/>
1614 <arg line="${static.arg}"/>
1615 </exec>
1616 </target>
1617
1618 <!-- common-src is done separately and needs to be compiled first -->
1619 <target name="compile-build-src" depends="init" if="collection.building.enabled">
1620
1621 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true"/>
1622 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
1623 <arg value="install"/>
1624 </exec>
1625
1626 <!-- run the setup script -->
1627 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>-->
1628 <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant-->
1629 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1630 <arg value="/f"/>
1631 <arg value="win32.mak"/>
1632 <arg value="GSDLHOME=${gs2build.home}"/>
1633 </exec>
1634 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1635 <arg value="/f"/>
1636 <arg value="win32.mak"/>
1637 <arg value="install"/>
1638 <arg value="GSDLHOME=${gs2build.home}"/>
1639 </exec>
1640 </target>
1641
1642
1643 <!-- ======================== TESTING Targets ========================= -->
1644
1645 <target name="test" description="Run the (incomplete) JUnit test suite "
1646 depends="init">
1647 <mkdir dir="${basedir}/test"/>
1648 <junit printsummary="withOutAndErr"
1649 errorproperty="test.failed"
1650 failureproperty="test.failed"
1651 fork="${junit.fork}">
1652 <formatter type="plain"/>
1653 <classpath>
1654 <pathelement location="${build.home}/gsdl3test.jar"/>
1655 <path refid="compile.classpath"/>
1656 </classpath>
1657 <test name="${testcase}" if="testcase"/>
1658 <batchtest todir="${basedir}/test" unless="testcase">
1659 <fileset dir="${build.home}" includes="**/*Test.class" />
1660 </batchtest>
1661 </junit>
1662 <echo>
1663 *********************************************
1664 Test output can be found in directory 'test'
1665 *********************************************
1666 </echo>
1667 </target>
1668
1669 <!-- ======================== FLAX Targets ========================= -->
1670 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
1671 <echo>checking out flax ...</echo>
1672 <mkdir dir="${basedir}/src/java/org/flax"/>
1673 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1674 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
1675 <mkdir dir="${web.home}/interfaces/flax"/>
1676 <mkdir dir="${web.home}/sites/flax"/>
1677 <mkdir dir="${basedir}/flax-resources"/>
1678 <mkdir dir="${basedir}/flax-lib"/>
1679 <svn>
1680 <checkout url="${flax.checkout.path}/src/java/org/flax/"
1681 destPath="${basedir}/src/java/org/flax"/>
1682 <checkout url="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax/"
1683 destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1684 <checkout url="${flax.checkout.path}/web/WEB-INF/classes/flax/"
1685 destPath="${web.home}/WEB-INF/classes/flax"/>
1686 <checkout url="${flax.checkout.path}/web/interfaces/flax/"
1687 destPath="${web.home}/interfaces/flax"/>
1688 <checkout url="${flax.checkout.path}/web/sites/flax/"
1689 destPath="${web.home}/sites/flax"/>
1690 <checkout url="${flax.checkout.path}/flax-resources"
1691 destPath="${basedir}/flax-resources"/>
1692 <checkout url="${flax.checkout.path}/lib"
1693 destPath="${basedir}/flax-lib"/>
1694 </svn>
1695 <echo>prepare flax files...</echo>
1696 <move file="${web.home}/WEB-INF/web.xml" tofile="${web.home}/WEB-INF/web.xml.greenstone3backup"/>
1697 <antcall target="flax-copy-files" />
1698 <antcall target="unzip-flax-resources" />
1699 </target>
1700
1701 <target name="update-flax" description="update flax from repository">
1702 <echo>updating flax ...</echo>
1703 <svn>
1704 <update dir="${basedir}/src/java/org/flax"/>
1705 <update dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1706 <update dir="${web.home}/WEB-INF/classes/flax"/>
1707 <update dir="${web.home}/interfaces/flax"/>
1708 <update dir="${web.home}/sites/flax"/>
1709 </svn>
1710 <antcall target="flax-copy-files" />
1711 </target>
1712
1713 <target name="unzip-flax-resources" >
1714 <property name="classes.dir" value="${web.home}/WEB-INF/classes/flax"/>
1715 <unzip dest="${classes.dir}">
1716 <fileset dir="${classes.dir}">
1717 <include name="*.zip"/>
1718 </fileset>
1719 </unzip>
1720 <delete>
1721 <fileset dir="${classes.dir}" includes="*.zip"/>
1722 </delete>
1723 </target>
1724
1725 <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
1726 <echo>copying flax files ...</echo>
1727 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
1728 <!-- A configuration file containing web service binding information for the axis engine -->
1729 <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
1730 <copy file="${basedir}/flax-resources/flax-build.xml" todir="${basedir}" overwrite="true" />
1731 <copy file="${basedir}/flax-lib/opennlp-tools-1.3.0.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />
1732 </target>
1733
1734
1735
1736
1737 <target name="compile-javadocs">
1738 <javadoc packagenames="org.greenstone.*"
1739 sourcepath="src/java"
1740 defaultexcludes="yes"
1741 destdir="docs/javadoc"
1742 author="true"
1743 version="true"
1744 use="true"
1745 windowtitle="Greenstone3 API">
1746 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
1747 </javadoc>
1748 </target>
1749
1750<!-- ========== Some distribution targets ======================== -->
1751 <target name="remove-source">
1752 <delete includeEmptyDirs="true">
1753 <fileset dir="." defaultexcludes="false">
1754 <patternset refid="greenstone3.source.component"/>
1755 </fileset>
1756 </delete>
1757 </target>
1758
1759 <target name="dist-tidy"
1760 description="'tidies-up' a greenstone3 installation for distribution.">
1761
1762 <!-- delete unneeded things -->
1763 <delete dir="${packages.home}/axis"/>
1764 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
1765 <delete file="README-SVN.txt"/>
1766 <delete file="build.properties.in"/>
1767
1768 <!-- delete source files -->
1769 <antcall target="remove-source"/>
1770
1771 <!-- create empty directories -->
1772 <mkdir dir="${web.home}/applet"/>
1773 <mkdir dir="${web.home}/logs"/>
1774
1775 <!-- os specific tidy-ups -->
1776 <!-- linux, mac -->
1777 <if><bool><istrue value="${current.os.isunix}"/></bool>
1778 <delete><fileset dir="." includes="*.bat"/></delete>
1779 <delete><fileset dir="gli" includes="*.bat"/></delete>
1780 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
1781 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
1782 <delete file="${basedir}/gs2build/win32cfg.h"/>
1783 <delete file="${basedir}/gs2build/win32.mak"/>
1784 <delete dir="${basedir}/winutil"/>
1785 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
1786
1787 <!-- windows -->
1788 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
1789 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
1790 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
1791 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
1792 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
1793 </if></else></if>
1794
1795 </target>
1796
1797 <!-- fix up executable permissions for binary release -->
1798 <target name="fix-execute-permissions">
1799 <echo>Setting binaries to executable</echo>
1800 <chmod perm="775">
1801 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
1802 </chmod>
1803 </target>
1804
1805 <!-- fix up executable permissions for source code release -->
1806 <target name="fix-execute-permissions-source">
1807 <chmod perm="775">
1808 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
1809 </chmod>
1810 </target>
1811
1812
1813 <!-- ============= tweaks for making compilation static ========== -->
1814 <target name="tweak-makefiles" depends="init" if="compile.static">
1815 <antcall target="rtftohtml-add-static" />
1816 </target>
1817
1818 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
1819 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
1820 </target>
1821
1822</project>
Note: See TracBrowser for help on using the repository browser.