Mercurial > cgi-bin > hgweb.cgi > JpegWasher
comparison 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 |
comparison
equal
deleted
inserted
replaced
33:3d86f0391168 | 34:d175593317a8 |
---|---|
19 </sequential> | 19 </sequential> |
20 </macrodef> | 20 </macrodef> |
21 <env-require name="JRE_HOME"/> | 21 <env-require name="JRE_HOME"/> |
22 <env-require name="KOTLIN_HOME"/> | 22 <env-require name="KOTLIN_HOME"/> |
23 | 23 |
24 <!-- load launch4j (Windows app builder) --> | |
25 <!-- load m-o-d (Linux Gnome app builder) --> | |
26 | |
27 <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property --> | 24 <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property --> |
28 <scriptdef language="javascript" name="toLowerCase"> | 25 <scriptdef language="javascript" name="toLowerCase"> |
29 <attribute name="value" /> | 26 <attribute name="value" /> |
30 <attribute name="target" /> | 27 <attribute name="target" /> |
31 <![CDATA[ | 28 <![CDATA[ |
29 "use strict"; | |
32 project.setProperty( attributes.get( "target" ), | 30 project.setProperty( attributes.get( "target" ), |
33 attributes.get( "value" ).toLowerCase() ); | 31 attributes.get( "value" ).toLowerCase() ); |
34 ]]> | 32 ]]> |
35 </scriptdef> | 33 </scriptdef> |
36 | 34 |
41 <toLowerCase target="lc.app.name" value="${app.name}"/> | 39 <toLowerCase target="lc.app.name" value="${app.name}"/> |
42 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> | 40 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> |
43 <property name="work.jar" value="${basedir}/work.jar"/> | 41 <property name="work.jar" value="${basedir}/work.jar"/> |
44 <property name="lib.home" value="${basedir}/lib"/> | 42 <property name="lib.home" value="${basedir}/lib"/> |
45 <property name="src.home" value="${basedir}/src"/> | 43 <property name="src.home" value="${basedir}/src"/> |
44 <property name="dist.home" value="${basedir}/dist"/> | |
45 <property name="pf.home" value="${basedir}/package-files"/> | |
46 <property name="nat.dir" value="${src.home}/name/blackcap/exifwasher/exiv2"/> | 46 <property name="nat.dir" value="${src.home}/name/blackcap/exifwasher/exiv2"/> |
47 <property name="bin.dir" value="${src.home}/name/blackcap/exifwasher/binaries"/> | 47 <property name="bin.dir" value="${src.home}/name/blackcap/exifwasher/binaries"/> |
48 | 48 |
49 <!-- load the ant-contrib tasks --> | 49 <!-- load the ant-contrib tasks --> |
50 <taskdef resource="net/sf/antcontrib/antlib.xml" | 50 <taskdef resource="net/sf/antcontrib/antlib.xml" |
72 <contrib:then> | 72 <contrib:then> |
73 <taskdef name="create" | 73 <taskdef name="create" |
74 classname="net.sf.launch4j.ant.Launch4jTask" | 74 classname="net.sf.launch4j.ant.Launch4jTask" |
75 uri="antlib:net.sf.launch4j.ant"> | 75 uri="antlib:net.sf.launch4j.ant"> |
76 <classpath> | 76 <classpath> |
77 <fileset dir="${lib.dir}/launch4j" includes="*.jar"/> | 77 <fileset dir="${lib.home}/launch4j" includes="*.jar"/> |
78 </classpath> | 78 </classpath> |
79 </taskdef> | 79 </taskdef> |
80 </contrib:then> | 80 </contrib:then> |
81 </contrib:if> | 81 </contrib:if> |
82 | 82 |
86 <contrib:then> | 86 <contrib:then> |
87 <taskdef name="calculatesize" | 87 <taskdef name="calculatesize" |
88 classname="de.masters_of_disaster.ant.tasks.calculatesize.CalculateSize" | 88 classname="de.masters_of_disaster.ant.tasks.calculatesize.CalculateSize" |
89 uri="antlib:de.masters_of_disaster.ant.tasks"> | 89 uri="antlib:de.masters_of_disaster.ant.tasks"> |
90 <classpath> | 90 <classpath> |
91 <fileset dir="${lib.dir}/mod" includes="*.jar"/> | 91 <fileset dir="${lib.home}/mod" includes="*.jar"/> |
92 </classpath> | 92 </classpath> |
93 </taskdef> | 93 </taskdef> |
94 <taskdef name="deb" | 94 <taskdef name="deb" |
95 classname="de.masters_of_disaster.ant.tasks.deb.Deb" | 95 classname="de.masters_of_disaster.ant.tasks.deb.Deb" |
96 uri="antlib:de.masters_of_disaster.ant.tasks"/> | 96 uri="antlib:de.masters_of_disaster.ant.tasks"> |
97 <classpath> | 97 <classpath> |
98 <fileset dir="${lib.dir}/mod" includes="*.jar"/> | 98 <fileset dir="${lib.home}/mod" includes="*.jar"/> |
99 </classpath> | 99 </classpath> |
100 </taskdef> | 100 </taskdef> |
101 </contrib:then> | 101 </contrib:then> |
102 </contrib:if> | 102 </contrib:if> |
103 | 103 |
141 </path> | 141 </path> |
142 </target> | 142 </target> |
143 | 143 |
144 <!-- make needed directories --> | 144 <!-- make needed directories --> |
145 <target name="mkdirs"> | 145 <target name="mkdirs"> |
146 <mkdir dir="${lib.home}"/> | 146 <mkdir dir="${bin.dir}/${os.type}"/> |
147 <mkdir dir="${src.home}/name/blackcap/exifwasher/binaries/${os.type}"/> | 147 <mkdir dir="${dist.home}"/> |
148 </target> | |
149 | |
150 <!-- remove old cruft --> | |
151 <target name="clean"> | |
152 <delete includeEmptyDirs="true"> | |
153 <fileset dir="${dist.home}" includes="**/*"/> | |
154 <fileset dir="${bin.dir}"/> | |
155 </delete> | |
148 </target> | 156 </target> |
149 | 157 |
150 <!-- rename files containing OS-dependant code --> | 158 <!-- rename files containing OS-dependant code --> |
151 <target name="osdep"> | 159 <target name="osdep"> |
152 <exec executable="${env.JRE_HOME}/bin/java"> | 160 <exec executable="${env.JRE_HOME}/bin/java"> |
179 <zipfileset src="${work.jar}"/> | 187 <zipfileset src="${work.jar}"/> |
180 <zipfileset dir="${src.home}" includes="**/*.properties,**/*.dll,**/*.so,**/*.dylib"/> | 188 <zipfileset dir="${src.home}" includes="**/*.properties,**/*.dll,**/*.so,**/*.dylib"/> |
181 </jar> | 189 </jar> |
182 </target> | 190 </target> |
183 | 191 |
184 <!-- for making bundled apps --> | 192 <!-- the packaging logic here is cribbed from what jEdit does --> |
185 <macrodef name="bundle"> | 193 |
186 <attribute name="type"/> | 194 <target name="macapp" depends="jar" description="Create MacOS app bundle."> |
187 <element name="args"/> | 195 <!-- not finished --> |
188 <element name="icons"/> | 196 </target> |
197 | |
198 <target name="winapp" depends="jar" description="Create app bundle."> | |
199 <!-- not finished --> | |
200 </target> | |
201 | |
202 <target name="gunk"> | |
189 <sequential> | 203 <sequential> |
190 <fx:deploy nativeBundles="@{type}" outdir="${basedir}" outfile="${app.name}" | 204 <mkdir dir="${dist.home}/classes/package-files/linux/deb"/> |
191 signBundle="false"> | 205 <copy todir="${dist.home}/classes/package-files/linux/deb"> |
192 <fx:application mainClass="${app.entry}" name="${app.name}" toolkit="swing" | 206 <fileset file="${pf.home}/linux/deb/control"/> |
193 version="${app.version}"/> | 207 </copy> |
194 <fx:info description="${app.name}" title="${app.name}" | 208 <exec executable="ls"> |
195 vendor="David Barts <n5jrn@me.com>" | 209 <arg value="-ld"/> |
196 copyright="© MMXX, David W. Barts"> | 210 <arg value="${dist.home}/classes/package-files/linux/deb"/> |
197 <icons/> | 211 </exec> |
198 </fx:info> | 212 </sequential> |
199 <fx:resources> | |
200 <fx:fileset dir="${basedir}" includes="${lc.app.name}.jar"/> | |
201 </fx:resources> | |
202 <fx:bundleArgument arg="runtime" value="${env.JRE_HOME}"/> | |
203 <args/> | |
204 </fx:deploy> | |
205 </sequential> | |
206 </macrodef> | |
207 | |
208 <target name="macapp" depends="jar" description="Create MacOS app bundle."> | |
209 <bundle type="image"> | |
210 <args> | |
211 <fx:bundleArgument arg="jvmOptions" value="-Xdock:name=${app.name}"/> | |
212 </args> | |
213 <icons> | |
214 <fx:icon href="${basedir}/${app.name}.icns"/> | |
215 </icons> | |
216 </bundle> | |
217 </target> | |
218 | |
219 <target name="dummywork" description="dummy dir to make javapackager happy"> | |
220 <mkdir dir="${work.home}"/> | |
221 <copy file="${jar.name}" tofile="${work.home}/${app.name}.jar"/> | |
222 </target> | |
223 | |
224 <!-- fx:deploy is broken on Windoze, must run javapackager command --> | |
225 <target name="winapp" depends="jar,dummywork" description="Create app bundle."> | |
226 <exec executable="${env.JRE_HOME}/bin/javapackager"> | |
227 <arg value="-deploy"/> | |
228 <arg value="-Bicon=${app.name}.ico"/> | |
229 <arg value="-BappVersion=${app.version}"/> | |
230 <arg value="-title"/> <arg value="${app.name}"/> | |
231 <arg value="-appclass"/> <arg value="${app.entry}"/> | |
232 <arg value="-native"/> <arg value="image"/> | |
233 <arg value="-name"/> <arg value="${app.name}"/> | |
234 <arg value="-outdir"/> <arg value="."/> | |
235 <arg value="-outfile"/> <arg value="${app.name}"/> | |
236 <arg value="-srcdir"/> <arg value="${work.home}"/> | |
237 </exec> | |
238 </target> | |
239 | |
240 <target name="rpm" depends="jar" description="Create RPM package."> | |
241 <bundle type="rpm"/> | |
242 </target> | 213 </target> |
243 | 214 |
244 <target name="deb" depends="jar" description="Create Debian package."> | 215 <target name="deb" depends="jar" description="Create Debian package."> |
245 <bundle type="deb"/> | 216 <sequential> |
217 <mod:calculatesize realsizeproperty="deb.installed.size"> | |
218 <fileset file="${jar.name}"/> | |
219 </mod:calculatesize> | |
220 <mkdir dir="${dist.home}/classes/package-files/linux/deb"/> | |
221 <copy todir="${dist.home}/classes/package-files/linux/deb" encoding="UTF-8" | |
222 overwrite="true"> | |
223 <fileset file="${pf.home}/linux/deb/control"/> | |
224 <filterset> | |
225 <filter token="app.version" value="${app.version}"/> | |
226 <filter token="deb.installed.size" value="${deb.installed.size}"/> | |
227 </filterset> | |
228 </copy> | |
229 <copy todir="${dist.home}/classes/package-files/linux"> | |
230 <filelist dir="${pf.home}/linux" files="jpegwasher,jpegwasher.1"/> | |
231 <filterset> | |
232 <filter token="jar.filename" value="${lc.app.name}.jar"/> | |
233 </filterset> | |
234 </copy> | |
235 <mkdir dir="${dist.home}/doc"/> | |
236 <copy todir="${dist.home}/doc"> | |
237 <filelist dir="${basedir}" files="Readme.html,Readme.rst"/> | |
238 </copy> | |
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> | |
246 </target> | 360 </target> |
247 | 361 |
248 </project> | 362 </project> |