From 1bd7e5d2f54383b27ed1f9c521f5fdff2f613e8b Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 27 Aug 2010 09:39:24 +0000 Subject: [PATCH] MacInstaller: Add .bundle generation capability from SCA. Thanks to Jean-Pierre Szikora for the reminder. Adobe Acrobat is one program that requires the .bundle format. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4657 c6295689-39f2-0310-b995-f0e70906c6a9 --- MacOSX/build | 3 ++ MacOSX/libtool-bundle | 104 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100755 MacOSX/libtool-bundle diff --git a/MacOSX/build b/MacOSX/build index af46f340..a3413e65 100755 --- a/MacOSX/build +++ b/MacOSX/build @@ -69,6 +69,9 @@ 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 + case "${OSX_RELEASE}" in "10.6") # Build libp11+engine_pkcs11 diff --git a/MacOSX/libtool-bundle b/MacOSX/libtool-bundle new file mode 100755 index 00000000..96f094d8 --- /dev/null +++ b/MacOSX/libtool-bundle @@ -0,0 +1,104 @@ +#!/bin/sh +# A shell script to create MacOS X bundles +# from files created by GNU libtool. +# Incomplete, but works. +# +# $Id: libtool-bundle 1533 2003-10-16 20:41:34Z aet $ +# +# + +set -e +verbose=0 + +verbose_msg () +{ + if [ $verbose -ne 0 ]; then + echo "libtool-bundle: $@" + fi +} + +error_msg () +{ + echo 1>&2 "libtool-bundle: $@" +} + +usage () +{ + error_msg "Usage: $0 [-e extra XML data] [Mach-O bundle file] [destination directory] " + exit 1 +} + +case $1 in + -e) shift; if [ "$1" ]; then extradata=$1; shift; else usage; fi; ;; +esac + +[ $# -le 1 -o $# -ge 4 ] && usage + +sofile=$1 +[ ! -f $sofile ] && error_msg "Not a file or file not found: $sofile" && exit 1 +case "$sofile" in +*.so*) + # Assume it's ok + ;; +*) + error_msg "Invalid bundle: $sofile" + exit 1 + ;; +esac + +destdir=$2 +[ ! -d $destdir -o ! -w $destdir ] && error_msg "Not a directory or no write access: $destdir" && exit 1 + +name="$sofile" +[ $# -eq 3 ] && name=$3 +name=`echo $name | sed -e "s@.*/@@" -e "s@\.so.*@@"` +root="$destdir/${name}.bundle" + +verbose_msg "sofile: $sofile" +verbose_msg "destdir: $destdir" +verbose_msg "name: $name" +verbose_msg "root: $root" + +arch=`uname` +[ x$arch = xDarwin ] && arch=MacOS +type="BNDL" +creator="????" + +# Overwrite existing bundle +[ -d "$root" ] && rm -rf "$root" + +mkdir -p "$root"/Contents/$arch +cp "$sofile" "$root"/Contents/$arch/"$name" +echo "$type$creator" > "$root"/Contents/PkgInfo + +create_info_plist () +{ + echo "" + echo "" + echo "" + echo "" + echo " CFBundleDevelopmentRegion" + echo " English" + echo " CFBundleExecutable" + echo " $name" + echo " CFBundleInfoDictionaryVersion" + echo " 6.0" + echo " CFBundleName" + echo " $name" + echo " CFBundlePackageType" + echo " $type" + echo " CFBundleSignature" + echo " $creator" + echo " CFBundleVersion" + echo " 0.0.1d1" + if [ "$extradata" ]; then + echo "" + [ -f "$extradata" ]; cat $extradata + fi + echo "" + echo "" +} + +create_info_plist > "$root"/Contents/Info.plist + +echo "Installed $sofile as $root"