Mercurial > cgi-bin > hgweb.cgi > JpegWasher
diff build.xml @ 34:d175593317a8
Add a bunch of packaging stuff, NOT WORKING YET,
author | David Barts <n5jrn@me.com> |
---|---|
date | Wed, 29 Apr 2020 21:49:21 -0700 |
parents | 3d86f0391168 |
children | bcbc92ffe0d0 |
line wrap: on
line diff
--- a/build.xml Fri Apr 24 19:45:57 2020 -0700 +++ b/build.xml Wed Apr 29 21:49:21 2020 -0700 @@ -21,14 +21,12 @@ <env-require name="JRE_HOME"/> <env-require name="KOTLIN_HOME"/> - <!-- load launch4j (Windows app builder) --> - <!-- load m-o-d (Linux Gnome app builder) --> - <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property --> <scriptdef language="javascript" name="toLowerCase"> <attribute name="value" /> <attribute name="target" /> <![CDATA[ + "use strict"; project.setProperty( attributes.get( "target" ), attributes.get( "value" ).toLowerCase() ); ]]> @@ -43,6 +41,8 @@ <property name="work.jar" value="${basedir}/work.jar"/> <property name="lib.home" value="${basedir}/lib"/> <property name="src.home" value="${basedir}/src"/> + <property name="dist.home" value="${basedir}/dist"/> + <property name="pf.home" value="${basedir}/package-files"/> <property name="nat.dir" value="${src.home}/name/blackcap/exifwasher/exiv2"/> <property name="bin.dir" value="${src.home}/name/blackcap/exifwasher/binaries"/> @@ -74,7 +74,7 @@ classname="net.sf.launch4j.ant.Launch4jTask" uri="antlib:net.sf.launch4j.ant"> <classpath> - <fileset dir="${lib.dir}/launch4j" includes="*.jar"/> + <fileset dir="${lib.home}/launch4j" includes="*.jar"/> </classpath> </taskdef> </contrib:then> @@ -88,14 +88,14 @@ classname="de.masters_of_disaster.ant.tasks.calculatesize.CalculateSize" uri="antlib:de.masters_of_disaster.ant.tasks"> <classpath> - <fileset dir="${lib.dir}/mod" includes="*.jar"/> + <fileset dir="${lib.home}/mod" includes="*.jar"/> </classpath> </taskdef> <taskdef name="deb" classname="de.masters_of_disaster.ant.tasks.deb.Deb" - uri="antlib:de.masters_of_disaster.ant.tasks"/> + uri="antlib:de.masters_of_disaster.ant.tasks"> <classpath> - <fileset dir="${lib.dir}/mod" includes="*.jar"/> + <fileset dir="${lib.home}/mod" includes="*.jar"/> </classpath> </taskdef> </contrib:then> @@ -143,8 +143,16 @@ <!-- make needed directories --> <target name="mkdirs"> - <mkdir dir="${lib.home}"/> - <mkdir dir="${src.home}/name/blackcap/exifwasher/binaries/${os.type}"/> + <mkdir dir="${bin.dir}/${os.type}"/> + <mkdir dir="${dist.home}"/> + </target> + + <!-- remove old cruft --> + <target name="clean"> + <delete includeEmptyDirs="true"> + <fileset dir="${dist.home}" includes="**/*"/> + <fileset dir="${bin.dir}"/> + </delete> </target> <!-- rename files containing OS-dependant code --> @@ -181,68 +189,174 @@ </jar> </target> - <!-- for making bundled apps --> - <macrodef name="bundle"> - <attribute name="type"/> - <element name="args"/> - <element name="icons"/> - <sequential> - <fx:deploy nativeBundles="@{type}" outdir="${basedir}" outfile="${app.name}" - signBundle="false"> - <fx:application mainClass="${app.entry}" name="${app.name}" toolkit="swing" - version="${app.version}"/> - <fx:info description="${app.name}" title="${app.name}" - vendor="David Barts <n5jrn@me.com>" - copyright="© MMXX, David W. Barts"> - <icons/> - </fx:info> - <fx:resources> - <fx:fileset dir="${basedir}" includes="${lc.app.name}.jar"/> - </fx:resources> - <fx:bundleArgument arg="runtime" value="${env.JRE_HOME}"/> - <args/> - </fx:deploy> - </sequential> - </macrodef> + <!-- the packaging logic here is cribbed from what jEdit does --> <target name="macapp" depends="jar" description="Create MacOS app bundle."> - <bundle type="image"> - <args> - <fx:bundleArgument arg="jvmOptions" value="-Xdock:name=${app.name}"/> - </args> - <icons> - <fx:icon href="${basedir}/${app.name}.icns"/> - </icons> - </bundle> - </target> - - <target name="dummywork" description="dummy dir to make javapackager happy"> - <mkdir dir="${work.home}"/> - <copy file="${jar.name}" tofile="${work.home}/${app.name}.jar"/> + <!-- not finished --> </target> - <!-- fx:deploy is broken on Windoze, must run javapackager command --> - <target name="winapp" depends="jar,dummywork" description="Create app bundle."> - <exec executable="${env.JRE_HOME}/bin/javapackager"> - <arg value="-deploy"/> - <arg value="-Bicon=${app.name}.ico"/> - <arg value="-BappVersion=${app.version}"/> - <arg value="-title"/> <arg value="${app.name}"/> - <arg value="-appclass"/> <arg value="${app.entry}"/> - <arg value="-native"/> <arg value="image"/> - <arg value="-name"/> <arg value="${app.name}"/> - <arg value="-outdir"/> <arg value="."/> - <arg value="-outfile"/> <arg value="${app.name}"/> - <arg value="-srcdir"/> <arg value="${work.home}"/> - </exec> + <target name="winapp" depends="jar" description="Create app bundle."> + <!-- not finished --> </target> - - <target name="rpm" depends="jar" description="Create RPM package."> - <bundle type="rpm"/> + + <target name="gunk"> + <sequential> + <mkdir dir="${dist.home}/classes/package-files/linux/deb"/> + <copy todir="${dist.home}/classes/package-files/linux/deb"> + <fileset file="${pf.home}/linux/deb/control"/> + </copy> + <exec executable="ls"> + <arg value="-ld"/> + <arg value="${dist.home}/classes/package-files/linux/deb"/> + </exec> + </sequential> </target> <target name="deb" depends="jar" description="Create Debian package."> - <bundle type="deb"/> + <sequential> + <mod:calculatesize realsizeproperty="deb.installed.size"> + <fileset file="${jar.name}"/> + </mod:calculatesize> + <mkdir dir="${dist.home}/classes/package-files/linux/deb"/> + <copy todir="${dist.home}/classes/package-files/linux/deb" encoding="UTF-8" + overwrite="true"> + <fileset file="${pf.home}/linux/deb/control"/> + <filterset> + <filter token="app.version" value="${app.version}"/> + <filter token="deb.installed.size" value="${deb.installed.size}"/> + </filterset> + </copy> + <copy todir="${dist.home}/classes/package-files/linux"> + <filelist dir="${pf.home}/linux" files="jpegwasher,jpegwasher.1"/> + <filterset> + <filter token="jar.filename" value="${lc.app.name}.jar"/> + </filterset> + </copy> + <mkdir dir="${dist.home}/doc"/> + <copy todir="${dist.home}/doc"> + <filelist dir="${basedir}" files="Readme.html,Readme.rst"/> + </copy> + <copy todir="${dist.home}"> + <filelist dir="${basedir}" files="${jar.name}"/> + </copy> + <property name="deb.file" value="${dist.home}/${lc.app.name}_${app.version}.deb"/> + <mod:deb destfile="${deb.file}" + tempDir="${dist.home}/classes/deb" + deleteTempFiles="false" + includeMd5sums="true"> + <controlfileset file="${dist.home}/classes/package-files/linux/deb/control"/> + <controlfileset dir="${dist.home}/classes/package-files/linux/deb" + includes="postinst,postrm" mode="755"/> + <datafileset file="." fullpath="usr/"/> + <datafileset file="." fullpath="usr/bin/"/> + <datafileset file="${dist.home}/classes/package-files/linux/jpegwasher" + fullpath="usr/bin/jpegwasher" mode="755"/> + <datafileset file="." fullpath="usr/lib/"/> + <datafileset file="." fullpath="usr/lib/menu/"/> + <datafileset file="${dist.home}/classes/package-files/linux/deb/jedit" + fullpath="usr/lib/menu/jedit"/> + <datafileset file="." fullpath="usr/share/"/> + <datafileset file="." fullpath="usr/share/applications/"/> + <datafileset file="${dist.home}/classes/package-files/linux/deb/jedit.desktop" + fullpath="usr/share/applications/jedit.desktop"/> + <datafileset file="." fullpath="usr/share/doc/"/> + <datafileset file="." fullpath="usr/share/doc/JpegWasher/"/> + <datafileset dir="${dist.home}/doc" includes="*.html,*.rst" + prefix="usr/share/doc/JpegWasher/"/> + <datafileset file="." fullpath="usr/share/JpegWasher/"/> + <datafileset dir="${dist.home}" + includes="doc/**,keymaps/**,macros/**,modes/**,properties/**,startup/**,${jar.name}" + prefix="usr/share/JpegWasher/"/> + <datafileset file="." fullpath="/usr/share/JpegWasher/jars"/> + <datafileset file="${jar.name}" + fullpath="/usr/share/JpegWasher/jars/${lc.app.name}.jar"/> + <datafileset file="." + fullpath="usr/share/man/"/> + <datafileset file="." + fullpath="usr/share/man/man1/"/> + <datafileset file="${dist.home}/classes/package-files/linux/jpegwasher.1" + fullpath="usr/share/man/man1/jpegwasher.1"/> + </mod:deb> + <length property="deb.size" file="${deb.file}"/> + <checksum file="${deb.file}" algorithm="MD5" property="deb.md5"/> + <checksum file="${deb.file}" algorithm="SHA1" property="deb.sha1"/> + <checksum file="${deb.file}" algorithm="SHA-256" property="deb.sha256"/> + <copy todir="${dist.home}" encoding="UTF-8" overwrite="true"> + <fileset file="${pf.home}/linux/deb/Packages"/> + <filterset> + <filter token="app.version" value="${app.version}"/> + <filter token="deb.installed.size" value="${deb.installed.size}"/> + <filter token="deb.repository.file" value="${deb.file}"/> + <filter token="deb.size" value="${deb.size}"/> + <filter token="deb.md5" value="${deb.md5}"/> + <filter token="deb.sha1" value="${deb.sha1}"/> + <filter token="deb.sha256" value="${deb.sha256}"/> + </filterset> + </copy> + <gzip src="${dist.home}/Packages" destfile="${dist.home}/Packages.gz"/> + <bzip2 src="${dist.home}/Packages" destfile="${dist.home}/Packages.bz2"/> + <length property="packages.size" file="${dist.home}/Packages"/> + <checksum file="${dist.home}/Packages" + algorithm="MD5" property="packages.md5"/> + <checksum file="${dist.home}/Packages" + algorithm="SHA1" property="packages.sha1"/> + <checksum file="${dist.home}/Packages" + algorithm="SHA-256" property="packages.sha256"/> + <length property="packages.gz.size" + file="${dist.home}/Packages.gz"/> + <checksum file="${dist.home}/Packages.gz" + algorithm="MD5" property="packages.gz.md5"/> + <checksum file="${dist.home}/Packages.gz" + algorithm="SHA1" property="packages.gz.sha1"/> + <checksum file="${dist.home}/Packages.gz" + algorithm="SHA-256" property="packages.gz.sha256"/> + <length property="packages.bz2.size" + file="${dist.home}/Packages.bz2"/> + <checksum file="${dist.home}/Packages.bz2" + algorithm="MD5" property="packages.bz2.md5"/> + <checksum file="${dist.home}/Packages.bz2" + algorithm="SHA1" property="packages.bz2.sha1"/> + <checksum file="${dist.home}/Packages.bz2" + algorithm="SHA-256" property="packages.bz2.sha256"/> + <script language="javascript"> + <![CDATA[ + "use strict"; + var Calendar = Java.type('java.util.Calendar'); + var File = Java.type('java.io.File'); + var Formatter = Java.type('java.util.Formatter'); + var Locale = Java.type('java.util.Locale'); + var TimeZone = Java.type('java.util.TimeZone'); + new Formatter(new File(project.getProperty("dist.home"), "Release"), "UTF-8", Locale.ENGLISH) + .format("Date: %1$ta, %1$td %1$tb %1$tY %1$tT %1$tZ\n", + Calendar.getInstance(TimeZone.getTimeZone("UTC"))) + .format("MD5Sum:\n") + .format(" %s %16s %s\n", project.getProperty("packages.md5"), + project.getProperty("packages.size"), "Packages") + .format(" %s %16s %s\n", project.getProperty("packages.bz2.md5"), + project.getProperty("packages.bz2.size"), "Packages.bz2") + .format(" %s %16s %s\n", project.getProperty("packages.gz.md5"), + project.getProperty("packages.gz.size"), "Packages.gz") + .format("SHA1:\n") + .format(" %s %16s %s\n", project.getProperty("packages.sha1"), + project.getProperty("packages.size"), "Packages") + .format(" %s %16s %s\n", project.getProperty("packages.bz2.sha1"), + project.getProperty("packages.bz2.size"), "Packages.bz2") + .format(" %s %16s %s\n", project.getProperty("packages.gz.sha1"), + project.getProperty("packages.gz.size"), "Packages.gz") + .format("SHA256:\n") + .format(" %s %16s %s\n", project.getProperty("packages.sha256"), + project.getProperty("packages.size"), "Packages") + .format(" %s %16s %s\n", project.getProperty("packages.bz2.sha256"), + project.getProperty("packages.bz2.size"), "Packages.bz2") + .format(" %s %16s %s\n", project.getProperty("packages.gz.sha256"), + project.getProperty("packages.gz.size"), "Packages.gz") + .close(); + ]]> + <!-- gpg reads from tty, so can't be used inside ant --> + </script> + <echo message="Use gpg(1) to sign the Release file, if desired:"/> + <echo message=" gpg --sign ${dist.home}/Release"/> + </sequential> </target> </project>