-
Notifications
You must be signed in to change notification settings - Fork 0
/
assemble-framework.sh
executable file
·192 lines (159 loc) · 4.8 KB
/
assemble-framework.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/bin/sh
#
# %Z% %I% %W% %G% %U%
#
# ZZ_Copyright_BEGIN
#
#
# Licensed Materials - Property of IBM
#
# IBM Linear Tape File System Single Drive Edition Version 2.2.1 for Linux and Mac OS X
#
# Copyright IBM Corp. 2010, 2016
#
# This file is part of the IBM Linear Tape File System Single Drive Edition for Linux and Mac OS X
# (formally known as IBM Linear Tape File System)
#
# The IBM Linear Tape File System Single Drive Edition for Linux and Mac OS X is free software;
# you can redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation,
# version 2.1 of the License.
#
# The IBM Linear Tape File System Single Drive Edition for Linux and Mac OS X is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# or download the license from <http://www.gnu.org/licenses/>.
#
#
# ZZ_Copyright_END
#
#############################################################################
#
# FILE NAME: assemble-framework.sh
#
# DESCRIPTION: Automates assembly of OS X framework
# skeleton for LTFS.
#
# AUTHOR: Michael A. Richmond
# IBM Almaden Research Center
#
#############################################################################
BASEDIR=`pwd`
DIRNAME=`dirname $0`
PROJECT_NAME=LTFS
PROJECT_VERSION=2.4.0
FRAMEWORK_NAME=${PROJECT_NAME}.framework
OUTPUT_DIR=distribution
BUNDLE_IDENTIFIER=com.ibm.ltfs
BUNDLE_REGION=English
BUNDLE_EXECUTABLE=ltfs
##########################################################################
##########################################################################
# Create folders for framework in current directory
create_framework_structure()
{
umask 00
mkdir Versions
mkdir Versions/${PROJECT_VERSION}
ln -s ${PROJECT_VERSION} Versions/Current
mkdir Versions/${PROJECT_VERSION}/Headers
ln -s Versions/Current/Headers Headers
mkdir Versions/Current/Resources
ln -s Versions/Current/Resources Resources
# Prefix for project install...
mkdir Versions/Current/usr
mkdir Versions/Current/usr/lib
ln -s Versions/Current/usr/lib Libraries
}
create_infoplist()
{
packageName=$1
packageVersion=$2
bundleName=$3
bundleIdentifier=$4
bundleDevelopmentRegion=$5
bundleExecutable=$6
cat > Resources/Info.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>${bundleDevelopmentRegion}</string>
<key>CFBundleExecutable</key>
<string>${bundleExecutable}</string>
<key>CFBundleGetInfoString</key>
<string>${packageName} ${packageVersion}</string>
<key>CFBundleIdentifier</key>
<string>${bundleIdentifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${bundleName}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>${packageVersion}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${packageVersion}</string>
</dict>
</plist>
EOF
}
print_usage()
{
echo "usage: "`basename $0`" [clean|distclean]"
echo ""
echo " This script assembles the skeleton for an OS X framework."
echo ""
echo " The 'clean' option cleans up any previously built"
echo " framework."
echo ""
}
##########################################################################
##########################################################################
if [ $# -ne 0 ]; then
case ${1} in
clean)
cd ${BASEDIR}
\rm -rf ${OUTPUT_DIR}
exit 0
;;
*)
print_usage
cd ${BASEDIR}
exit 1
;;
esac
fi
##
## create working directory...
##
cd ${BASEDIR}
mkdir ${OUTPUT_DIR}
##
## create framework structure...
##
cd ${BASEDIR}/${OUTPUT_DIR}
mkdir ${FRAMEWORK_NAME}
cd ${FRAMEWORK_NAME}
create_framework_structure
##
## Create Info.plist...
##
cd ${BASEDIR}/${OUTPUT_DIR}/${FRAMEWORK_NAME}
create_infoplist "${PROJECT_NAME}" "${PROJECT_VERSION}" "${PROJECT_NAME}" "${BUNDLE_IDENTIFIER}" "${BUNDLE_REGION}" "${BUNDLE_EXECUTABLE}"
##
## Set permissions...
##
cd ${BASEDIR}/${OUTPUT_DIR}/${FRAMEWORK_NAME}
find . -type d |xargs chmod a+rx
cd ${BASEDIR}