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
This commit is contained in:
martin 2011-04-20 12:14:44 +00:00
parent 094eb8697c
commit a7934b307e
7 changed files with 170 additions and 141 deletions

View File

@ -12,7 +12,7 @@
<body>
<h1>OpenSC, version 0.12.0</h1>
<h1>OpenSC, version @PACKAGE_VERSION@</h1>
<p>for Mac OS X 10.5 (Leopard), universal (32-bit i386 and ppc)</p>
<p>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.</p>

View File

@ -12,7 +12,7 @@
<body>
<h1>OpenSC, version 0.12.0</h1>
<h1>OpenSC, version @PACKAGE_VERSION@</h1>
<p>for Mac OS X 10.6 (Snow Leopard), universal (32-bit and 64-bit)</p>
<p>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.</p>

17
MacOSX/Makefile.am Normal file
View File

@ -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

View File

@ -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

141
MacOSX/build-package.in Executable file
View File

@ -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

View File

@ -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 \

View File

@ -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