This repository has been archived by the owner on May 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-ios-frameworks
executable file
·59 lines (57 loc) · 2.52 KB
/
make-ios-frameworks
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
#!/bin/bash
set -e
mkframework() {
local prebuiltdir=$1
local frameworkdir=$2
local headersdir=$3
rm -rf $frameworkdir
install -d $frameworkdir
local framework="$(basename $frameworkdir | sed 's|\.framework$||g')"
echo "* Creating $frameworkdir/$framework"
for versiondir in $prebuiltdir/*; do
for archdir in $versiondir/*; do
local all_libs="$(find $archdir/lib -type f -name \*.a)"
libtool -static $all_libs -o "$frameworkdir/$(basename $archdir).a"
done
done
lipo -create -output "$frameworkdir/$framework" $frameworkdir/*.a
rm -f $frameworkdir/*.a
echo "* Copying machine dependent headers"
install -d $frameworkdir/Headers/aaa_mkarch
for versiondir in $prebuiltdir/*; do
for archdir in $versiondir/*; do
cp -Rp $archdir/$headersdir $frameworkdir/Headers/aaa_mkarch/$(basename $archdir)
done
done
echo "* Creating machine independent headers"
for archdir in $frameworkdir/Headers/aaa_mkarch/*; do
for hdr in $(cd $archdir && find . -type f | sed 's@^\.\/@@g'); do
local oh=$frameworkdir/Headers/$hdr
install -d $(dirname $oh)
touch $frameworkdir/Headers/$hdr
chmod 644 $oh
echo "#if defined __arm64__" >> $oh
echo "# include \"$framework/aaa_mkarch/arm64/$hdr\"" >> $oh
echo "#elif defined __arm__" >> $oh
echo "# include \"$framework/aaa_mkarch/armv7s/$hdr\"" >> $oh
echo "#elif defined __x86_64__" >> $oh
echo "# include \"$framework/aaa_mkarch/x86_64/$hdr\"" >> $oh
echo "#elif defined __i386__" >> $oh
echo "# include \"$framework/aaa_mkarch/i386/$hdr\"" >> $oh
echo "#else" >> $oh
echo "# error \"No headers for your ARCH\"" >> $oh
echo "#endif" >> $oh
arch_hdrs="$arch_hdrs $hdr"
done
break # Assumption: no package installs headers only for some archs
done
}
topdir=$(cd $(dirname $0) && pwd -P)
rm -rf MK_DIST
$topdir/install `$topdir/all-deps.sh ios-` ios-measurement-kit
rm -rf Frameworks
mkframework MK_DIST/ios/libmaxminddb Frameworks/maxminddb.framework include
mkframework MK_DIST/ios/libressl Frameworks/openssl.framework include/openssl
mkframework MK_DIST/ios/libevent Frameworks/event2.framework include/event2
mkframework MK_DIST/ios/curl Frameworks/curl.framework include/curl
mkframework MK_DIST/ios/measurement-kit Frameworks/measurement_kit.framework include/measurement_kit