From d4a3edac088eda9f58ba740938a289df4ba16adb Mon Sep 17 00:00:00 2001 From: Martin Paljak Date: Wed, 18 Dec 2013 09:48:02 +0000 Subject: [PATCH] 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 --- MacOSX/Distribution.xml.in | 24 +++++ MacOSX/Makefile.am | 7 +- MacOSX/build-package.in | 28 ++---- MacOSX/resources/InstallationCheck.strings | Bin 234 -> 0 bytes MacOSX/resources/Welcome.html.in | 17 ++++ MacOSX/scripts/InstallationCheck | 111 --------------------- MacOSX/scripts/{postflight => postinstall} | 0 configure.ac | 2 + 8 files changed, 54 insertions(+), 135 deletions(-) create mode 100644 MacOSX/Distribution.xml.in delete mode 100644 MacOSX/resources/InstallationCheck.strings create mode 100644 MacOSX/resources/Welcome.html.in delete mode 100755 MacOSX/scripts/InstallationCheck rename MacOSX/scripts/{postflight => postinstall} (100%) diff --git a/MacOSX/Distribution.xml.in b/MacOSX/Distribution.xml.in new file mode 100644 index 00000000..b408abe4 --- /dev/null +++ b/MacOSX/Distribution.xml.in @@ -0,0 +1,24 @@ + + + + + + + + + + OpenSC @PACKAGE_VERSION@ for OS X 10.9+ + + + + + + + + + + + + + OpenSC.pkg + \ No newline at end of file diff --git a/MacOSX/Makefile.am b/MacOSX/Makefile.am index a308ffb2..76587767 100644 --- a/MacOSX/Makefile.am +++ b/MacOSX/Makefile.am @@ -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 diff --git a/MacOSX/build-package.in b/MacOSX/build-package.in index c5f943e3..c28840b6 100755 --- a/MacOSX/build-package.in +++ b/MacOSX/build-package.in @@ -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 diff --git a/MacOSX/resources/InstallationCheck.strings b/MacOSX/resources/InstallationCheck.strings deleted file mode 100644 index 58249f7b0391c1229e947f72938740c78053a58d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 234 zcmXw!K?=e!5JlhGQ^X#i*p-NQ1W|C~R%%Oy(rVKxUS55zN=W$s=gmy=ekEiqNeFD* z30qF&svQT2x;+-Kfqc<&W*DeoQnet$SEK vQmNG5UWGn-j=dUHudiJ}RZaPS-gp-#Hg{Gh-}5vXxH|LurpVkst(oxw!bmA4 diff --git a/MacOSX/resources/Welcome.html.in b/MacOSX/resources/Welcome.html.in new file mode 100644 index 00000000..4255371f --- /dev/null +++ b/MacOSX/resources/Welcome.html.in @@ -0,0 +1,17 @@ + + + + Welcome to OpenSC + + + + +

Welcome to OpenSC!

+

OpenSC stands for Open Source Smart Cards. Follow the force!

+ + \ No newline at end of file diff --git a/MacOSX/scripts/InstallationCheck b/MacOSX/scripts/InstallationCheck deleted file mode 100755 index 82ffcb94..00000000 --- a/MacOSX/scripts/InstallationCheck +++ /dev/null @@ -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 = ; - $plistData =~ /(.*?)<\/dict>/gis; - - @items = split(//, $plistData); - - shift @items; - foreach $item (@items) { - $item =~ /(.*?)<\/key>.*?(.*?)<\/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 () { - $BUF .= $LINE; - } - close(IOREGOUT); - - foreach $ITEM (@_) { - if($BUF =~ /$ITEM/g) { - $RESULT = 1; - last; - } - } - - return($RESULT); -} - diff --git a/MacOSX/scripts/postflight b/MacOSX/scripts/postinstall similarity index 100% rename from MacOSX/scripts/postflight rename to MacOSX/scripts/postinstall diff --git a/configure.ac b/configure.ac index c8f5c843..7de2a9b3 100644 --- a/configure.ac +++ b/configure.ac @@ -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