From a7934b307e453f72ed76e258a282e603fec9fc96 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 20 Apr 2011 12:14:44 +0000 Subject: [PATCH] MacInstaller: use autoconf to write the correct version to ReadMe files of installers. * Better version tagging of generated files * Bundle files necessary for OS X installer generation to the distribution targzip git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5376 c6295689-39f2-0310-b995-f0e70906c6a9 --- .../resources/{ReadMe.html => ReadMe.html.in} | 2 +- .../resources/{ReadMe.html => ReadMe.html.in} | 2 +- MacOSX/Makefile.am | 17 +++ MacOSX/build | 143 +----------------- MacOSX/build-package.in | 141 +++++++++++++++++ Makefile.am | 2 +- configure.ac | 4 + 7 files changed, 170 insertions(+), 141 deletions(-) rename MacOSX/10.5/resources/{ReadMe.html => ReadMe.html.in} (96%) rename MacOSX/10.6/resources/{ReadMe.html => ReadMe.html.in} (96%) create mode 100644 MacOSX/Makefile.am create mode 100755 MacOSX/build-package.in diff --git a/MacOSX/10.5/resources/ReadMe.html b/MacOSX/10.5/resources/ReadMe.html.in similarity index 96% rename from MacOSX/10.5/resources/ReadMe.html rename to MacOSX/10.5/resources/ReadMe.html.in index d1af8fb9..8e78c402 100644 --- a/MacOSX/10.5/resources/ReadMe.html +++ b/MacOSX/10.5/resources/ReadMe.html.in @@ -12,7 +12,7 @@ -

OpenSC, version 0.12.0

+

OpenSC, version @PACKAGE_VERSION@

for Mac OS X 10.5 (Leopard), universal (32-bit i386 and ppc)

OpenSC provides a set of libraries and utilities to work with smart cards. Its main focus is on cards that support cryptographic operations, and facilitate their use in security applications such as authentication, mail encryption and digital signatures.

diff --git a/MacOSX/10.6/resources/ReadMe.html b/MacOSX/10.6/resources/ReadMe.html.in similarity index 96% rename from MacOSX/10.6/resources/ReadMe.html rename to MacOSX/10.6/resources/ReadMe.html.in index 3519fcf9..8d618774 100644 --- a/MacOSX/10.6/resources/ReadMe.html +++ b/MacOSX/10.6/resources/ReadMe.html.in @@ -12,7 +12,7 @@ -

OpenSC, version 0.12.0

+

OpenSC, version @PACKAGE_VERSION@

for Mac OS X 10.6 (Snow Leopard), universal (32-bit and 64-bit)

OpenSC provides a set of libraries and utilities to work with smart cards. Its main focus is on cards that support cryptographic operations, and facilitate their use in security applications such as authentication, mail encryption and digital signatures.

