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