source: main/trunk/release-kits/kits/rk2/ant-scripts/compile.xml@ 21725

Last change on this file since 21725 was 21725, checked in by oranfry, 12 years ago

got rk2 and rk3 going on mac

File size: 12.2 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="rk2-compile">
3
4 <target name="compile" depends="init,gs2-init">
5
6 <!-- checkout gsdl and gli -->
7 <exec executable="svn">
8 <arg value="checkout"/>
9 <arg value="${svn.root}/main/${branch.path}/greenstone2"/>
10 <arg value="${basedir}/compiled"/>
11 </exec>
12 <exec executable="svn">
13 <arg value="checkout"/>
14 <arg value="${svn.root}/main/${branch.path}/gli"/>
15 <arg value="${basedir}/compiled/gli"/>
16 </exec>
17
18 <!-- drop in documentation -->
19 <copy todir="compiled" overwrite="true">
20 <fileset dir="${rk.home}/shared/greenstone2/docs" excludes="READMEar.txt,READMEes.txt,READMEfr.txt,READMEru.txt"/>
21 </copy>
22
23 <!-- set version numbers -->
24 <antcall target="gsdl-set-version-numbers"><param name="gsdl.basedir" value="${basedir}/compiled"/></antcall>
25 <antcall target="gli-set-version-numbers"><param name="glibasedir" value="${basedir}/compiled/gli"/></antcall>
26
27 <!-- windows only -->
28 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
29
30 <!-- unzip packages -->
31 <unzip src="${basedir}/compiled/common-src/packages/windows/crypt/crypt.zip" dest="${basedir}/compiled/common-src/packages/windows/crypt"/>
32 <unzip src="${basedir}/compiled/common-src/packages/windows/expat/expat.zip" dest="${basedir}/compiled/common-src/packages/windows/expat"/>
33 <unzip src="${basedir}/compiled/common-src/packages/windows/stlport/stlport.zip" dest="${basedir}/compiled/common-src/packages/windows/stlport"/>
34 <unzip src="${basedir}/compiled/common-src/indexers/packages/windows/iconv/iconv.zip" dest="${basedir}/compiled/common-src/indexers/packages/windows/iconv"/>
35 <untar src="${basedir}/compiled/common-src/packages/sqlite/sqlite-amalgamation-3.5.9.tar.gz" dest="${basedir}/compiled/common-src/packages/sqlite" compression="gzip"/>
36
37 <!-- get winbin -->
38 <if><bool><not><available file="${basedir}/compiled/bin/windows"/></not></bool>
39 <exec executable="svn">
40 <arg value="export"/>
41 <arg value="${svn.root}/main/${branch.path}/binaries/windows/bin"/>
42 <arg value="${basedir}/compiled/bin/windows"/>
43 <arg value="-r"/><arg value="${branch.revision}"/>
44 </exec>
45 </if>
46
47 <!-- insert windows perl -->
48 <unzip src="${rk.home}/shared/windows/perl.zip" dest="compiled/bin/windows"/>
49
50 <!-- compile c code -->
51 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="clean"/></exec>
52 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="APACHE_HTTPD=1"/></exec>
53 <exec dir="${basedir}/compiled" executable="nmake"><arg value="/f"/><arg value="win32.mak"/><arg value="LOCAL_LIBRARY=1"/></exec>
54 <mkdir dir="products"/>
55 <copy file="${basedir}/compiled/server.exe" tofile="${basedir}/products/server-${version}.exe"/>
56 <move file="${basedir}/compiled/server.exe" todir="${basedir}/compiled/bin/windows"/>
57
58
59 <!-- linux only -->
60 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
61
62 <!-- add static to configure.in -->
63 <rsr file="${basedir}/compiled/configure.in" pattern="^LDFLAGS=.*$" replacement="LDFLAGS=-static"/>
64 <exec dir="${basedir}/compiled" executable="autoconf" output="${basedir}/compiled/configure">
65 <arg value="configure.in"/>
66 </exec>
67
68 <!-- set environment in packages/configure -->
69 <rsr file="${basedir}/compiled/common-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
70 <rsr file="${basedir}/compiled/build-src/packages/configure" pattern="^ENVIRONMENT=.*$" replacement="ENVIRONMENT=&quot;LDFLAGS=-static&quot;"/>
71
72 <!-- run configure -->
73 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
74 <arg line="--enable-apache-httpd"/>
75 <env key="LDFLAGS" value="-static"/>
76 </exec>
77
78 <!-- add -static to makefiles -->
79 <rsr file="${basedir}/compiled/build-src/packages/wv/wv-gs/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static" />
80 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/xlhtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
81 <rsr file="${basedir}/compiled/build-src/packages/xlhtml/xlhtml-0.4.9.0/ppthtml/Makefile" pattern="^LDFLAGS =.*$" replacement="LDFLAGS = -static"/>
82 <rsr file="${basedir}/compiled/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="(-o rtftohtml.{2}EXEEXT.{1})" replacement="$1 -static"/>
83
84 <!-- mac only -->
85 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
86 <!-- run configure -->
87 <exec dir="${basedir}/compiled" executable="${basedir}/compiled/configure" failonerror="true">
88 <arg line="--enable-apache-httpd"/>
89 </exec>
90
91 <!-- tweak makefiles -->
92 <rsr file="${basedir}/compiled/runtime-src/src/recpt/Makefile" pattern="^(LIBS =.*)-L(.)\(PACKAGES_DIR\)/expat/lib -lexpat(.*)$" replacement="$1$2(PACKAGES_DIR)/expat/lib/libexpat.a$3"/>
93 <rsr file="${basedir}/compiled/runtime-src/src/oaiservr/Makefile" pattern="^(LIBS =.*)-L(.)\(PACKAGES_DIR\)/expat/lib -lexpat(.*)$" replacement="$1$2(PACKAGES_DIR)/expat/lib/libexpat.a$3"/>
94
95 </if></else></if></else></if>
96
97 <!-- mac and linux: compile -->
98 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
99
100 <!-- make -->
101 <exec dir="${basedir}/compiled" executable="make" failonerror="true"/>
102
103 <!-- make install -->
104 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="install"/></exec>
105
106 <!-- make apache-for-dist -->
107 <exec dir="${basedir}/compiled" executable="make" failonerror="true"><arg value="apache-for-dist"/></exec>
108
109 <!-- strip executables -->
110 <exec dir="${basedir}/compiled/bin/${os.shell}" executable="find" failonerror="true">
111 <arg line=". ! -name . -type f -maxdepth 1 -exec strip {} &#59;"/>
112 </exec>
113 </if>
114
115 <!-- compile gli -->
116 <!-- (linux and mac) -->
117 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
118 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makegli.sh"/></exec>
119 <exec dir="compiled/gli" executable="/bin/bash"><arg value="-c"/><arg value="./makejar.sh"/></exec>
120 <!-- windows -->
121 <else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
122 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makegli.bat"/></exec>
123 <exec dir="compiled/gli" executable="cmd.exe"><arg value="/c"/><arg value="makejar.bat"/></exec>
124 </if></else></if>
125
126 <delete dir="compiled/gli/jar"/>
127 <delete dir="compiled/gli/classes/org"/>
128 <move file="compiled/gli/GLIServer.jar" todir="compiled/bin/java"/>
129
130 <!-- compile uninstaller -->
131 <antcall target="insert-and-compile-uninstaller" />
132
133 <!-- build demo collection -->
134 <!-- the envs on these execs simulate the environment when you run setup.bat
135 <exec dir="${basedir}/compiled" executable="perl">
136 <arg line="bin/script/import.pl - -removeold demo"/>
137 <env key="GSDLHOME" path="${basedir}/compiled"/>
138 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
139 <env key="GSDLOS" value="windows"/>
140 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
141 </exec>
142 <exec dir="${basedir}/compiled" executable="perl">
143 <arg line="bin/script/buildcol.pl - -removeold demo"/>
144 <env key="GSDLHOME" path="${basedir}/compiled"/>
145 <env key="GSDLCOLLECTDIR" path="${basedir}/compiled/collect"/>
146 <env key="GSDLOS" value="windows"/>
147 <env key="PATH" path="${basedir}/compiled/bin/windows/perl/bin:${basedir}/compiled/bin/windows:${basedir}/compiled/bin/script:${env.PATH}"/>
148 </exec>
149 <delete dir="${basedir}/compiled/collect/demo/index"/>
150 <move file="${basedir}/compiled/collect/demo/building" tofile="${basedir}/compiled/collect/demo/index"/>
151 -->
152
153 <!-- delete the source code -->
154 <delete><fileset dir="compiled" includes="Makefile,config.cache,config.h,config.log,stamp-h,config.status"/></delete>
155 <delete dir="compiled/common-src"/>
156 <delete dir="compiled/build-src"/>
157 <delete dir="compiled/runtime-src"/>
158 <delete><fileset dir="compiled" includes="Install.txt,acconfig.h,aclocal.m4,config.guess,config.sub,configtest.pl,configure,configure.in,install-sh,Makefile.in,micotest.cpp,config.h.in,win32.mak,win32cfg.h"/></delete>
159
160 <!-- strip .svn working-copy dirs -->
161 <antcall target="strip-svn-dirs"><param name="dir" value="compiled"/></antcall>
162
163 <!-- create needed empty files -->
164 <mkdir dir="compiled/tmp"/>
165 <chmod dir="compiled/tmp" perm="a+rwx"/>
166 <echo file="compiled/etc/usage.txt"></echo>
167
168 <!-- windows -->
169 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
170
171 <!-- make a copy of server.exe in the root -->
172 <copy file="compiled/bin/windows/server.exe" tofile="compiled/server.exe"/>
173
174 <!-- delete sourcecode -->
175 <delete dir="${binzip.dir}/common-src"/>
176 <delete dir="${binzip.dir}/build-src"/>
177 <delete dir="${binzip.dir}/runtime-src"/>
178
179 <!-- create simple zipped binary distribution
180 <mkdir dir="distributions"/>
181 <property name="binzip.dir" value="distributions/Greenstone-${version}-${os.suffix}-binary"/>
182 <copy todir="${binzip.dir}"><fileset dir="compiled"/></copy>
183 <delete><fileset dir="${binzip.dir}" includes="README*.txt,Uninstall.bat,Uninst.bat,uninst.jar,win32.mak,win32cfg.h,makegs2.bat" excludes="READMEen.txt"/></delete>
184 -->
185
186 <!-- delete unneeded files -->
187 <delete dir="compiled/bin/linux" />
188 <delete><fileset dir="compiled" includes="*.bash,*.sh,*.csh,.gstermrc"/></delete>
189 <delete><fileset dir="compiled/gli" includes="*.sh,*4gs3.bat"/></delete>
190 <delete dir="compiled/autom4te.cache" />
191
192 <!-- linux -->
193 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
194 <!-- grab imagemagick binaries -->
195 <delete dir="compiled/bin/linux/imagemagick"/>
196 <exec executable="svn">
197 <arg value="export"/>
198 <arg value="${svn.root}/main/${branch.path}/binaries/linux/imagemagick"/>
199 <arg value="compiled/bin/linux/imagemagick"/>
200 </exec>
201
202 <!-- grab wv binaries -->
203 <delete dir="compiled/bin/linux/wv"/>
204 <exec executable="svn">
205 <arg value="export"/>
206 <arg value="${svn.root}/main/${branch.path}/binaries/linux/wv"/>
207 <arg value="compiled/bin/linux/wv"/>
208 </exec>
209
210 <!-- delete unneeded files -->
211 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,micotest.cpp"/></delete>
212 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
213 <delete><fileset dir="compiled" includes="*.bat"/></delete>
214 <delete dir="compiled/common-src/packages/windows"/>
215 <delete dir="compiled/common-src/indexers/packages/windows"/>
216
217 <!-- mac -->
218 <else><if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
219 <!-- grab imagemagick binaries -->
220 <delete dir="compiled/bin/darwin/imagemagick"/>
221 <exec executable="svn">
222 <arg value="export"/>
223 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/imagemagick"/>
224 <arg value="compiled/bin/darwin/imagemagick"/>
225 </exec>
226
227 <!-- grab ghostscript binaries -->
228 <delete dir="compiled/bin/darwin/ghostscript"/>
229 <exec executable="svn">
230 <arg value="export"/>
231 <arg value="${svn.root}/main/${branch.path}/binaries/mac/intel/ghostscript"/>
232 <arg value="compiled/bin/darwin/ghostscript"/>
233 </exec>
234
235 <!-- delete unneeded files -->
236 <delete><fileset dir="compiled" includes="win32.mak,win32cfg.h,Install.sh,Support.htm,*.bat"/></delete>
237 <delete><fileset dir="compiled/gli" includes="*.bat"/></delete>
238 <delete dir="compiled/common-src/packages/windows"/>
239
240 </if></else></if></else></if>
241
242 <!-- delete unneeded files -->
243 <delete dir="compiled/uninstaller" />
244 <delete file="compiled/bin/java/SignedGatherer.jar" />
245
246 <!-- tidy up gli -->
247 <antcall target="gli-tidy-for-dist"><param name="glibasedir" value="compiled/gli"/></antcall>
248
249 <!-- mac and linux: insert export to cdrom package -->
250 <if><bool><or><equals arg1="${rk.os}" arg2="mac"/><equals arg1="${rk.os}" arg2="linux"/></or></bool>
251 <mkdir dir="compiled/bin/windows"/>
252 <get src="${server.exe.location}" dest="compiled/bin/windows/server.exe"/>
253 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/Setup.exe" dest="compiled/bin/windows/Setup.exe"/>
254 <get src="${svn.root}/main/${branch.path}/binaries/windows/bin/gssetup.exe" dest="compiled/bin/windows/gssetup.exe"/>
255 </if>
256
257 </target>
258
259</project>
Note: See TracBrowser for help on using the repository browser.