]> git.saurik.com Git - cycript.git/blame_incremental - ios.sh
Avoid libapr's .la from breaking libiconv search.
[cycript.git] / ios.sh
... / ...
CommitLineData
1#!/usr/bin/env bash
2
3set -e
4
5rm -rf sysroot.ios
6mkdir -p sysroot.ios
7
8for deb in apr-lib_1.3.3-2 libffi_1:3.0.10-5 ncurses_5.7-12 readline_6.0-7; do
9 deb=${deb}_iphoneos-arm.deb
10 [[ -f "${deb}" ]] || wget http://apt.saurik.com/debs/"${deb}"
11 tar=data.tar.lzma
12 ar -x "${deb}" "${tar}"
13 PATH=/sw/bin:$PATH tar -C sysroot.ios -xf "${tar}"
14 rm -f "${tar}"
15done
16
17mkdir -p sysroot.ios/usr/include/ffi
18mv -v sysroot.ios/usr/include/{,ffi/}ffi.h
19
20plt=iPhoneOS
21dev=/Developer/Platforms/${plt}.platform/Developer
22sdk=${dev}/SDKs/${plt}5.0.sdk
23
24ln -s /System/Library/Frameworks/WebKit.framework/Versions/A/Headers sysroot.ios/usr/include/WebKit
25
26mkdir -p sysroot.ios/Library/Frameworks/JavaScriptCore.framework
27ln -s "${sdk}"/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore sysroot.ios/Library/Frameworks/JavaScriptCore.framework
28ln -s /System/Library/Frameworks/JavaScriptCore.framework/Headers sysroot.ios/Library/Frameworks/JavaScriptCore.framework
29
30export CC=${dev}/usr/bin/gcc
31export CXX=${dev}/usr/bin/g++
32export OBJCXX=${dev}/usr/bin/g++
33
34flags_armv6=()
35flags_armv6+=(-isysroot "${sdk}")
36
37flags_armv6+=(-Fsysroot.ios/Library/Frameworks)
38flags_armv6+=(-Isysroot.ios/usr/include)
39flags_armv6+=(-Lsysroot.ios/usr/lib)
40
41flags_armv6+=(-F"${sdk}"/System/Library/PrivateFrameworks)
42flags_armv6+=(-framework WebCore)
43
44
45flags=(-O2)
46for flag in "${flags_armv6[@]}"; do
47 flags+=(-Xarch_armv6 "${flag}")
48done
49
50cflags=${flags[*]}
51export CFLAGS=${cflags}
52export CXXFLAGS=${cflags}
53export OBJCXXFLAGS=${cflags}
54
55lflags=()
56for flag in "${flags[@]}"; do
57 lflags+=("-Xcompiler ${flag}")
58done
59
60lflags=${lflags[*]}
61export LTFLAGS=${lflags}
62
63./configure --prefix=/usr "$@"
64sed -i -e 's/\(-arch armv6\) -arch i386 -arch x86_64/\1/' GNUmakefile
65
66make clean
67make -j ldid=ldid all
68PATH=/sw/bin:$PATH make arch=iphoneos-arm dll=dylib depends='apr-lib, readline, libffi (>= 1:3.0.10-5), adv-cmds' package