macosx: update package building to modern tools

PackageMaker has been deprecated since Xcode 4.6.
pkgbuild and productbuild have been available since 10.6.6
This commit is contained in:
Martin Paljak 2013-12-18 09:48:02 +00:00
parent cfe0e7368d
commit d4a3edac08
8 changed files with 54 additions and 135 deletions

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="2">
<allowed-os-versions>
<os-version min="10.9"/>
</allowed-os-versions>
<background file="background.jpg" mime-type="image/jpeg" scaling="tofit"/>
<readme file="Readme.html" mime-type="text/html"/>
<license file="License.html" mime-type="text.html"/>
<welcome file="Welcome.html" mime-type="text.html"/>
<title>OpenSC @PACKAGE_VERSION@ for OS X 10.9+</title>
<pkg-ref id="com.apple.tokend.opensc"/>
<options customize="never" require-scripts="false"/>
<choices-outline>
<line choice="default">
<line choice="com.apple.tokend.opensc"/>
</line>
</choices-outline>
<choice id="default"/>
<choice id="com.apple.tokend.opensc" visible="true">
<pkg-ref id="com.apple.tokend.opensc"/>
</choice>
<pkg-ref id="com.apple.tokend.opensc" onConclusion="none">OpenSC.pkg</pkg-ref>
</installer-gui-script>

View File

@ -1,10 +1,9 @@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
EXTRA_DIST = build build-package.in libtool-bundle opensc-uninstall \
EXTRA_DIST = build build-package.in Distribution.xml.in libtool-bundle opensc-uninstall \
resources \
resources/background.jpg \
resources/InstallationCheck.strings \
resources/License.html \
resources/ReadMe.html.in \
resources/Welcome.html.in
scripts \
scripts/InstallationCheck \
scripts/postflight
scripts/postinstall

View File

@ -1,8 +1,6 @@
#!/bin/bash
# Building the installer is only tested and supported on 10.9 with Xcode 5.0.1
# Command line tools for Xcode required, install with "xcode-select --install"
# PackageMaker comes from Auxiliary Tools for Xcode - Late July 2012
# Download from https://developer.apple.com/downloads/index.action?name=packagemaker#
# Built package targets 10.9+
# Building should also work on older versions with older revisions or slight changes, YMMV
@ -15,17 +13,14 @@ OSX_RELEASE=`sw_vers -productVersion`
case ${OSX_RELEASE:0:4} in
"10.8")
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"
PKGMAKER="/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"
export CFLAGS="-isysroot $SYSROOT -arch x86_64 -mmacosx-version-min=10.8"
;;
"10.9")
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"
PKGMAKER="/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"
export CFLAGS="-isysroot $SYSROOT -arch x86_64 -mmacosx-version-min=10.9"
;;
*)
SYSROOT="/Developer/SDKs/MacOSX10.6.sdk"
PKGMAKER="/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"
export CFLAGS="-isysroot $SYSROOT -arch x86_64 -mmacosx-version-min=10.6"
;;
esac
@ -82,28 +77,21 @@ fi
# Create the symlink to OpenSC sources
test -L OpenSC.tokend/build/opensc-src || ln -sf ${BUILDPATH}/src OpenSC.tokend/build/opensc-src
# build and copy OpenSC.tokend
# Build and copy OpenSC.tokend
xcodebuild -configuration Deployment -project OpenSC.tokend/Tokend.xcodeproj
# Prepare target root
# Copy Tokend
mkdir -p target/System/Library/Security/tokend
mv OpenSC.tokend/build/OpenSC.tokend target/System/Library/Security/tokend
# The "UnInstaller"
mkdir -p target/usr/local/bin
cp MacOSX/opensc-uninstall target/usr/local/bin
# Build installer package
${PKGMAKER} \
-r target \
-o OpenSC-@PACKAGE_VERSION@.pkg \
-t "OpenSC @PACKAGE_VERSION@ for Mac OS X 10.9+" \
-i org.opensc-project.mac \
-n @PACKAGE_VERSION@ \
-g 10.4 \
-b \
-v \
--no-relocate \
-e MacOSX/resources \
-s MacOSX/scripts
# Build package
pkgbuild --root target --scripts MacOSX/scripts --identifier org.opensc-project.mac --version @PACKAGE_VERSION@ --install-location / OpenSC.pkg
# Build product
productbuild --distribution MacOSX/Distribution.xml --package-path . --resources MacOSX/resources OpenSC-@PACKAGE_VERSION@.pkg
# Create .dmg
rm -f OpenSC-@PACKAGE_VERSION@.dmg

View File

@ -0,0 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Welcome to OpenSC</title>
<style type="text/css">
body { font: 12px Helvetica; }
h1 { font-size: 16px; }
h2 { font-size: 13px; padding-bottom: 5px; padding-top: 5px; }
p { padding: 10px; }
</style>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>Welcome to OpenSC!</h1>
<p>OpenSC stands for Open Source Smart Cards. Follow the force!</p>
</body>
</html>

View File

@ -1,111 +0,0 @@
#!/usr/bin/perl
my $SYSTEM_VERS = "/System/Library/CoreServices/SystemVersion.plist";
my $EXIT_VALUE = 0;
if ( $ENV{OS_INSTALL} == 1) {
exit (0);
}
DO_CHECKS: {
# 10.9 or higher system must be active
if(CheckVersion("$SYSTEM_VERS", "10.9", "ProductVersion", "<")) {
$EXIT_VALUE = ((1 << 6) | ( 1 << 5 ) | 17 );
last;
}
}
exit($EXIT_VALUE);
###
sub CheckVersion
{
my $path = $_[0];
my $version = $_[1];
my $keyName = $_[2];
my $operator = $_[3];
if (! -e $path) {
return 0;
}
if (!$operator) {
$operator = "==";
}
my $oldSeperator = $/;
$/ = \0;
open( PLIST, "$path") || do {
return 0;
};
$plistData = <PLIST>;
$plistData =~ /<dict>(.*?)<\/dict>/gis;
@items = split(/<key>/, $plistData);
shift @items;
foreach $item (@items) {
$item =~ /(.*?)<\/key>.*?<string>(.*?)<\/string>/gis;
$versiondata{ $1 } = $2;
}
close(PLIST);
$/ = $oldSeperator;
@theVersionArray = split(/\./, $versiondata{$keyName});
for ($i = 0; $i < 3; $i++) {
if(!$theVersionArray[$i]) {
$theVersionArray[$i] = '0';
}
}
@versionArray = split(/\./, $version);
my $actualVersion;
for ($i = 0; $i < 3; $i++) {
if (($theVersionArray[$i] != $versionArray[$i]) or ($i == 2)) {
$actualVersion = $theVersionArray[$i];
$version = $versionArray[$i];
last;
}
}
my $expression = '$actualVersion ' . $operator . ' $version';
if( eval ($expression) )
{
return 1;
}
else
{
return 0;
}
}
sub CheckIOReg
{
$RESULT = 0;
open(IOREGOUT, "/usr/sbin/ioreg |");
foreach $LINE (<IOREGOUT>) {
$BUF .= $LINE;
}
close(IOREGOUT);
foreach $ITEM (@_) {
if($BUF =~ /$ITEM/g) {
$RESULT = 1;
last;
}
}
return($RESULT);
}

View File

@ -649,7 +649,9 @@ AC_CONFIG_FILES([
win32/OpenSC.wxs
MacOSX/Makefile
MacOSX/build-package
MacOSX/Distribution.xml
MacOSX/resources/ReadMe.html
MacOSX/resources/Welcome.html
])
AC_OUTPUT