changeset 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
files build.xml package-files/linux/deb/Packages package-files/linux/deb/control package-files/linux/deb/jpegwasher package-files/linux/deb/jpegwasher.desktop package-files/linux/deb/postinst package-files/linux/deb/postrm package-files/linux/jpegwasher package-files/linux/jpegwasher.1 package-files/osx/.background/._background.png package-files/osx/.background/background.png package-files/osx/DS_Store package-files/osx/jedit package-files/windows/jEdit.url package-files/windows/jedit.launch4j.xml package-files/windows/win32installer.iss
diffstat 16 files changed, 612 insertions(+), 63 deletions(-) [+]
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 &lt;n5jrn@me.com&gt;"
-          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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/linux/deb/Packages	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,15 @@
+Package: jpegwasher
+Version: @app.version@
+Architecture: all
+Installed-Size: @deb.installed.size@
+Recommends: default-jre | openjdk-8-jre
+Suggests: default-jdk | openjdk-8-jdk
+Filename: @deb.repository.file@
+Size: @deb.size@
+MD5sum: @deb.md5@
+SHA1: @deb.sha1@
+SHA256: @deb.sha256@
+Section: contrib/graphics
+Homepage: http://notyouraveragetechie.com/JpegWasher.html
+Priority: optional
+Description: Removes privacy-compromising metadata from digital photos.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/linux/deb/control	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,11 @@
+Package: jpegwasher
+Version: @app.version@
+Architecture: all
+Section: contrib/graphics
+Homepage: http://www.jedit.org/
+Recommends: default-jre | openjdk-8-jre
+Build-depends: default-jdk | openjdk-8-jdk, ant
+Suggests: default-jdk | openjdk-8-jdk
+Priority: optional
+Installed-Size: @deb.installed.size@
+Description: Removes privacy-compromising metadata from digital photos.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/linux/deb/jpegwasher	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,2 @@
+?package(jpegwasher):needs="X11" section="Contrib/Graphics" \
+  title="JpegWasher" command="/usr/bin/jpegwasher"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/linux/deb/jpegwasher.desktop	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=JpegWasher
+GenericName=Privacy for your photos
+Comment=Removes privacy-compromising metadata
+Exec=jpegwasher
+Icon=/usr/share/jpegwasher/doc/jpegwasher.png
+Terminal=false
+Type=Application
+Categories=Graphics;Photography;Security;
+StartupNotify=true
+MimeType=image/jpeg;
+StartupWMClass=jpegwasher
+Keywords=Metadata;Remove;JPEG;Privacy
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/linux/deb/postinst	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,3 @@
+#!/bin/sh
+set -e
+if [ "$1" = "configure" ] && [ -x /usr/bin/update-menus ]; then update-menus ; fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/linux/deb/postrm	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,3 @@
+#!/bin/sh
+set -e
+if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/linux/jpegwasher	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Runs JpegWasher. Adopted from a similar script in the jEdit distribution.
+#
+# Find a java installation.
+if [ -z "${JAVA_HOME}" ]; then
+	echo 'Warning: $JAVA_HOME environment variable not set! Consider setting it.'
+	echo '         Attempting to locate java...'
+	j=`which java 2>/dev/null`
+	if [ -z "$j" ]; then
+		echo "Failed to locate the java virtual machine! Bailing..."
+		exit 1
+	else
+		echo "Found a virtual machine at: $j..."
+		JAVA="$j"
+	fi
+else
+	JAVA="${JAVA_HOME}/bin/java"
+fi
+
+# Antialias menus and dockable text:
+ANTIALIAS_ALL="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true"
+
+# Launch application.
+exec "${JAVA}" ${ANTIALIAS_ALL} -jar "/usr/share/JpegWasher/jars/@jar.filename@"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/linux/jpegwasher.1	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,20 @@
+.TH JPEGWASHER 1
+.SH NAME
+.B JpegWasher
+\- remove privacy-compromising metadata from digital photos
+.SH SYNOPSIS
+.B "jpegwasher"
+.SH DESCRIPTION
+This is a simple (and hopefully user-friendly), GUI-based tool for removing
+extraneous metadata from JPEG files containing digital photographs. More
+information is available in the built-in help for the program.
+.SH FILES
+.TP
+~/.jpegwasher/*
+Various configuration and other cached data lives here.
+.SH "SEE ALSO"
+.BR java (1)
+.BR kotlin (1)
+.SH BUGS
+Only works well on JPEG files. Use on other image file types is likely to
+damage them by removing important metadata.
Binary file package-files/osx/.background/._background.png has changed
Binary file package-files/osx/.background/background.png has changed
Binary file package-files/osx/DS_Store has changed
Binary file package-files/osx/jedit has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/windows/jEdit.url	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,3 @@
+[InternetShortcut]
+URL=http://www.jEdit.org
+IconFile=jedit.exe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/windows/jedit.launch4j.xml	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ jEdit - Programmer's Text Editor
+  ~ :tabSize=8:indentSize=8:noTabs=false:
+  ~ :folding=explicit:collapseFolds=1:
+  ~
+  ~ Copyright © 2014 jEdit contributors
+  ~
+  ~ This program is free software; you can redistribute it and/or
+  ~ modify it under the terms of the GNU General Public License
+  ~ as published by the Free Software Foundation; either version 2
+  ~ of the License, or any later version.
+  ~ This program is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  ~ GNU General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU General Public License
+  ~ along with this program; if not, write to the Free Software
+  ~ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+  -->
+
+<launch4jConfig>
+	<headerType>gui</headerType>
+	<outfile>jedit.exe</outfile>
+	<jar>@jar.filename@</jar>
+	<dontWrapJar>true</dontWrapJar>
+	<errTitle>jEdit</errTitle>
+	<downloadUrl>http://www.java.com/download</downloadUrl>
+	<supportUrl>http://www.jEdit.org</supportUrl>
+	<cmdLine>-reuseview</cmdLine>
+	<stayAlive>true</stayAlive>
+	<icon>@base.dir@/icons/jedit.ico</icon>
+	<jre>
+		<minVersion>@target.java.version@.0</minVersion>
+		<!-- Prefer JDK to make tools.jar available if possible. -->
+		<jdkPreference>preferJdk</jdkPreference>
+	</jre>
+	<versionInfo>
+		<fileVersion>@jedit.build.number@</fileVersion>
+		<txtFileVersion>@jedit.version@</txtFileVersion>
+		<fileDescription>jEdit - Programmer&apos;s Text Editor</fileDescription>
+		<copyright>Copyright © 1998-@current.year@ Contributors</copyright>
+		<productVersion>@jedit.build.number@</productVersion>
+		<txtProductVersion>@jedit.version@</txtProductVersion>
+		<productName>jEdit</productName>
+		<companyName>Contributors</companyName>
+		<internalName>jEdit</internalName>
+		<originalFilename>jedit.exe</originalFilename>
+	</versionInfo>
+</launch4jConfig>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package-files/windows/win32installer.iss	Wed Apr 29 21:49:21 2020 -0700
@@ -0,0 +1,288 @@
+; Inno Setup installer script for jEdit
+; encoding=UTF-8Y
+; (BOM seems the only way to let Inno Setup know the encoding)
+;
+; Björn "Vampire" Kautler <Vampire@jEdit.org>
+;
+
+[Setup]
+AllowNoIcons=true
+AppContact=jedit-devel@lists.sourceforge.net
+AppCopyright=Copyright © 1998-@current.year@ Contributors
+AppID=jEdit
+AppName=jEdit
+AppPublisher=Contributors
+AppPublisherURL=http://www.jEdit.org
+AppReadmeFile={app}\doc\README.txt
+AppSupportURL=http://www.jEdit.org
+AppUpdatesURL=http://www.jEdit.org
+AppVerName=jEdit @jedit.version@
+AppVersion=@jedit.version@
+ArchitecturesInstallIn64BitMode=x64
+ChangesAssociations=true
+ChangesEnvironment=true
+DefaultDirName={pf}\jEdit
+DefaultGroupName=jEdit
+FlatComponentsList=false
+; Do not use LicenseFile here as the GPL does not require acceptance of
+; the license for running the program, but still show it as information
+InfoBeforeFile=@dist.dir.for.innosetup@\doc\COPYING.txt
+OutputBaseFilename=@win.filename@
+OutputDir=@dist.dir.for.innosetup@
+SetupIconFile=@base.dir.for.innosetup@\icons\jedit.ico
+ShowTasksTreeLines=true
+SolidCompression=true
+SourceDir=@dist.dir.for.innosetup@
+TimeStampsInUTC=true
+UninstallDisplayIcon={app}\jedit.exe
+UninstallDisplayName=jEdit @jedit.version@
+VersionInfoCompany=Contributors
+VersionInfoCopyright=Copyright © 1998-@current.year@ Contributors
+VersionInfoDescription=Programmer's Text Editor
+VersionInfoTextVersion=@jedit.version@
+VersionInfoVersion=@jedit.build.number@
+WizardImageFile=@base.dir.for.innosetup@\icons\WindowsInstallerImage.bmp
+WizardSmallImageFile=@base.dir.for.innosetup@\icons\WindowsInstallerSmallImage.bmp
+
+[Components]
+Name: main; Description: jEdit - Programmer's Text Editor; Flags: fixed; Types: custom compact full
+Name: apidoc; Description: {cm:APIDocumentation}; Types: full
+Name: macros; Description: {cm:Macros}; Types: compact full
+
+[Tasks]
+Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
+Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}
+Name: autostartserver; Description: {cm:AutostartJEditServer}; GroupDescription: Autostart:
+
+[Files]
+Source: @jar.filename@; DestDir: {app}; Flags: ignoreversion sortfilesbyextension sortfilesbyname; Components: main
+Source: jedit.exe; DestDir: {app}; Flags: ignoreversion sortfilesbyextension sortfilesbyname; AfterInstall: updatePATHVariable; Components: main
+Source: classes\package-files\windows\jEdit.url; DestDir: {app}; Flags: ignoreversion sortfilesbyextension sortfilesbyname; Components: main
+Source: doc\*; DestDir: {app}\doc; Excludes: \doc\api\*; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
+Source: doc\api\*; DestDir: {app}\doc\api; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: apidoc
+Source: jars\QuickNotepad.jar; DestDir: {app}\jars; Flags: ignoreversion sortfilesbyextension sortfilesbyname; Components: main
+Source: macros\*; DestDir: {app}\macros; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: macros
+Source: keymaps\*; DestDir: {app}\keymaps; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
+Source: modes\*; DestDir: {app}\modes; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
+Source: properties\*; DestDir: {app}\properties; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
+Source: startup\*; DestDir: {app}\startup; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
+
+[Icons]
+Name: {group}\jEdit; Filename: {app}\jedit.exe; WorkingDir: {app}; Comment: jEdit - Programmer's Text Editor; HotKey: ctrl+alt+j
+Name: {group}\{cm:ProgramOnTheWeb,jEdit}; Filename: {app}\jEdit.url; Comment: jEdit Website
+Name: {group}\{cm:LaunchProgram,jEdit Server}; Filename: {app}\jedit.exe; Parameters: "-background -nogui --l4j-dont-wait"; WorkingDir: {app}; Comment: {cm:LaunchProgram,jEdit Server}
+Name: {group}\{cm:QuitProgram,jEdit Server}; Filename: {app}\jedit.exe; Parameters: "-quit"; WorkingDir: {app}; Comment: {cm:QuitProgram,jEdit Server}
+Name: {group}\{cm:UninstallProgram,jEdit}; Filename: {uninstallexe}; Comment: {cm:UninstallProgram,jEdit}
+Name: {userdesktop}\jEdit; Filename: {app}\jedit.exe; Tasks: desktopicon; WorkingDir: {app}; Comment: jEdit - Programmer's Text Editor
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\jEdit; Filename: {app}\jedit.exe; Tasks: quicklaunchicon; WorkingDir: {app}; Comment: jEdit - Programmer's Text Editor
+
+[Languages]
+Name: en; MessagesFile: compiler:Default.isl
+Name: de; MessagesFile: compiler:Languages\German.isl
+Name: eu; MessagesFile: compiler:Languages\Basque.isl
+Name: pt_BR; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
+Name: ca; MessagesFile: compiler:Languages\Catalan.isl
+Name: cs; MessagesFile: compiler:Languages\Czech.isl
+Name: da; MessagesFile: compiler:Languages\Danish.isl
+Name: nl; MessagesFile: compiler:Languages\Dutch.isl
+Name: fi; MessagesFile: compiler:Languages\Finnish.isl
+Name: fr; MessagesFile: compiler:Languages\French.isl
+Name: he; MessagesFile: compiler:Languages\Hebrew.isl
+Name: hu; MessagesFile: compiler:Languages\Hungarian.isl
+Name: it; MessagesFile: compiler:Languages\Italian.isl
+Name: ja; MessagesFile: compiler:Languages\Japanese.isl
+Name: no; MessagesFile: compiler:Languages\Norwegian.isl
+Name: pl; MessagesFile: compiler:Languages\Polish.isl
+Name: pt; MessagesFile: compiler:Languages\Portuguese.isl
+Name: ru; MessagesFile: compiler:Languages\Russian.isl
+Name: sk; MessagesFile: compiler:Languages\Slovak.isl
+Name: sl; MessagesFile: compiler:Languages\Slovenian.isl
+Name: es; MessagesFile: compiler:Languages\Spanish.isl
+
+[CustomMessages]
+; Default messages
+APIDocumentation=API Documentation (for macro and plugin development)
+Macros=Default set of macros (highly recommended)
+AutostartJEditServer=Start jEdit Server automatically on system startup
+QuitProgram=Quit %1
+OpenWithProgram=Open with %1
+pleaseQuitJEdit=The installer will now try to quit a running instance of jEdit.%nPlease save your work and exit jEdit for the installation to continue.
+ViewFile=View %1
+; German messages
+de.APIDocumentation=API Dokumentation (für Macro und Plugin Entwicklung)
+de.Macros=Standard Makros (sehr empfohlen)
+de.AutostartJEditServer=jEdit Server automatisch beim Hochfahren starten
+de.QuitProgram=%1 beenden
+de.OpenWithProgram=Mit %1 öffnen
+de.pleaseQuitJEdit=Die Installation wird nun versuchen eine laufende Instanz von jEdit zu beenden.%nBitte speichern Sie Ihre Arbeit und beenden Sie jEdit um mit der Installation fortzufahren.
+de.ViewFile=%1 anzeigen
+; French messages
+fr.APIDocumentation=API Documentation (pour développement de Macro et Plugin)
+fr.Macros=Macros standards (vraiment recommandées)
+fr.AutostartJEditServer=Démarrer automatiquement le serveur jEdit au démarrage de l'ordinateur
+fr.QuitProgram=Quitter %1
+fr.OpenWithProgram=Ouvrir avec %1
+fr.pleaseQuitJEdit=L'installation va tenter à présent de quitter une instance de jEdit en cours.%nVeuillez enregistrer votre travail et quitter jEdit afin de poursuivre l'installation.
+fr.ViewFile=Afficher %1
+
+[Registry]
+Root: HKCR; Subkey: *\Shell; Flags: uninsdeletekeyifempty
+Root: HKCR; Subkey: *\Shell\{cm:OpenWithProgram,jEdit}; Flags: uninsdeletekey
+Root: HKCR; Subkey: *\Shell\{cm:OpenWithProgram,jEdit}\Command; ValueType: string; ValueData: """{app}\jedit.exe"" ""%1"""
+Root: HKCR; Subkey: *\Shell\{cm:OpenWithProgram,jEdit}; ValueName: Icon; ValueType: string; ValueData: "{app}\jedit.exe"
+Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: string; ValueName: jEdit Server; ValueData: """{app}\jedit.exe"" -background -nogui --l4j-dont-wait"; Flags: uninsdeletevalue; Tasks: autostartserver
+
+[Run]
+Filename: {app}\jedit.exe; Description: {cm:ViewFile,README}; Parameters: "--l4j-dont-wait -nosettings ""{app}\doc\README.txt"""; WorkingDir: {app}; Flags: nowait postinstall skipifsilent
+Filename: {app}\jedit.exe; Description: {cm:ViewFile,CHANGES}; Parameters: "--l4j-dont-wait -nosettings ""{app}\doc\CHANGES.txt"""; WorkingDir: {app}; Flags: nowait postinstall skipifsilent
+Filename: {app}\jedit.exe; Description: {cm:LaunchProgram,jEdit}; Parameters: "--l4j-dont-wait"; WorkingDir: {app}; Flags: nowait postinstall skipifsilent; Tasks: not autostartserver
+Filename: {app}\jedit.exe; Description: {cm:LaunchProgram,jEdit}; Parameters: "--l4j-dont-wait -background"; WorkingDir: {app}; Flags: nowait postinstall skipifsilent; Tasks: autostartserver
+
+[Code]
+function findPathLine(lines: Array Of String): Integer;
+var
+	i : Integer;
+begin
+	for i := 0 to GetArrayLength(lines) - 1 do begin
+		if Uppercase(Copy(Trim(lines[i]),1,5)) = 'PATH=' then begin
+			Result := i;
+		end;
+	end;
+end;
+
+function appendAppDirIfNecessary(var path: String): Boolean;
+var
+	appDir : String;
+begin
+	appDir := ExpandConstant('{app}');
+	if Pos(Uppercase(appDir),Uppercase(path)) = 0 then begin
+		if Copy(path,Length(path),1) <> ';' then begin
+			path := path + ';';
+		end;
+		path := path + appDir;
+		Result := true;
+	end else begin
+		Result := false;
+	end;
+end;
+
+procedure updatePATHVariableInRegistry;
+var
+	path : String;
+begin
+	RegQueryStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',path);
+	if appendAppDirIfNecessary(path) then begin
+		RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',path);
+	end;
+end;
+
+procedure updatePATHVariableInAutoexecBat;
+var
+	lines : Array Of String;
+	pathLine : Integer;
+	path : String;
+begin
+	LoadStringsFromFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),lines);
+	pathLine := findPathLine(lines);
+	if pathLine = -1 then begin
+		pathLine := GetArrayLength(lines);
+		SetArrayLength(lines,pathLine + 1);
+		lines[pathLine] := 'PATH=';
+	end;
+	path := Trim(lines[pathLine]);
+	if appendAppDirIfNecessary(path) then begin
+		lines[pathLine] := path;
+		SaveStringsToFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),lines,false);
+	end;
+end;
+
+procedure updatePATHVariable;
+begin
+	if UsingWinNT then begin
+		updatePATHVariableInRegistry;
+	end else begin
+		updatePATHVariableInAutoexecBat;
+	end;
+end;
+
+function removeAppDirIfNecessary(var path: String): Boolean;
+var
+	appDir : String;
+	position : Integer;
+begin
+	appDir := ExpandConstant('{app}');
+	position := Pos(Uppercase(appDir),Uppercase(path));
+	if position = 0 then begin
+		Result := false;
+	end else begin
+		Delete(path,position,Length(appDir));
+		if Copy(path,position,1) = ';' then begin
+			Delete(path,position,1);
+		end;
+		Result := true;
+	end;
+end;
+
+procedure cleanPATHVariableInRegistry;
+var
+	path : String;
+begin
+	RegQueryStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',path);
+	if removeAppDirIfNecessary(path) then begin
+		RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',path);
+	end;
+end;
+
+procedure cleanPATHVariableInAutoexecBat;
+var
+	lines : Array Of String;
+	pathLine : Integer;
+	path : String;
+begin
+	LoadStringsFromFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),lines);
+	pathLine := findPathLine(lines);
+	if pathLine <> -1 then begin
+		path := Trim(lines[pathLine]);
+		if removeAppDirIfNecessary(path) then begin
+			lines[pathLine] := path;
+			SaveStringsToFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),lines,false);
+		end;
+	end;
+end;
+
+procedure cleanPATHVariable;
+begin
+	if UsingWinNT then begin
+		cleanPATHVariableInRegistry;
+	end else begin
+		cleanPATHVariableInAutoexecBat;
+	end;
+end;
+
+procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
+begin
+	if CurUninstallStep = usPostUninstall then begin
+		cleanPATHVariable;
+	end;
+end;
+
+procedure quitJEdit;
+var
+	resultCode : Integer;
+begin
+	case SuppressibleMsgBox(CustomMessage('pleaseQuitJEdit'),mbConfirmation,MB_OKCANCEL or MB_DEFBUTTON2, IDYES) of
+		IDOK: begin
+			ExtractTemporaryFile('@jar.filename@');
+			ExtractTemporaryFile('jedit.exe');
+			ExecAsOriginalUser(ExpandConstant('{tmp}/jedit.exe'),'-quit',ExpandConstant('{tmp}'),SW_SHOW,ewWaitUntilTerminated,resultCode);
+		end;
+		IDCANCEL: Abort;
+	end;
+end;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+	if CurStep = ssInstall then begin
+		quitJEdit;
+	end;
+end;