diff --git a/MacOSX/Makefile.am b/MacOSX/Makefile.am new file mode 100644 index 00000000..699c1d4b --- /dev/null +++ b/MacOSX/Makefile.am @@ -0,0 +1,17 @@ +EXTRA_DIST = build build-package.in libtool-bundle opensc-uninstall \ + 10.5/resources \ + 10.5/resources/background.jpg \ + 10.5/resources/InstallationCheck.strings \ + 10.5/resources/License.html \ + 10.5/resources/ReadMe.html.in \ + 10.5/scripts \ + 10.5/scripts/InstallationCheck \ + 10.5/scripts/postflight \ + 10.6/resources \ + 10.6/resources/background.jpg \ + 10.6/resources/InstallationCheck.strings \ + 10.6/resources/License.html \ + 10.6/resources/ReadMe.html.in \ + 10.6/scripts \ + 10.6/scripts/InstallationCheck \ + 10.6/scripts/postflight diff --git a/MacOSX/build b/MacOSX/build index cc7294f4..54ca9cb6 100755 --- a/MacOSX/build +++ b/MacOSX/build @@ -1,141 +1,8 @@ #!/bin/bash set -ex -OSX_RELEASE=${1:-10.6} -INTEL_ONLY=${INTEL_ONLY:-no} +# generate configure test -x ./configure || ./bootstrap -BUILDPATH=${PWD} -case ${OSX_RELEASE} in - "10.5") - if test ${INTEL_ONLY} = "yes"; then - export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -mmacosx-version-min=10.5 -g" - else - export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc7400 -mmacosx-version-min=10.5 -g" - fi - ;; - "10.6") - export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -mmacosx-version-min=10.6 -g" - ;; - *) - echo "OSX ${OSX_RELEASE} is not supported!" - exit 1 - ;; -esac - -export SED=/usr/bin/sed -PREFIX=/Library/OpenSC -export PKG_CONFIG_PATH=/usr/lib/pkgconfig - -# In case of OSX 10.5, link against static libltdl to work around -# missing libltdl.3.dylib in 10.5 PPC version -test ${OSX_RELEASE} = "10.5" && export LTLIB_LIBS="/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libltdl.a" - -./configure --prefix=$PREFIX \ ---sysconfdir=$PREFIX/etc \ ---disable-dependency-tracking \ ---enable-shared \ ---disable-static \ ---enable-strict \ ---disable-assert - - -# check if make install is required -case "${OSX_RELEASE}" in - "10.5") if test ${INTEL_ONLY} = "yes"; then required_arch="i386"; else required_arch="ppc7400"; fi ;; - "10.6") required_arch="x86_64" ;; -esac - -if !(test -e src/libopensc/.libs/libopensc.dylib && (file src/libopensc/.libs/libopensc.dylib | grep $required_arch)); then - make clean -fi - -# compile -make -j 2 - -# copy files -rm -rf target -make install DESTDIR=${BUILDPATH}/target - -# remove garbage -rm target/Library/OpenSC/lib/onepin-opensc-pkcs11.la -rm target/Library/OpenSC/lib/opensc-pkcs11.la -rm target/Library/OpenSC/lib/pkcs11-spy.la -rm target/Library/OpenSC/lib/libopensc.la - -# generate .bundle (required by Adobe Acrobat) -./MacOSX/libtool-bundle target/Library/OpenSC/lib/opensc-pkcs11.so target/Library/OpenSC/lib - -if test ${OSX_RELEASE} = "10.6"; then - # Build libp11+engine_pkcs11. Attention! Uses modified branches from github! - test -d libp11 || git clone http://github.com/martinpaljak/libp11.git -b martin - (cd libp11 - test -x confiure || ./bootstrap - ./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=${BUILDPATH}/build && make && make install - cd ..) - test -d engine_pkcs11 || git clone http://github.com/martinpaljak/engine_pkcs11.git -b martin - (cd engine_pkcs11 - git checkout origin/martin - test -x configure || ./bootstrap - PKG_CONFIG_PATH=${BUILDPATH}/build/lib/pkgconfig ./configure --disable-dependency-tracking --prefix=/Library/OpenSC && make - make install DESTDIR=${BUILDPATH}/target) -fi - -if ! test -e OpenSC.tokend; then - git clone http://github.com/martinpaljak/OpenSC.tokend.git -fi - -case "${OSX_RELEASE}" in - "10.5") git --git-dir OpenSC.tokend/.git --work-tree OpenSC.tokend checkout --force origin/10.5-0.12.1; rm -rf OpenSC.tokend/build - if test ${INTEL_ONLY} = "yes"; then - sed -e 's/ ppc7400//g' OpenSC.tokend/Tokend.xcodeproj/project.pbxproj > project.tmp - mv project.tmp OpenSC.tokend/Tokend.xcodeproj/project.pbxproj - fi - ;; - "10.6") git --git-dir OpenSC.tokend/.git --work-tree OpenSC.tokend checkout --force origin/10.6-0.12.1; rm -rf OpenSC.tokend/build ;; -esac - -if ! test -e build-${OSX_RELEASE}.tar.gz; then - case ${OSX_RELEASE} in - "10.5") - curl http://martinpaljak.net/download/build-10.5.tar.gz -o build-${OSX_RELEASE}.tar.gz - ;; - "10.6") - curl http://martinpaljak.net/download/build-10.6.tar.gz -o build-${OSX_RELEASE}.tar.gz - ;; - esac -fi - -# Unpack the binary building components -if ! test -e OpenSC.tokend/build; then - tar -C OpenSC.tokend -xzvf build-${OSX_RELEASE}.tar.gz -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 -xcodebuild -configuration Deployment -project OpenSC.tokend/Tokend.xcodeproj -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 -/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker \ --r target \ --o OpenSC-${OSX_RELEASE}.pkg \ --t "OpenSC for Mac OS X ${OSX_RELEASE}" \ --i org.opensc-project.mac \ --n 0.12.0-svn \ --g 10.4 \ --b \ --v \ ---no-relocate \ --e MacOSX/${OSX_RELEASE}/resources \ --s MacOSX/${OSX_RELEASE}/scripts - -# Create .dmg -rm -f OpenSC-${OSX_RELEASE}.dmg -TIMESTAMP=$(date +%Y.%m.%d) -hdiutil create -srcfolder OpenSC-${OSX_RELEASE}.pkg -volname "OpenSC for Mac OS X ${OSX_RELEASE} (${TIMESTAMP})" OpenSC-${OSX_RELEASE}.dmg +# configure once to set the version in build script +./configure +# build and package installer +bash ./MacOSX/build-package \ No newline at end of file diff --git a/MacOSX/build-package.in b/MacOSX/build-package.in new file mode 100755 index 00000000..8dd16e63 --- /dev/null +++ b/MacOSX/build-package.in @@ -0,0 +1,141 @@ +#!/bin/bash +set -ex +OSX_RELEASE=${1:-10.6} +INTEL_ONLY=${INTEL_ONLY:-no} +test -x ./configure || ./bootstrap +BUILDPATH=${PWD} +case ${OSX_RELEASE} in + "10.5") + if test ${INTEL_ONLY} = "yes"; then + export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -mmacosx-version-min=10.5 -g" + else + export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc7400 -mmacosx-version-min=10.5 -g" + fi + ;; + "10.6") + export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -mmacosx-version-min=10.6 -g" + ;; + *) + echo "OSX ${OSX_RELEASE} is not supported!" + exit 1 + ;; +esac + +export SED=/usr/bin/sed +PREFIX=/Library/OpenSC +export PKG_CONFIG_PATH=/usr/lib/pkgconfig + +# In case of OSX 10.5, link against static libltdl to work around +# missing libltdl.3.dylib in 10.5 PPC version +test ${OSX_RELEASE} = "10.5" && export LTLIB_LIBS="/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libltdl.a" + +./configure --prefix=$PREFIX \ +--sysconfdir=$PREFIX/etc \ +--disable-dependency-tracking \ +--enable-shared \ +--disable-static \ +--enable-strict \ +--disable-assert + + +# check if make install is required +case "${OSX_RELEASE}" in + "10.5") if test ${INTEL_ONLY} = "yes"; then required_arch="i386"; else required_arch="ppc7400"; fi ;; + "10.6") required_arch="x86_64" ;; +esac + +if !(test -e src/libopensc/.libs/libopensc.dylib && (file src/libopensc/.libs/libopensc.dylib | grep $required_arch)); then + make clean +fi + +# compile +make -j 2 + +# copy files +rm -rf target +make install DESTDIR=${BUILDPATH}/target + +# remove garbage +rm target/Library/OpenSC/lib/onepin-opensc-pkcs11.la +rm target/Library/OpenSC/lib/opensc-pkcs11.la +rm target/Library/OpenSC/lib/pkcs11-spy.la +rm target/Library/OpenSC/lib/libopensc.la + +# generate .bundle (required by Adobe Acrobat) +./MacOSX/libtool-bundle target/Library/OpenSC/lib/opensc-pkcs11.so target/Library/OpenSC/lib + +if test ${OSX_RELEASE} = "10.6"; then + # Build libp11+engine_pkcs11. Attention! Uses modified branches from github! + test -d libp11 || git clone http://github.com/martinpaljak/libp11.git -b martin + (cd libp11 + test -x confiure || ./bootstrap + ./configure --enable-static --disable-shared --disable-dependency-tracking --prefix=${BUILDPATH}/build && make && make install + cd ..) + test -d engine_pkcs11 || git clone http://github.com/martinpaljak/engine_pkcs11.git -b martin + (cd engine_pkcs11 + git checkout origin/martin + test -x configure || ./bootstrap + PKG_CONFIG_PATH=${BUILDPATH}/build/lib/pkgconfig ./configure --disable-dependency-tracking --prefix=/Library/OpenSC && make + make install DESTDIR=${BUILDPATH}/target) +fi + +if ! test -e OpenSC.tokend; then + git clone http://github.com/martinpaljak/OpenSC.tokend.git +fi + +case "${OSX_RELEASE}" in + "10.5") git --git-dir OpenSC.tokend/.git --work-tree OpenSC.tokend checkout --force origin/10.5-0.12.1; rm -rf OpenSC.tokend/build + if test ${INTEL_ONLY} = "yes"; then + sed -e 's/ ppc7400//g' OpenSC.tokend/Tokend.xcodeproj/project.pbxproj > project.tmp + mv project.tmp OpenSC.tokend/Tokend.xcodeproj/project.pbxproj + fi + ;; + "10.6") git --git-dir OpenSC.tokend/.git --work-tree OpenSC.tokend checkout --force origin/10.6-0.12.1; rm -rf OpenSC.tokend/build ;; +esac + +if ! test -e build-${OSX_RELEASE}.tar.gz; then + case ${OSX_RELEASE} in + "10.5") + curl http://martinpaljak.net/download/build-10.5.tar.gz -o build-${OSX_RELEASE}.tar.gz + ;; + "10.6") + curl http://martinpaljak.net/download/build-10.6.tar.gz -o build-${OSX_RELEASE}.tar.gz + ;; + esac +fi + +# Unpack the binary building components +if ! test -e OpenSC.tokend/build; then + tar -C OpenSC.tokend -xzvf build-${OSX_RELEASE}.tar.gz +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 +xcodebuild -configuration Deployment -project OpenSC.tokend/Tokend.xcodeproj +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 +/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker \ +-r target \ +-o OpenSC-@PACKAGE_VERSION@-${OSX_RELEASE}.pkg \ +-t "OpenSC @PACKAGE_VERSION@ for Mac OS X ${OSX_RELEASE}" \ +-i org.opensc-project.mac \ +-n @PACKAGE_VERSION@ \ +-g 10.5 \ +-b \ +-v \ +--no-relocate \ +-e MacOSX/${OSX_RELEASE}/resources \ +-s MacOSX/${OSX_RELEASE}/scripts + +# Create .dmg +rm -f OpenSC-@PACKAGE_VERSION@-${OSX_RELEASE}.dmg +TIMESTAMP=$(date +%Y.%m.%d) +hdiutil create -srcfolder OpenSC-@PACKAGE_VERSION@-${OSX_RELEASE}.pkg -volname "OpenSC @PACKAGE_VERSION@ for Mac OS X ${OSX_RELEASE} (${TIMESTAMP})" OpenSC-@PACKAGE_VERSION@-${OSX_RELEASE}.dmg diff --git a/Makefile.am b/Makefile.am index dbd8f304..ac290d6d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ MAINTAINERCLEANFILES = \ $(srcdir)/packaged EXTRA_DIST = Makefile.mak svnignore -SUBDIRS = etc src win32 doc +SUBDIRS = etc src win32 doc MacOSX dist_noinst_SCRIPTS = bootstrap dist_noinst_DATA = README \ diff --git a/configure.ac b/configure.ac index 4ab2c4fe..f4fdf9d4 100644 --- a/configure.ac +++ b/configure.ac @@ -596,6 +596,10 @@ AC_CONFIG_FILES([ win32/winconfig.h win32/OpenSC.iss win32/OpenSC.wxs + MacOSX/Makefile + MacOSX/build-package + MacOSX/10.5/resources/ReadMe.html + MacOSX/10.6/resources/ReadMe.html ]) AC_OUTPUT