comparison build.xml @ 35:bcbc92ffe0d0

Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
author David Barts <n5jrn@me.com>
date Thu, 30 Apr 2020 21:22:30 -0700
parents d175593317a8
children aa9ab6cbaa26
comparison
equal deleted inserted replaced
34:d175593317a8 35:bcbc92ffe0d0
30 project.setProperty( attributes.get( "target" ), 30 project.setProperty( attributes.get( "target" ),
31 attributes.get( "value" ).toLowerCase() ); 31 attributes.get( "value" ).toLowerCase() );
32 ]]> 32 ]]>
33 </scriptdef> 33 </scriptdef>
34 34
35 <scriptdef language="javascript" name="du">
36 <attribute name="path" />
37 <attribute name="target" />
38 <![CDATA[
39 "use strict";
40 var File = Java.type('java.io.File');
41 function du(fp) {
42 if (fp.isDirectory()) {
43 var files = fp.listFiles();
44 if (!files) return 0;
45 var total = 0;
46 for(var i=0; i<files.length; i++)
47 total += du(files[i]);
48 return total;
49 } else {
50 return fp.length();
51 }
52 }
53 var path = new File(attributes.get("path"));
54 project.setProperty(attributes.get("target"),
55 Math.round(du(path) / 1024) + "");
56 ]]>
57 </scriptdef>
58
35 <!-- Define the properties used by the build --> 59 <!-- Define the properties used by the build -->
36 <property name="app.name" value="${ant.project.name}"/> 60 <property name="app.name" value="${ant.project.name}"/>
37 <property name="app.version" value="1.03"/> 61 <property name="app.version" value="1.03"/>
38 <property name="app.entry" value="name.blackcap.exifwasher.MainKt"/> 62 <property name="app.entry" value="name.blackcap.exifwasher.MainKt"/>
39 <toLowerCase target="lc.app.name" value="${app.name}"/> 63 <toLowerCase target="lc.app.name" value="${app.name}"/>
196 </target> 220 </target>
197 221
198 <target name="winapp" depends="jar" description="Create app bundle."> 222 <target name="winapp" depends="jar" description="Create app bundle.">
199 <!-- not finished --> 223 <!-- not finished -->
200 </target> 224 </target>
201
202 <target name="gunk">
203 <sequential>
204 <mkdir dir="${dist.home}/classes/package-files/linux/deb"/>
205 <copy todir="${dist.home}/classes/package-files/linux/deb">
206 <fileset file="${pf.home}/linux/deb/control"/>
207 </copy>
208 <exec executable="ls">
209 <arg value="-ld"/>
210 <arg value="${dist.home}/classes/package-files/linux/deb"/>
211 </exec>
212 </sequential>
213 </target>
214 225
215 <target name="deb" depends="jar" description="Create Debian package."> 226 <target name="deb" depends="jar" description="Create Debian package.">
216 <sequential> 227 <sequential>
217 <mod:calculatesize realsizeproperty="deb.installed.size"> 228 <mkdir dir="${dist.home}/data/usr/share/applications"/>
218 <fileset file="${jar.name}"/> 229 <copy file="${pf.home}/linux/deb/jpegwasher.desktop"
219 </mod:calculatesize> 230 tofile="${dist.home}/data/usr/share/applications/jpegwasher.desktop"/>
220 <mkdir dir="${dist.home}/classes/package-files/linux/deb"/> 231 <mkdir dir="${dist.home}/data/usr/share/icons/hicolor/48x48/apps"/>
221 <copy todir="${dist.home}/classes/package-files/linux/deb" encoding="UTF-8" 232 <copy file="${pf.home}/linux/icon_48x48.png"
222 overwrite="true"> 233 tofile="${dist.home}/data/usr/share/icons/hicolor/48x48/apps/jpegwasher.png"/>
234 <mkdir dir="${dist.home}/data/usr/share/jpegwasher"/>
235 <copy file="${jar.name}" todir="${dist.home}/data/usr/share/jpegwasher"/>
236 <mkdir dir="${dist.home}/data/usr/share/doc/jpegwasher"/>
237 <copy todir="${dist.home}/data/usr/share/doc/jpegwasher">
238 <filelist dir="${basedir}" files="Readme.html,Readme.rst"/>
239 <fileset file="${pf.home}/linux/deb/copyright"/>
240 </copy>
241 <gzip src="${pf.home}/linux/deb/changelog"
242 destfile="${dist.home}/data/usr/share/doc/jpegwasher/changelog.gz"/>
243 <mkdir dir="${dist.home}/data/usr/share/man/man1"/>
244 <gzip src="${pf.home}/linux/jpegwasher.1"
245 destfile="${dist.home}/data/usr/share/man/man1/jpegwasher.1.gz"/>
246 <mkdir dir="${dist.home}/data/usr/bin"/>
247 <copy todir="${dist.home}/data/usr/bin" encoding="UTF-8" overwrite="true">
248 <fileset file="${pf.home}/linux/jpegwasher"/>
249 <filterset>
250 <filter token="jar.filename" value="${lc.app.name}.jar"/>
251 </filterset>
252 </copy>
253 <chmod file="${dist.home}/data/usr/bin/jpegwasher" perm="755"/>
254 <du path="${dist.home}/data" target="deb.installed.size"/>
255 <mkdir dir="${dist.home}/control"/>
256 <copy todir="${dist.home}/control" encoding="UTF-8" overwrite="true">
223 <fileset file="${pf.home}/linux/deb/control"/> 257 <fileset file="${pf.home}/linux/deb/control"/>
224 <filterset> 258 <filterset>
225 <filter token="app.version" value="${app.version}"/> 259 <filter token="app.version" value="${app.version}"/>
226 <filter token="deb.installed.size" value="${deb.installed.size}"/> 260 <filter token="deb.installed.size" value="${deb.installed.size}"/>
227 </filterset> 261 </filterset>
228 </copy> 262 </copy>
229 <copy todir="${dist.home}/classes/package-files/linux"> 263 <copy todir="${dist.home}/control">
230 <filelist dir="${pf.home}/linux" files="jpegwasher,jpegwasher.1"/> 264 <filelist dir="${pf.home}/linux/deb" files="postinst,postrm"/>
231 <filterset> 265 </copy>
232 <filter token="jar.filename" value="${lc.app.name}.jar"/> 266 <chmod perm="755">
233 </filterset> 267 <filelist dir="${dist.home}/control" files="postinst,postrm"/>
234 </copy> 268 </chmod>
235 <mkdir dir="${dist.home}/doc"/> 269 <exec executable="${basedir}/make-debian-package">
236 <copy todir="${dist.home}/doc"> 270 <arg value="${dist.home}"/>
237 <filelist dir="${basedir}" files="Readme.html,Readme.rst"/> 271 <arg value="${lc.app.name}_${app.version}.deb"/>
238 </copy> 272 </exec>
239 <copy todir="${dist.home}">
240 <filelist dir="${basedir}" files="${jar.name}"/>
241 </copy>
242 <property name="deb.file" value="${dist.home}/${lc.app.name}_${app.version}.deb"/>
243 <mod:deb destfile="${deb.file}"
244 tempDir="${dist.home}/classes/deb"
245 deleteTempFiles="false"
246 includeMd5sums="true">
247 <controlfileset file="${dist.home}/classes/package-files/linux/deb/control"/>
248 <controlfileset dir="${dist.home}/classes/package-files/linux/deb"
249 includes="postinst,postrm" mode="755"/>
250 <datafileset file="." fullpath="usr/"/>
251 <datafileset file="." fullpath="usr/bin/"/>
252 <datafileset file="${dist.home}/classes/package-files/linux/jpegwasher"
253 fullpath="usr/bin/jpegwasher" mode="755"/>
254 <datafileset file="." fullpath="usr/lib/"/>
255 <datafileset file="." fullpath="usr/lib/menu/"/>
256 <datafileset file="${dist.home}/classes/package-files/linux/deb/jedit"
257 fullpath="usr/lib/menu/jedit"/>
258 <datafileset file="." fullpath="usr/share/"/>
259 <datafileset file="." fullpath="usr/share/applications/"/>
260 <datafileset file="${dist.home}/classes/package-files/linux/deb/jedit.desktop"
261 fullpath="usr/share/applications/jedit.desktop"/>
262 <datafileset file="." fullpath="usr/share/doc/"/>
263 <datafileset file="." fullpath="usr/share/doc/JpegWasher/"/>
264 <datafileset dir="${dist.home}/doc" includes="*.html,*.rst"
265 prefix="usr/share/doc/JpegWasher/"/>
266 <datafileset file="." fullpath="usr/share/JpegWasher/"/>
267 <datafileset dir="${dist.home}"
268 includes="doc/**,keymaps/**,macros/**,modes/**,properties/**,startup/**,${jar.name}"
269 prefix="usr/share/JpegWasher/"/>
270 <datafileset file="." fullpath="/usr/share/JpegWasher/jars"/>
271 <datafileset file="${jar.name}"
272 fullpath="/usr/share/JpegWasher/jars/${lc.app.name}.jar"/>
273 <datafileset file="."
274 fullpath="usr/share/man/"/>
275 <datafileset file="."
276 fullpath="usr/share/man/man1/"/>
277 <datafileset file="${dist.home}/classes/package-files/linux/jpegwasher.1"
278 fullpath="usr/share/man/man1/jpegwasher.1"/>
279 </mod:deb>
280 <length property="deb.size" file="${deb.file}"/>
281 <checksum file="${deb.file}" algorithm="MD5" property="deb.md5"/>
282 <checksum file="${deb.file}" algorithm="SHA1" property="deb.sha1"/>
283 <checksum file="${deb.file}" algorithm="SHA-256" property="deb.sha256"/>
284 <copy todir="${dist.home}" encoding="UTF-8" overwrite="true">
285 <fileset file="${pf.home}/linux/deb/Packages"/>
286 <filterset>
287 <filter token="app.version" value="${app.version}"/>
288 <filter token="deb.installed.size" value="${deb.installed.size}"/>
289 <filter token="deb.repository.file" value="${deb.file}"/>
290 <filter token="deb.size" value="${deb.size}"/>
291 <filter token="deb.md5" value="${deb.md5}"/>
292 <filter token="deb.sha1" value="${deb.sha1}"/>
293 <filter token="deb.sha256" value="${deb.sha256}"/>
294 </filterset>
295 </copy>
296 <gzip src="${dist.home}/Packages" destfile="${dist.home}/Packages.gz"/>
297 <bzip2 src="${dist.home}/Packages" destfile="${dist.home}/Packages.bz2"/>
298 <length property="packages.size" file="${dist.home}/Packages"/>
299 <checksum file="${dist.home}/Packages"
300 algorithm="MD5" property="packages.md5"/>
301 <checksum file="${dist.home}/Packages"
302 algorithm="SHA1" property="packages.sha1"/>
303 <checksum file="${dist.home}/Packages"
304 algorithm="SHA-256" property="packages.sha256"/>
305 <length property="packages.gz.size"
306 file="${dist.home}/Packages.gz"/>
307 <checksum file="${dist.home}/Packages.gz"
308 algorithm="MD5" property="packages.gz.md5"/>
309 <checksum file="${dist.home}/Packages.gz"
310 algorithm="SHA1" property="packages.gz.sha1"/>
311 <checksum file="${dist.home}/Packages.gz"
312 algorithm="SHA-256" property="packages.gz.sha256"/>
313 <length property="packages.bz2.size"
314 file="${dist.home}/Packages.bz2"/>
315 <checksum file="${dist.home}/Packages.bz2"
316 algorithm="MD5" property="packages.bz2.md5"/>
317 <checksum file="${dist.home}/Packages.bz2"
318 algorithm="SHA1" property="packages.bz2.sha1"/>
319 <checksum file="${dist.home}/Packages.bz2"
320 algorithm="SHA-256" property="packages.bz2.sha256"/>
321 <script language="javascript">
322 <![CDATA[
323 "use strict";
324 var Calendar = Java.type('java.util.Calendar');
325 var File = Java.type('java.io.File');
326 var Formatter = Java.type('java.util.Formatter');
327 var Locale = Java.type('java.util.Locale');
328 var TimeZone = Java.type('java.util.TimeZone');
329 new Formatter(new File(project.getProperty("dist.home"), "Release"), "UTF-8", Locale.ENGLISH)
330 .format("Date: %1$ta, %1$td %1$tb %1$tY %1$tT %1$tZ\n",
331 Calendar.getInstance(TimeZone.getTimeZone("UTC")))
332 .format("MD5Sum:\n")
333 .format(" %s %16s %s\n", project.getProperty("packages.md5"),
334 project.getProperty("packages.size"), "Packages")
335 .format(" %s %16s %s\n", project.getProperty("packages.bz2.md5"),
336 project.getProperty("packages.bz2.size"), "Packages.bz2")
337 .format(" %s %16s %s\n", project.getProperty("packages.gz.md5"),
338 project.getProperty("packages.gz.size"), "Packages.gz")
339 .format("SHA1:\n")
340 .format(" %s %16s %s\n", project.getProperty("packages.sha1"),
341 project.getProperty("packages.size"), "Packages")
342 .format(" %s %16s %s\n", project.getProperty("packages.bz2.sha1"),
343 project.getProperty("packages.bz2.size"), "Packages.bz2")
344 .format(" %s %16s %s\n", project.getProperty("packages.gz.sha1"),
345 project.getProperty("packages.gz.size"), "Packages.gz")
346 .format("SHA256:\n")
347 .format(" %s %16s %s\n", project.getProperty("packages.sha256"),
348 project.getProperty("packages.size"), "Packages")
349 .format(" %s %16s %s\n", project.getProperty("packages.bz2.sha256"),
350 project.getProperty("packages.bz2.size"), "Packages.bz2")
351 .format(" %s %16s %s\n", project.getProperty("packages.gz.sha256"),
352 project.getProperty("packages.gz.size"), "Packages.gz")
353 .close();
354 ]]>
355 <!-- gpg reads from tty, so can't be used inside ant -->
356 </script>
357 <echo message="Use gpg(1) to sign the Release file, if desired:"/>
358 <echo message=" gpg --sign ${dist.home}/Release"/>
359 </sequential> 273 </sequential>
360 </target> 274 </target>
361 275
362 </project> 276 </project>