source: main/trunk/release-kits/shared/core/ant-scripts/create-installer.xml@ 35634

Last change on this file since 35634 was 35629, checked in by davidb, 3 years ago

Two chanages: (i) newer OpenJDKs no longer include native2ascii, however newer versions of ant do (as a substitute). Also, newer versions of ant-tasks have stricker checks on how AbstractFileset.setFile() can be called, that the implementation of ant-installer violoates. The workaround is to explicitly build the antLib fileset within our create-installer.xml file rather than rely on the pre-programed behaviour of <installer> triggered by including the attribute 'antLib=...' (using the attribute triggers running the code that violates the newer/stricker API call

File size: 12.7 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="create-installer">
3
4 <target name="create-installer" depends="init">
5
6 <!-- create installer directory -->
7 <mkdir dir="installer/classes"/>
8
9 <!-- insert the installer descriptors -->
10 <copy todir="installer" overwrite="true">
11 <fileset dir="${rk.home}/kits/${rk.name}/installer" includes="antinstall-config.xml,build.xml"/>
12 </copy>
13
14 <!-- insert the language bundle -->
15 <native2ascii
16 implementation="default"
17 encoding="UTF-8"
18 src="${rk.home}/shared/core/language-strings"
19 dest="${basedir}/installer/classes/resources"/>
20
21 <!-- insert core, rk-specific and os-specific installer classes -->
22 <copy todir="${basedir}/installer/classes" overwrite="true">
23 <fileset dir="${rk.home}/shared/core/installer-classes" erroronmissingdir="false"/>
24 <fileset dir="${rk.home}/kits/${rk.name}/installer-classes" erroronmissingdir="false"/>
25 <fileset dir="${rk.home}/shared/${rk.os}/installer-classes" erroronmissingdir="false"/>
26 </copy>
27
28 <!-- insert the licence -->
29 <copy file="compiled/LICENSE.txt" todir="${basedir}/installer/classes" overwrite="true"/>
30
31 <!-- insert greenstone's ant tasks -->
32 <unjar src="${rk.home}/shared/core/ant-tasks/greenstone/anttasks.jar" dest="installer/classes"/>
33
34 <!-- insert antelope tasks -->
35 <unjar src="${rk.home}/shared/core/ant-tasks/antelope/AntelopeTasks_3.4.2.jar" dest="installer/classes"/>
36
37 <!-- Include lib/crypt.class for both releasekit2 and 3 (rk2 and rk3)
38 since we need it to encrypt the admin password -->
39 <unjar src="${rk.home}/shared/core/lib/crypt.jar" dest="${basedir}/installer/classes">
40 <patternset><include name="**/*.class"/></patternset>
41 </unjar>
42
43 <!-- (windows only) -->
44 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
45 <!-- insert 7za.exe tool -->
46 <copy todir="installer/classes" overwrite="true" file="${rk.home}/shared/windows/7za/7za.exe"/>
47
48 <!-- insert roxes and orangevolt for windows tricks in ant -->
49 <unjar src="${rk.home}/shared/core/ant-tasks/orangevolt/roxes-win32forjava-1.1.1.jar" dest="installer/classes"/>
50 <unjar src="${rk.home}/shared/core/ant-tasks/orangevolt/orangevolt-ant-tasks-1.3.8.jar" dest="installer/classes"/>
51
52 <!-- (linux and mac only) -->
53 <else><if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
54 <!-- insert 7zip ant task -->
55 <unjar src="${rk.home}/shared/core/ant-tasks/7z-ant/7z.jar" dest="installer/classes"/>
56
57 </if></else></if>
58
59 <!-- clean up meta directory -->
60 <delete dir="installer/classes/META-INF"/>
61
62 <!-- calculate the size of: core -->
63 <length property="component.bytesize.core-without-jre" mode="all"><fileset file="${basedir}/components/core.comp"/></length>
64 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
65 <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.windows-java}" datatype="int"/>
66 <else><if><bool><equals arg1="${rk.os}" arg2="linux"/></bool>
67 <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.linux-java}" datatype="int"/>
68 <else>
69 <exec dir="." executable="/bin/sh" outputproperty="bitness.ouput"><arg line="-c &quot;uname -m&quot;"/></exec>
70 <if><bool><contains string="${bitness.ouput}" substring="_64"/></bool>
71 <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.mac-java}" datatype="int"/>
72 <else><property name="component.bytesize.core" value="${component.bytesize.core-without-jre}"/></else>
73 </if>
74 </else></if></else></if>
75 <math result="component.megabytesize.core" operand1="${component.bytesize.core}" operation="/" operand2="1048576" datatype="int"/>
76 <property name="component.size.core" value="${component.megabytesize.core} MB"/>
77
78 <!-- calculate the size of: imagemagick -->
79 <length property="component.bytesize.imagemagick" mode="all"><fileset file="${basedir}/components/imagemagick.comp"/></length>
80 <math result="component.megabytesize.imagemagick" operand1="${component.bytesize.imagemagick}" operation="/" operand2="1048576" datatype="int"/>
81 <property name="component.size.imagemagick" value="${component.megabytesize.imagemagick} MB"/>
82
83 <!-- calculate the size of: ghostscript -->
84 <length property="component.bytesize.ghostscript" mode="all"><fileset file="${basedir}/components/ghostscript.comp"/></length>
85 <math result="component.megabytesize.ghostscript" operand1="${component.bytesize.ghostscript}" operation="/" operand2="1048576" datatype="int"/>
86 <property name="component.size.ghostscript" value="${component.megabytesize.ghostscript} MB"/>
87
88 <!-- calculate the size of: apache httpd -->
89 <length property="component.bytesize.httpd" mode="all"><fileset file="${basedir}/components/apachehttpd.comp"/></length>
90 <math result="component.megabytesize.httpd" operand1="${component.bytesize.httpd}" operation="/" operand2="1048576" datatype="int"/>
91 <property name="component.size.httpd" value="${component.megabytesize.httpd} MB"/>
92
93 <!-- calculate the size of: tomcat -->
94 <length property="component.bytesize.tomcat" mode="all"><fileset file="${basedir}/components/tomcat.comp"/></length>
95 <math result="component.megabytesize.tomcat" operand1="${component.bytesize.tomcat}" operation="/" operand2="1048576" datatype="int"/>
96 <property name="component.size.tomcat" value="${component.megabytesize.tomcat} MB"/>
97
98 <!-- EXT -->
99 <!-- calculate the size of: amp (and put it into the components directory) -->
100 <if><bool><and><equals arg1="${amp.enabled}" arg2="true"/><not><available file="${rk.home}/ext/amp.lzma"/></not></and></bool>
101 <fail>amp.lzma file not found in the release kit ext directory</fail>
102 </if>
103
104 <if><bool><and><equals arg1="${amp.enabled}" arg2="true"/></and></bool>
105 <echo>Copying amp.lzma to compontents directory</echo>
106 <copy file="${rk.home}/ext/amp.lzma" todir="${basedir}/components"/>
107 <property name="component.size.amp" value="257 MB"/>
108 </if>
109 <!-- /EXT -->
110
111 <!-- make the installer descriptors relevant to the current os -->
112 <dcff file="installer/antinstall-config.xml" startTag="&lt;!--\s*if\s*(?!.*${rk.os})[^ ]+\s*--&gt;" endTag="&lt;!--\s*/if\s*--&gt;" />
113 <dcff file="installer/build.xml" startTag="&lt;!--\s*if\s*(?!.*${rk.os})[^ ]+\s*--&gt;" endTag="&lt;!--\s*/if\s*--&gt;" />
114
115 <!-- EXT -->
116 <if><bool><not><equals arg1="${amp.enabled}" arg2="true"/></not></bool>
117
118 <dcff file="installer/antinstall-config.xml" startTag="&lt;!-- start amp --&gt;" endTag="&lt;!-- end amp --&gt;" />
119 <dcff file="installer/build.xml" startTag="&lt;!-- start amp --&gt;" endTag="&lt;!-- end amp --&gt;" />
120 </if>
121 <!-- /EXT -->
122 <!-- put the concrete values of things in the config -->
123 <rsr>
124 <fileset dir="${basedir}/installer" includes="*.xml"/>
125 <job pattern="@version@" replacement="${version}${version-extra}"/>
126 <job pattern="@component.size.core@" replacement="${component.size.core}"/>
127 <job pattern="@component.size.tomcat@" replacement="${component.size.tomcat}"/>
128 <job pattern="@component.size.imagemagick@" replacement="${component.size.imagemagick}"/>
129 <job pattern="@component.size.ghostscript@" replacement="${component.size.ghostscript}"/>
130 <job pattern="@component.size.httpd@" replacement="${component.size.httpd}"/>
131 <job pattern="@java.min.version@" replacement="${java.min.version}"/>
132 <job pattern="@java.extracted@" replacement="${java.extracted}"/>
133 </rsr>
134
135 <!-- If this is a FLAX installer then we need to change a few things -->
136 <if><bool><equals arg1="${forward.install.flax}" arg2="true"/></bool>
137 <dcff file="installer/build.xml" startTag="&lt;!-- NO FLAX START --&gt;" endTag="&lt;!-- NO FLAX END --&gt;" />
138 <dcff file="installer/antinstall-config.xml" startTag="&lt;!-- NO FLAX START --&gt;" endTag="&lt;!-- NO FLAX END --&gt;" />
139 <else>
140 <dcff file="installer/build.xml" startTag="&lt;!-- FLAX START --&gt;" endTag="&lt;!-- FLAX END --&gt;" />
141 <dcff file="installer/antinstall-config.xml" startTag="&lt;!-- FLAX START --&gt;" endTag="&lt;!-- FLAX END --&gt;" />
142 </else>
143 </if>
144
145 <!-- If we don't want GLI/GEMS -->
146 <if><bool><equals arg1="${with.gli.and.gems}" arg2="false" /></bool>
147 <dcff file="installer/build.xml" startTag="&lt;!-- GLI START --&gt;" endTag="&lt;!-- GLI END --&gt;" />
148 </if>
149
150 <!-- EXT -->
151 <if><bool><equals arg1="${amp.enabled}" arg2="true"/></bool>
152 <rsr>
153 <fileset dir="${basedir}/installer" includes="*.xml"/>
154 <job pattern="@component.size.amp@" replacement="${component.size.amp}"/>
155 </rsr>
156 </if>
157 <!-- /EXT -->
158
159 <!-- put the concrete values of things in the text -->
160 <rsr>
161 <fileset dir="${basedir}/installer/classes/resources" includes="*.properties"/>
162 <job pattern="@version@" replacement="${version}${version-extra}"/>
163 <job pattern="@version.major@" replacement="${version.major}"/>
164 <job pattern="@java.min.version@" replacement="${java.min.version}"/>
165 <job pattern="@bundled.version.imagemagick@" replacement="${bundled.version.imagemagick}"/>
166 <job pattern="@bundled.version.ghostscript@" replacement="${bundled.version.ghostscript}"/>
167 <job pattern="@bundled.version.tomcat@" replacement="${bundled.version.tomcat}"/>
168 <job pattern="@bundled.version.windows-java@" replacement="${bundled.version.windows-java}"/>
169 <job pattern="@bundled.version.linux-java@" replacement="${bundled.version.linux-java}"/>
170 </rsr>
171
172 <!-- now ready to run "compile-*-installer" targets -->
173
174 <antcall target="compile-binary-installer"/>
175
176 </target>
177
178 <target name="compile-binary-installer">
179
180 <!-- strip out lines for the cdrom installer -->
181 <copy file="installer/antinstall-config.xml" tofile="installer/antinstall-config-binary.xml" overwrite="true"/>
182 <dcff file="installer/antinstall-config-binary.xml" startTag=".*&lt;!-- start cdrom --&gt;.*" endTag=".*&lt;!-- end cdrom --&gt;.*" />
183 <copy file="installer/build.xml" tofile="installer/build-binary.xml" overwrite="true"/>
184 <dcff file="installer/build-binary.xml" startTag=".*&lt;!-- start cdrom --&gt;.*" endTag=".*&lt;!-- end cdrom --&gt;.*" />
185
186 <!-- create insaller jar with ant-installer's ant task -->
187 <installer file="installer/Greenstone-${version}${version-extra}-${os.suffix}.jar"
188 compress="true"
189 extractType="NonExtractor"
190 installConfig="installer/antinstall-config-binary.xml"
191 buildFile="installer/build-binary.xml"
192 antInstallLib="${rk.home}/shared/core/ant-installer/lib"
193 validateConfig="true"
194 icons="bluecurve">
195 <!--
196 antLib="${ant.home}/lib"
197 -->
198
199 <!--
200 The follow (below) is a replacement for doing the follow up in the <installer> element (above):
201
202 antib="${ant.home}/lib"
203
204 The change was needed to support newer versions of ant, where the underlying taskdef FileSet API
205 now has stricker checks, and no longer allows AbstractFileSet.setFile() to be called more than once for
206 an instantiated object instance of FileSet. In the case of 'antlLib' in the ant-istaller taskdef, this is
207 exactly what triggered by specifying this attribute is specified. The workaround is to create the
208 fileset explicitly below: done through <fileset>, this form can have multiple values in it.
209 -->
210
211 <fileset dir="${rk.home}/shared/core/ant-installer/lib">
212 <include name="ant.jar" />
213 <include name="ant-launcher.jar" />
214 </fileset>
215
216 <fileset dir="installer/classes" includes="**/*" />
217 <fileset dir="components" includes="*.lzma"/>
218
219 </installer>
220
221 </target>
222
223 <target name="compile-cdrom-installer">
224
225 <!-- strip out lines for the binary(web) installer -->
226 <copy file="installer/antinstall-config.xml" tofile="installer/antinstall-config-cdrom.xml"/>
227 <dcff file="installer/antinstall-config-cdrom.xml" startTag=".*&lt;!-- start web --&gt;.*" endTag=".*&lt;!-- end web --&gt;.*" />
228 <copy file="installer/build.xml" tofile="installer/build-cdrom.xml"/>
229 <dcff file="installer/build-cdrom.xml" startTag=".*&lt;!-- start web --&gt;.*" endTag=".*&lt;!-- end web --&gt;.*" />
230
231 <installer file="installer/cdrom.jar"
232 compress="true"
233 extractType="NonExtractor"
234 installConfig="installer/antinstall-config-cdrom.xml"
235 buildFile="installer/build-cdrom.xml"
236 antInstallLib="${rk.home}/shared/core/ant-installer/lib"
237 validateConfig="true"
238 icons="bluecurve">
239
240 <!--
241 The following (which had been in the element above):
242
243 antLib="${ant.home}/lib"
244
245 now needs to be done explicitly (below) due to changes in newer implementation of ant tasks
246 See longer note on the topic in the target before this one
247 -->
248
249 <fileset dir="${ant.home}/lib">
250 <include name="ant.jar" />
251 <include name="ant-launcher.jar" />
252 </fileset>
253
254 <fileset dir="installer/classes" includes="**/*" />
255 </installer>
256
257 </target>
258
259</project>
Note: See TracBrowser for help on using the repository browser.