]>
Commit | Line | Data |
---|---|---|
9d13f949 JF |
1 | #!/usr/bin/env bash |
2 | ||
eaf660f1 JF |
3 | set -e |
4 | ||
8ad1528b | 5 | rm -rf sysroot.ios |
9d13f949 JF |
6 | mkdir -p sysroot.ios |
7 | ||
74296173 | 8 | for 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}" |
15 | done | |
16 | ||
8ad1528b JF |
17 | mkdir -p sysroot.ios/usr/include/ffi |
18 | mv -v sysroot.ios/usr/include/{,ffi/}ffi.h | |
19 | ||
6927ece0 | 20 | plt=iPhoneOS |
8a84ecb4 JF |
21 | dev=/Developer/Platforms/${plt}.platform/Developer |
22 | sdk=${dev}/SDKs/${plt}5.0.sdk | |
8ad1528b JF |
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 | ||
9d13f949 JF |
30 | export CC=${dev}/usr/bin/gcc |
31 | export CXX=${dev}/usr/bin/g++ | |
8ad1528b | 32 | export OBJCXX=${dev}/usr/bin/g++ |
9d13f949 JF |
33 | |
34 | flags_armv6=() | |
8ad1528b | 35 | flags_armv6+=(-isysroot "${sdk}") |
9d13f949 | 36 | |
8ad1528b | 37 | flags_armv6+=(-Fsysroot.ios/Library/Frameworks) |
9d13f949 JF |
38 | flags_armv6+=(-Isysroot.ios/usr/include) |
39 | flags_armv6+=(-Lsysroot.ios/usr/lib) | |
40 | ||
8ad1528b JF |
41 | flags_armv6+=(-F"${sdk}"/System/Library/PrivateFrameworks) |
42 | flags_armv6+=(-framework WebCore) | |
43 | ||
44 | ||
f0b471d9 | 45 | flags=(-O2) |
9d13f949 JF |
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} | |
8ad1528b | 53 | export OBJCXXFLAGS=${cflags} |
9d13f949 JF |
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 "$@" | |
be10fa82 | 64 | sed -i -e 's/\(-arch armv6\) -arch i386 -arch x86_64/\1/' GNUmakefile |
8ad1528b JF |
65 | |
66 | make clean | |
67 | make -j ldid=ldid all | |
871ab549 | 68 | PATH=/sw/bin:$PATH make arch=iphoneos-arm dll=dylib depends='apr-lib, readline, libffi (>= 1:3.0.10-5), adv-cmds' package |