root/main/trunk/release-kits/kits/rk3/ant-scripts/compile.xml @ 29393

Revision 29393, 14.1 KB (checked in by sjm84, 5 years ago)

Related to commit 29387. Changes to allow the release-kits to preserve the source code, to better enable debugging of differences in the release-kits. Tested with GS3 on the 32 bit linux: without setting the new KEEP_SRC env var in bin/rk, it still removes the src code as before and produces a binary of the same size as before. With the KEEP_SRC env var set to true in bin/rk, src code (gs2build/common-src, gli/src and GS3/src) is preserved. Untested on Windows or with gs2 since the gs2 binary generation on linux 32 is not working at present.

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="rk3-compile">
3
4    <target name="compile">
5
6        <!-- checkout greenstone3 -->
7        <exec executable="svn">
8            <arg value="checkout"/>
9            <arg value="${svn.root}/main/${branch.path}/greenstone3"/>
10            <arg value="compiled"/>
11            <arg value="-r"/><arg value="${branch.revision}"/>
12        </exec>
13
14        <if><bool><equals arg1="${with.jni}" arg2="false"/></bool>
15            <rsr file="${basedir}/compiled/build.properties.in" pattern="with.jni=true" replacement="#with.jni=true"/>
16        </if>
17
18        <if><bool><equals arg1="${with.gli.and.gems}" arg2="false"/></bool>
19            <rsr file="${basedir}/compiled/build.properties.in" pattern="with.gli.and.gems=true" replacement="#with.gli.and.gems=true"/>
20        </if>
21
22        <!-- make sure all c++ compilation is done statically on linux -->
23        <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
24            <property name="forward.compile.static" value="true"/>
25        </if>
26
27        <!-- make sure the c++ compilation can see the support library in the extension folder -->
28        <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
29            <property name="forward.use.gnomelib.ext" value="true"/>
30        </if>
31
32        <antcall target="persist-forwarded-properties">
33            <param name="greenstone3basedir" value="compiled"/>
34        </antcall>
35
36        <!-- run greenstone3's ant prepare -->
37        <ant dir="compiled" inheritAll="false">
38            <target name="prepare"/>
39            <propertyset refid="forward.properties"/>
40            <property name="properties.accepted" value="true"/>
41        </ant>
42
43        <!-- set all version numbers -->
44        <antcall target="greenstone3-set-version-numbers"><param name="greenstone3basedir" value="compiled"/></antcall>
45        <antcall target="gli-set-version-numbers"><param name="glibasedir" value="compiled/gli"/></antcall>
46        <antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="compiled/gs2build"/></antcall>
47
48        <!-- mac or linux: compile the support library -->
49        <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
50            <!-- checkout the gnome support library extension-->
51
52            <!-- For Lions, need a specific gnome-lib-minimal tar file. The file name contains darwin12 for Lion, it contains the os.shell name (darwin/linux) for other cases.
53            Mac OS X v10.7.4 onwards is Lion/Mountain Lion, different from Leopard/Snow Leopard. See http://en.wikipedia.org/wiki/Darwin_(operating_system) -->
54            <condition property="specific.os.type" value="${os.shell}-Lion" else="${os.shell}">
55                <and>
56                    <contains string="${os.shell}" substring="darwin" casesensitive="false"/>
57                    <matches pattern="^(10\.7\.[4-9]|10\.[8-9]|1[1-9]|[2-9])" string="${os.version}"/>
58                </and>
59            </condition>
60
61            <if><bool><or>
62                <equals arg1="${post.2.83.version}" arg2="true"/>
63            </or></bool>
64                <echo>EXPORTING GNOME LIB EXTENSION</echo>
65                <exec executable="svn">
66                    <arg value="export"/>
67                    <arg value="${svn.root}/gs2-extensions/gnome-lib/trunk/gnome-lib-minimal-${specific.os.type}${arch}${extension-x64}.tar.gz"/>
68                    <arg value="${basedir}/compiled/ext/gnome-lib-${specific.os.type}.tar.gz"/>
69                </exec>
70
71                <exec executable="tar" dir="${basedir}/compiled/ext">
72                    <arg value="xvzf"/>
73                    <arg value="gnome-lib-${specific.os.type}.tar.gz"/>
74                </exec>
75
76                <exec executable="/bin/bash" dir="${basedir}/compiled/ext/gnome-lib-minimal">
77                    <arg value="-c"/>
78                    <arg value="source setup.bash_old &amp;&amp; source devel.bash"/>
79                </exec>
80                <echo>DONE COMPILING GNOME LIB EXTENSION</echo>
81            </if>
82        </if>
83
84        <!-- run greenstone3's ant install and ant dist-tidy -->
85        <ant dir="compiled" inheritAll="false">
86            <target name="install"/>
87            <target name="dist-tidy"/>
88            <propertyset refid="forward.properties"/>
89            <property name="properties.accepted" value="true"/>
90            <property name="properties.keep.src" value="${keep.src}"/>
91        </ant>
92
93        <!-- Delete all collections apart from the Lucene demo collection -->
94        <delete dir="${basedir}/compiled/web/sites/localsite/collect/gberg"/>
95        <delete dir="${basedir}/compiled/web/sites/localsite/collect/gs2mgdemo"/>
96        <delete dir="${basedir}/compiled/web/sites/localsite/collect/gs2mgppdemo"/>
97        <delete dir="${basedir}/compiled/web/sites/localsite/collect/infomine"/>       
98
99        <!-- Delete the entire gnome support library on Linux -->
100        <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
101            <delete dir="${basedir}/compiled/ext/gnome-lib-minimal"/>
102            <delete file="${basedir}/compiled/ext/gnome-lib-linux.tar.gz"/>
103        </if>
104
105        <!-- Delete all but the lib folder of the gnome support library on Mac,
106             then move this smaller gnome-lib-minimal dir from the top-level ext folder
107             to gs2build/ext, since wvware on mac needs gnome-lib-minimal -->
108        <if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
109            <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/cascade-make"/>
110            <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/packages"/>
111            <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/darwin/bin"/>
112            <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/darwin/etc"/>
113            <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/darwin/include"/>
114            <delete dir="${basedir}/compiled/ext/gnome-lib-minimal/darwin/share"/>
115            <delete file="${basedir}/compiled/ext/gnome-lib-minimal/setup.bat"/>
116            <delete file="${basedir}/compiled/ext/gnome-lib-minimal/CASCADE-MAKE.sh"/>
117            <delete file="${basedir}/compiled/ext/gnome-lib-darwin.tar.gz"/>
118            <move file="${basedir}/compiled/ext/gnome-lib-minimal" todir="compiled/gs2build/ext"/>
119        </if>
120       
121        <!-- Delete Lucene 3.3 specific ext/solr folders, since we've switched over to Lucene 4.7.2 -->
122        <delete dir="${basedir}/compiled/ext/solr/lib3" />
123        <delete dir="${basedir}/compiled/ext/solr/conf3" />
124        <delete dir="${basedir}/compiled/ext/solr/etc3" />
125
126         
127        <if><bool><and>
128              <equals arg1="${rk.os}" arg2="linux"/>
129              <equals arg1="${extension-x64}" arg2="-x64"/>
130          </and></bool>
131          <property name="bitness" value="64"/>
132          <else>
133            <property name="bitness" value="32"/>
134          </else>
135        </if>
136
137        <!-- insert an xml parser (matched to the version of Perl being used by the release kit).
138             For Linux 64 bit, use the 64 bit versions.
139             For other *nix cases, including Macs, we stick to the 32 bit
140             versions since there have been no problems yet, probably
141             because our Mac has 5.12 which is not included in
142             XML-Parser so that our mac then tries to find the xml
143             parser on the system.-->
144        <if><bool><not><equals arg1="${rk.os}" arg2="windows"/></not></bool>     
145            <copy todir="compiled/gs2build/perllib/cpan">
146                <fileset dir="${rk.home}/shared/linux/XML-Parser" includes="${bitness}-bit/**/*"/>
147            </copy>
148            <move file="compiled/gs2build/perllib/cpan/${bitness}-bit" tofile="compiled/gs2build/perllib/cpan/XML-Parser"/>
149        </if>
150           
151        <!-- insert ant -->
152        <property name="insert.ant.version" value="1.8.2"/>
153        <mkdir dir="compiled/packages"/>
154        <get src="http://www.greenstone.org/gs3files/apache-ant-${insert.ant.version}-bin.tar.gz" dest="compiled/packages/apache-ant-${insert.ant.version}-bin.tar.gz"/>
155        <untar src="compiled/packages/apache-ant-${insert.ant.version}-bin.tar.gz" dest="compiled/packages/" compression="gzip"/>
156        <move file="compiled/packages/apache-ant-${insert.ant.version}" tofile="compiled/packages/ant"/>
157        <delete file="compiled/packages/apache-ant-${insert.ant.version}-bin.tar.gz"/>
158
159        <!-- put the uninstaller in place -->
160        <antcall target="insert-and-compile-uninstaller"/>
161
162        <!-- (windows only) -->
163        <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
164            <!-- insert perl -->
165            <unzip src="${rk.home}/shared/windows/perl.zip" dest="compiled/gs2build/bin/windows"/>
166        </if>
167
168        <!-- minify tomcat -->
169        <delete dir="compiled/packages/tomcat/webapps/docs"/>
170        <delete dir="compiled/packages/tomcat/webapps/examples"/>
171
172        <!-- tidy up gli to make it smaller -->
173        <antcall target="gli-tidy-for-dist"><param name="glibasedir" value="compiled/gli"/></antcall>
174
175        <!-- strip out .svn dirs -->
176        <antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
177
178        <!-- get rid of bin/formatconverter on windows and get rid of bin/formatconverter.exe on linux/mac. Now we have specific OS dirs, so get rid of the irrelevant OS dirs instead -->
179        <if>
180            <bool><equals arg1="${rk.os}" arg2="windows"/></bool>
181                <delete dir="compiled/bin/darwin"/>
182                <delete dir="compiled/bin/linux"/>
183            <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
184                <delete dir="compiled/bin/windows"/>
185                <delete dir="compiled/bin/linux"/>
186            <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
187                <delete dir="compiled/bin/windows"/>
188                <delete dir="compiled/bin/darwin"/>
189            </if></else>
190            </if></else>
191        </if>       
192       
193        <!-- (linux only) -->
194        <if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
195            <!-- grab imagemagick binaries -->
196            <delete dir="compiled/gs2build/bin/linux/imagemagick"/>
197
198            <exec executable="svn">
199               <arg value="export"/>
200               <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/imagemagick-linux${extension-x64}.tar.gz"/>
201               <arg value="compiled/ext/imagemagick-linux${extension-x64}.tar.gz"/>
202            </exec>
203
204            <exec executable="tar" dir="compiled/ext">
205               <arg value="xvzf"/>
206               <arg value="imagemagick-linux${extension-x64}.tar.gz"/>
207            </exec>
208            <delete file="compiled/ext/imagemagick-linux${extension-x64}.tar.gz"/>
209            <move todir="compiled/gs2build/bin/linux/imagemagick">
210               <fileset dir="compiled/ext/imagemagick/linux"/>
211            </move>
212            <delete dir="compiled/ext/imagemagick"/>
213
214            <!--<delete dir="compiled/gs2build/bin/linux/imagemagick"/>
215            <exec executable="svn">
216                <arg value="export"/>
217                <arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
218                <arg value="compiled/gs2build/bin/linux/imagemagick"/>
219            </exec>-->
220
221            <!-- grab wv binaries -->
222            <delete dir="compiled/gs2build/bin/linux/wv"/>
223            <exec executable="svn">
224                <arg value="export"/>
225                <arg value="${svn.root}/main/${branch.path}/binaries/linux/wv"/>
226                <arg value="compiled/gs2build/bin/linux/wv"/>
227            </exec>
228        <!-- (mac only) -->
229        <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
230            <!-- grab imagemagick binaries -->
231
232            <delete dir="compiled/gs2build/bin/darwin/imagemagick"/>
233
234            <!--<exec executable="svn">
235               <arg value="export"/>
236               <arg value="${svn.root}/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.5.tar.gz"/>
237               <arg value="compiled/ext/imagemagick-darwin-10.5.tar.gz"/>
238            </exec>
239
240            <exec executable="tar" dir="compiled/ext">
241               <arg value="xvzf"/>
242               <arg value="imagemagick-darwin-10.5.tar.gz"/>
243            </exec>
244            <delete file="compiled/ext/imagemagick-darwin-10.5.tar.gz"/>
245            <move todir="compiled/gs2build/bin/darwin/imagemagick">
246               <fileset dir="compiled/ext/imagemagick/darwin"/>
247            </move>
248            <delete dir="compiled/ext/imagemagick"/>-->
249
250            <delete dir="compiled/gs2build/bin/darwin/imagemagick"/>
251            <exec executable="svn">
252                <arg value="export"/>
253                <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/imagemagick"/>
254                <arg value="compiled/gs2build/bin/darwin/imagemagick"/>
255            </exec>
256
257            <if><bool><not><equals arg1="${forward.install.flax}" arg2="true"/></not></bool>
258                <!-- grab ghostscript binaries -->
259                <delete dir="compiled/gs2build/bin/darwin/ghostscript"/>
260                <exec executable="svn">
261                    <arg value="export"/>
262                    <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/ghostscript"/>
263                    <arg value="compiled/gs2build/bin/darwin/ghostscript"/>
264                </exec>
265            </if>
266        </if></else></if>
267
268        <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
269            <exec dir="${basedir}/compiled" executable="${basedir}/compiled/gs2build/bin/windows/perl/bin/perl">
270                <arg line="-S"/>
271                <arg line="gs2build/bin/script/import.pl -removeold -site localsite lucene-jdbm-demo"/>
272                <env key="GSDLHOME" path="${basedir}/compiled/gs2build"/>
273                <env key="GSDL3HOME" path="${basedir}/compiled/web"/>
274                <env key="GSDL3SRCHOME" path="${basedir}/compiled"/>
275                <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/web/sites/localsite/collect"/>
276                <env key="GSDLOS" value="windows"/>
277                <env key="PATH" path="${basedir}/compiled/gs2build/bin/windows/perl/bin;${basedir}/compiled/gs2build/bin/windows;${basedir}/compiled/gs2build/bin/script;${env.PATH}"/>
278            </exec>
279            <exec dir="${basedir}/compiled" executable="${basedir}/compiled/gs2build/bin/windows/perl/bin/perl">
280                <arg line="-S"/>
281                <arg line="gs2build/bin/script/buildcol.pl -removeold -site localsite lucene-jdbm-demo"/>
282                <env key="GSDLHOME" path="${basedir}/compiled/gs2build"/>
283                <env key="GSDL3HOME" path="${basedir}/compiled/web"/>
284                <env key="GSDL3SRCHOME" path="${basedir}/compiled"/>
285                <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/web/sites/localsite/collect"/>
286                <env key="GSDLOS" value="windows"/>
287                <env key="PATH" path="${basedir}/compiled/gs2build/bin/windows/perl/bin;${basedir}/compiled/gs2build/bin/windows;${basedir}/compiled/gs2build/bin/script;${env.PATH}"/>
288            </exec>
289            <delete dir="${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/index"/>
290            <move file="${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/building" tofile="${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/index"/>
291        <else>
292            <echo file="${basedir}/compiled/buildscript.sh">
293                #!/bin/bash
294                source gs3-setup.sh
295                /usr/bin/perl -S ${basedir}/compiled/gs2build/bin/script/import.pl -site localsite lucene-jdbm-demo
296                /usr/bin/perl -S ${basedir}/compiled/gs2build/bin/script/buildcol.pl -site localsite lucene-jdbm-demo
297                rm -rf ${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/index
298                mv ${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/building ${basedir}/compiled/web/sites/localsite/collect/lucene-jdbm-demo/index
299            </echo>
300            <chmod perm="775" file="${basedir}/compiled/buildscript.sh"/>
301            <exec dir="${basedir}/compiled" executable="/bin/bash">
302                <arg line="buildscript.sh"/>
303            </exec>
304            <delete file="${basedir}/compiled/buildscript.sh"/>
305        </else>
306        </if>
307       
308    </target>
309
310</project>
Note: See TracBrowser for help on using the browser.