From d887083998c1d0b997a4650f070aabda88d59ba1 Mon Sep 17 00:00:00 2001 From: Martin Paljak Date: Sat, 30 Mar 2013 11:13:26 +0200 Subject: [PATCH] macosx: add new tool and SDK paths for OS X 10.8 Also: * Don't do a debug build * Don't download Tokend build pieces if already present. * Check the md5 of the "external binary" See https://github.com/OpenSC/OpenSC/pull/148 --- MacOSX/build-package.in | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/MacOSX/build-package.in b/MacOSX/build-package.in index e909eac2..c86df499 100755 --- a/MacOSX/build-package.in +++ b/MacOSX/build-package.in @@ -1,10 +1,26 @@ #!/bin/bash -# Building is only tested on 10.7 but package targets 10.6, 10.7 and 10.8 +# Building the installer is only tested and supported on 10.7 with Xcode 4.2.1 +# Built package targets 10.6, 10.7 and 10.8 +# Building should also work on other versions, YMMV set -ex test -x ./configure || ./bootstrap BUILDPATH=${PWD} -export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -mmacosx-version-min=10.6 -g" + +# Use new locations for SDK on 10.8 with Xcode 4.6 (?) +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" + ;; + *) + SYSROOT="/Developer/SDKs/MacOSX10.6.sdk" + PKGMAKER="/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker" + ;; +esac + +export CFLAGS="-isysroot $SYSROOT -arch i386 -arch x86_64 -mmacosx-version-min=10.6" export SED=/usr/bin/sed PREFIX=/Library/OpenSC @@ -16,8 +32,8 @@ export PKG_CONFIG_PATH=/usr/lib/pkgconfig --enable-shared \ --disable-static \ --enable-strict \ ---disable-assert - +--disable-assert \ +--enable-sm # TODO: remove this # always make clean make clean @@ -39,8 +55,7 @@ rm -f target/Library/OpenSC/lib/*.la test -d libp11 || git clone http://github.com/OpenSC/libp11.git (cd libp11 test -x confiure || ./bootstrap -./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=${BUILDPATH}/build && make && make install -cd ..) +./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=${BUILDPATH}/build && make && make install) test -d engine_pkcs11 || git clone http://github.com/OpenSC/engine_pkcs11.git (cd engine_pkcs11 test -x configure || ./bootstrap @@ -52,7 +67,15 @@ if ! test -e OpenSC.tokend; then fi # Fetch binary dependencies -curl -O https://www.opensc-project.org/downloads/build-10.6.tar.gz +if ! test -f build-10.6.tar.gz; then + curl -O https://www.opensc-project.org/downloads/build-10.6.tar.gz +fi + +# Check for correctness +if ! test $(md5 -q build-10.6.tar.gz) == "5686fb4dda6e9f1f07d06293a25fdd37"; then + echo "MD5 of binary components does not match!" + exit 1 +fi # Unpack the binary building components if ! test -e OpenSC.tokend/build; then @@ -72,7 +95,7 @@ mkdir -p target/usr/local/bin cp MacOSX/opensc-uninstall target/usr/local/bin # Build installer package -/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker \ +${PKGMAKER} \ -r target \ -o OpenSC-@PACKAGE_VERSION@.pkg \ -t "OpenSC @PACKAGE_VERSION@ for Mac OS X 10.6+" \