-
Notifications
You must be signed in to change notification settings - Fork 25
/
autoframework
executable file
·62 lines (49 loc) · 1.35 KB
/
autoframework
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
set -e
usage () {
echo "Usage: [VARIABLE...] $(basename $0) framework libname"
echo " framework Name of the framework to create"
echo " libname Name of the .a library"
echo ""
echo " VARIABLEs are:"
echo " ARCHS Only build for specific architectures. Default is:"
echo " armv7|armv7s|arm64|i686|x86_64"
echo " PREFIX Installation prefix for framework and static files."
echo ""
echo " All additional parameters are passed to the configure script."
exit 1
}
# Sanity checks
if [ "$#" -lt 2 ]; then
usage
fi
ICONFIGURE="$(dirname $0)/iconfigure"
FRAMEWORK=$1
LIBARCHIVE=$2
shift 2
if [ -z "$PREFIX" ]; then
PREFIX="$(pwd)"
fi
STATICDIR="$PREFIX/Static"
FRAMEWORKDIR="$PREFIX/Frameworks/$FRAMEWORK.framework"
if [ -z "$ARCHS" ]; then
ARCHS="i386 x86_64 armv7 armv7s arm64"
fi
# Build all architectures
for ARCH in $ARCHS; do
make distclean || true
PREFIX="$STATICDIR/$ARCH" $ICONFIGURE $ARCH $@
make
make install
done
# Install header files
PREFIX="$STATICDIR/$ARCH" $ICONFIGURE $ARCH --includedir="$FRAMEWORKDIR/Headers" $@
make
make install
# Create multiarch archive
for ARCH in $ARCHS; do
LIPOARCHS="$LIPOARCHS -arch $ARCH $STATICDIR/$ARCH/lib/$LIBARCHIVE"
done
lipo -create -output "$FRAMEWORKDIR/$FRAMEWORK" $LIPOARCHS
echo "Success!"
echo "Built $FRAMEWORK for architectures: $ARCHS"