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