framework.sh
1.55 KB
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
#!/bin/sh
PATH="/bin:/usr/bin:/usr/libexec"
VERSION=`git describe --tags | awk -F '-' '{ print $1 }'`
SDK="5.1"
TARGET="MapView"
FW_NAME="MapBox"
FW_FOLDER="build/$FW_NAME.framework"
#
# clean old version
#
if [ -d $FW_FOLDER ]; then
rm -rf $FW_FOLDER
fi
#
# folder & symlink structure
#
mkdir -p $FW_FOLDER/Versions/A/Headers
mkdir -p $FW_FOLDER/Versions/A/Resources
cd $FW_FOLDER
ln -s Versions/A/Headers Headers
ln -s Versions/A/Resources Resources
cd Versions
ln -s A Current
cd ../../..
#
# Info.plist & version
#
cp framework.plist $FW_FOLDER/Versions/A/Resources/Info.plist
PlistBuddy $FW_FOLDER/Versions/A/Resources/Info.plist -c "Set :CFBundleVersion $VERSION"
#
# build static lib variants
#
xcodebuild -target $TARGET -configuration Debug -sdk iphonesimulator${SDK}
xcodebuild -target $TARGET -configuration Debug -sdk iphoneos${SDK}
xcodebuild -target $TARGET -configuration Release -sdk iphonesimulator${SDK}
xcodebuild -target $TARGET -configuration Release -sdk iphoneos${SDK}
#
# make fat binaries
#
lipo -create build/Debug-iphoneos/lib${TARGET}.a build/Debug-iphonesimulator/lib${TARGET}.a -o $FW_FOLDER/${FW_NAME}Debug
lipo -create build/Release-iphoneos/lib${TARGET}.a build/Release-iphonesimulator/lib${TARGET}.a -o $FW_FOLDER/$FW_NAME
#
# copy headers & create all-inclusive
#
for header in `ls Map/*.h | grep -v RouteMe.h | sed 's/Map\///'`; do
cp -v "Map/$header" $FW_FOLDER/Versions/A/Headers
echo "#import \"$header\"" >> $FW_FOLDER/Versions/A/Headers/$FW_NAME.h
done
#
# copy resources
#
cp -v Map/Resources/* $FW_FOLDER/Versions/A/Resources