root/trunk/libtool-bundle

Revision 102, 2.3 kB (checked in by jps, 14 months ago)

create a bundle with the PKCS11 module (useful for signing in Acrobat)

  • Property svn:executable set to *
Line 
1#!/bin/sh
2# A shell script to create MacOS X bundles
3# from files created by GNU libtool.
4# Incomplete, but works.
5#
6# $Id: libtool-bundle 1533 2003-10-16 20:41:34Z aet $
7# <aet@cc.hut.fi>
8#
9
10set -e
11verbose=0
12
13verbose_msg ()
14{
15  if [ $verbose -ne 0 ]; then
16    echo "libtool-bundle: $@"
17  fi
18}
19
20error_msg ()
21{
22  echo 1>&2 "libtool-bundle: $@"
23}
24
25usage ()
26{
27  error_msg "Usage: $0 [-e extra XML data] [Mach-O bundle file] [destination directory] <bundle name>"
28  exit 1
29}
30
31case $1 in
32  -e) shift; if [ "$1" ]; then extradata=$1; shift; else usage; fi; ;;
33esac
34
35[ $# -le 1 -o $# -ge 4 ] && usage
36
37sofile=$1
38[ ! -f $sofile ] && error_msg "Not a file or file not found: $sofile" && exit 1
39case "$sofile" in
40*.so*)
41  # Assume it's ok
42  ;;
43*)
44  error_msg "Invalid bundle: $sofile"
45  exit 1
46  ;;
47esac
48
49destdir=$2
50[ ! -d $destdir -o ! -w $destdir ] && error_msg "Not a directory or no write access: $destdir" && exit 1
51
52name="$sofile"
53[ $# -eq 3 ] && name=$3
54name=`echo $name | sed -e "s@.*/@@" -e "s@\.so.*@@"`
55root="$destdir/${name}.bundle"
56
57verbose_msg "sofile: $sofile"
58verbose_msg "destdir: $destdir"
59verbose_msg "name: $name"
60verbose_msg "root: $root"
61
62arch=`uname`
63[ x$arch = xDarwin ] && arch=MacOS
64type="BNDL"
65creator="????"
66
67# Overwrite existing bundle
68[ -d "$root" ] && rm -rf "$root"
69
70mkdir -p "$root"/Contents/$arch
71cp "$sofile" "$root"/Contents/$arch/"$name"
72echo "$type$creator" > "$root"/Contents/PkgInfo
73
74create_info_plist ()
75{
76  echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
77  echo "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
78  echo "<plist version=\"1.0\">"
79  echo "<dict>"
80  echo "        <key>CFBundleDevelopmentRegion</key>"
81  echo "        <string>English</string>"
82  echo "        <key>CFBundleExecutable</key>"
83  echo "        <string>$name</string>"
84  echo "        <key>CFBundleInfoDictionaryVersion</key>"
85  echo "        <string>6.0</string>"
86  echo "        <key>CFBundleName</key>"
87  echo "        <string>$name</string>"
88  echo "        <key>CFBundlePackageType</key>"
89  echo "        <string>$type</string>"
90  echo "        <key>CFBundleSignature</key>"
91  echo "        <string>$creator</string>"
92  echo "        <key>CFBundleVersion</key>"
93  echo "        <string>0.0.1d1</string>"
94  if [ "$extradata" ]; then
95    echo ""
96    [ -f "$extradata" ]; cat $extradata
97  fi
98  echo "</dict>"
99  echo "</plist>"
100}
101
102create_info_plist > "$root"/Contents/Info.plist
103
104echo "Installed $sofile as $root"
Note: See TracBrowser for help on using the browser.