-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AuthentiCode sign launcher, uninstaller (#614)
* Sign uninstall.exe, qz-tray.exe * Cleanup and organize ant build scripts Co-authored-by: Berenz <[email protected]>
- Loading branch information
Showing
15 changed files
with
654 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
<project name="apple-installer" basedir="../../"> | ||
<property file="ant/project.properties"/> | ||
<import file="${basedir}/ant/version.xml"/> | ||
|
||
<!-- | ||
################################################################ | ||
# Apple Installer # | ||
################################################################ | ||
--> | ||
<!-- Inform javafx.xml --> | ||
<target name="pkgbuild-preflight"> | ||
<property name="target.platform.mac" value="true"/> | ||
</target> | ||
<target name="build-pkg" depends="get-version"> | ||
<echo level="info">Creating installer using pkgbuild</echo> | ||
|
||
<property file="ant/apple/apple.properties"/> | ||
|
||
<!-- | ||
################################### | ||
# Build MacOS Bundle Structure # | ||
################################### | ||
--> | ||
|
||
<mkdir dir="${dist.dir}/Contents/Resources"/> | ||
<copy file="assets/branding/apple-icon.icns" tofile="${dist.dir}/Contents/Resources/${project.filename}.icns"/> | ||
|
||
<mkdir dir="${dist.dir}/Contents/MacOS"/> | ||
<copy file="ant/unix/unix-launcher.sh.in" tofile="${dist.dir}/Contents/MacOS/${project.name}"> | ||
<filterchain><expandproperties/></filterchain> | ||
</copy> | ||
|
||
<copy file="ant/apple/apple-bundle.plist.in" tofile="${dist.dir}/Contents/Info.plist"> | ||
<filterchain><expandproperties/></filterchain> | ||
</copy> | ||
|
||
<copy file="ant/unix/unix-uninstall.sh.in" tofile="${dist.dir}/uninstall"> | ||
<filterchain><expandproperties/></filterchain> | ||
</copy> | ||
|
||
<mkdir dir="${build.dir}/scripts/payload"/> | ||
|
||
<copy file="ant/apple/apple-preinstall.sh.in" tofile="${build.dir}/scripts/preinstall"> | ||
<filterchain><expandproperties/></filterchain> | ||
</copy> | ||
|
||
<copy file="ant/apple/apple-postinstall.sh.in" tofile="${build.dir}/scripts/postinstall"> | ||
<filterchain><expandproperties/></filterchain> | ||
</copy> | ||
|
||
<!-- Copy of the jar is needed for preinstall tasks --> | ||
<copy todir="${build.dir}/scripts/payload"> | ||
<fileset dir="${dist.dir}"/> | ||
</copy> | ||
|
||
<chmod perm="a+x" type="file"> | ||
<fileset dir="${build.dir}/scripts"> | ||
<include name="preinstall"/> | ||
<include name="postinstall"/> | ||
</fileset> | ||
<fileset dir="${build.dir}/scripts/payload"> | ||
<include name="**/${project.name}"/> | ||
<include name="**/uninstall"/> | ||
</fileset> | ||
</chmod> | ||
|
||
<!-- Disable signing and append "-community" if id is missing --> | ||
<exec executable="bash" failonerror="false" resultproperty="codesign.qz"> | ||
<arg value="-c"/> | ||
<arg value="security find-identity -v |grep '(${apple.packager.signid})'"/> | ||
</exec> | ||
<!-- pkgbuild will fail on blank options; use ownership flag as a dummy fallback --> | ||
<condition property="codesign.qz.cmd" value="--sign" else="--ownership"> | ||
<equals arg1="${codesign.qz}" arg2="0"/> | ||
</condition> | ||
<condition property="codesign.qz.val" value="${apple.packager.signid}" else="recommended"> | ||
<equals arg1="${codesign.qz}" arg2="0"/> | ||
</condition> | ||
<condition property="codesign.qz.suffix" value="" else="-community"> | ||
<equals arg1="${codesign.qz}" arg2="0"/> | ||
</condition> | ||
|
||
<exec executable="pkgbuild" failonerror="true"> | ||
<arg value="--identifier"/> | ||
<arg value="${project.filename}"/> | ||
|
||
<arg value="--nopayload"/> | ||
|
||
<arg value="--install-location"/> | ||
<arg value="/Applications/${project.name}.app"/> | ||
|
||
<arg value="--scripts"/> | ||
<arg value="${build.dir}/scripts"/> | ||
|
||
<arg value="--version"/> | ||
<arg value="${build.version}"/> | ||
|
||
<arg value="${codesign.qz.cmd}"/> | ||
<arg value="${codesign.qz.val}"/> | ||
|
||
<arg value="${out.dir}/${project.filename}${build.type}-${build.version}${codesign.qz.suffix}.pkg"/> | ||
</exec> | ||
|
||
<!-- Cleanup lingering files (for other OS installers) --> | ||
<delete dir="${dist.dir}/Contents/Resources"/> | ||
<delete dir="${dist.dir}/Contents/MacOS"/> | ||
</target> | ||
|
||
<target name="codesign-jars" if="codesign.mac"> | ||
<property file="ant/apple/apple.properties"/> | ||
<exec executable="security"> | ||
<arg value="add-certificates"/> | ||
<arg value="${basedir}/ant/apple/certs/apple-packager.cer"/> | ||
<arg value="${basedir}/ant/apple/certs/apple-intermediate.cer"/> | ||
<arg value="${basedir}/ant/apple/certs/apple-codesign.cer"/> | ||
</exec> | ||
<antcall target="codesign-libs"> | ||
<param name="signing.jarname" value="communication/jna-*.jar"/> | ||
<param name="signing.excluded" value="communication/jna-platform-*.jar"/> | ||
<param name="signing.filetype" value="*.jnilib"/> | ||
</antcall> | ||
<antcall target="codesign-libs"> | ||
<param name="signing.jarname" value="communication/jssc-*.jar"/> | ||
<param name="signing.filetype" value="*.dylib"/> | ||
</antcall> | ||
<antcall target="codesign-libs"> | ||
<param name="signing.jarname" value="communication/hid4java-*.jar"/> | ||
<param name="signing.filetype" value="*.dylib"/> | ||
</antcall> | ||
<antcall target="codesign-libs"> | ||
<param name="signing.jarname" value="communication/libusb4java-*-osx-x86.jar"/> | ||
<param name="signing.filetype" value="*.dylib"/> | ||
</antcall> | ||
<antcall target="codesign-libs"> | ||
<param name="signing.jarname" value="communication/libusb4java-*-osx-x86_64.jar"/> | ||
<param name="signing.filetype" value="*.dylib"/> | ||
</antcall> | ||
<!-- Manually sign standalone libs --> | ||
<!--use xargs to loop over and codesign all files--> | ||
<echo level="info" message="Signing ${dist.dir}/libs/*.dylib using ${apple.packager.signid}"/> | ||
<exec executable="bash" failonerror="true"> | ||
<arg value="-c"/> | ||
<arg value="echo "$(find ${dist.dir}/libs/*.dylib)" |tr ':' '\n' |xargs codesign -s "${apple.packager.signid}" -v"/> | ||
</exec> | ||
|
||
</target> | ||
|
||
<target name="codesign-libs"> | ||
<path id="found.jar"> | ||
<first> | ||
<fileset dir="lib"> | ||
<include name="**/${signing.jarname}"/> | ||
<exclude name="**/${signing.excluded}" if="signing.excluded"/> | ||
</fileset> | ||
</first> | ||
</path> | ||
<pathconvert property="found.jar.path" refid="found.jar"/> | ||
|
||
<unzip src="${found.jar.path}" dest="${out.dir}/jar-signing"/> | ||
<path id="found.files"> | ||
<fileset dir="${out.dir}/jar-signing"> | ||
<include name="**/${signing.filetype}"/> | ||
</fileset> | ||
</path> | ||
<pathconvert property="found.files.paths" refid="found.files" pathsep=" "/> | ||
|
||
<!-- No-op: makes IntelliJ happy with the undefined "signing.delete" --> | ||
<condition description="suppress property warning" property="signing.delete" value="${signing.delete}"> | ||
<isset property="signing.delete"/> | ||
</condition> | ||
<delete verbose="true"> | ||
<fileset dir="${out.dir}/jar-signing"> | ||
<include name="**/${signing.delete}" if="signing.delete"/> | ||
</fileset> | ||
</delete> | ||
|
||
<!-- Use xargs to loop over and codesign all files--> | ||
<echo message="Signing ${found.jar.path} using ${apple.packager.signid}"/> | ||
<exec executable="bash" failonerror="true"> | ||
<arg value="-c"/> | ||
<arg value="echo "${found.files.paths}" |tr ':' '\n' |xargs codesign -s "${apple.packager.signid}" -v"/> | ||
</exec> | ||
|
||
<pathconvert property="found.jar.rel"> | ||
<path refid="found.jar"/> | ||
<globmapper from="${basedir}/*" to="*" handledirsep="true"/> | ||
</pathconvert> | ||
<zip destfile="${sign.lib.dir}/${found.jar.rel}" basedir="${out.dir}/jar-signing" excludes="dont*.*"/> | ||
|
||
<!-- Cleanup temp folder--> | ||
<delete dir="${out.dir}/jar-signing"/> | ||
</target> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
# Download icu4j source code, build using ant, | ||
# it will generate icu4j.jar and icu4j-charset.jar | ||
# Run slim-icu.py to generate slim version | ||
# Currently this script will only keep Arabic and English data | ||
# 2018 Yohanes Nugroho <[email protected]> (@yohanes) | ||
# | ||
# 1. Download icu4j source code, build using ant. | ||
# It will generate icu4j.jar and icu4j-charset.jar | ||
# | ||
# 2. Run slim-icu.py to generate slim version. | ||
# | ||
# To invoke from ant, add python to $PATH | ||
# and add the following to build.xml: | ||
# | ||
# <target name="distill-icu" depends="init"> | ||
# <exec executable="python"> | ||
# <arg line="ant/lib/slim-icu.py lib/charsets"/> | ||
# </exec> | ||
# </target> | ||
# | ||
# ... then call: ant distill-icu | ||
# | ||
# 3. Overwrite files in lib/charsets/ | ||
|
||
# slim ICU | ||
import sys | ||
|
Oops, something went wrong.