]>
Commit | Line | Data |
---|---|---|
1e4922b8 JF |
1 | #!/usr/bin/env bash |
2 | ||
3 | if [[ ${BASH_VERSION} != 4* ]]; then | |
4 | echo "bash 4.0 required" 1>&2 | |
5 | exit 1 | |
6 | fi | |
7 | ||
8 | shopt -s extglob | |
9 | shopt -s nullglob | |
10 | ||
11 | PATH=/Library/Cydia/bin:$PATH | |
12 | ||
13 | rm -rf sysroot | |
14 | mkdir sysroot | |
15 | cd sysroot | |
16 | ||
17 | repository=http://apt.saurik.com/ | |
18 | distribution=tangelo | |
19 | component=main | |
20 | architecture=iphoneos-arm | |
21 | ||
22 | wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture}/Packages.bz2" | bzcat | { | |
23 | regex='^([^ \t]*): *(.*)' | |
24 | declare -A fields | |
25 | ||
26 | while IFS= read -r line; do | |
27 | if [[ ${line} == '' ]]; then | |
28 | package=${fields[package]} | |
393ab8b9 | 29 | if [[ ${package} == *(apr|apr-lib|apt7|apt7-lib|coreutils|mobilesubstrate|pcre) ]]; then |
1e4922b8 JF |
30 | filename=${fields[filename]} |
31 | wget -O "${package}.deb" "${repository}${filename}" | |
32 | dpkg-deb -x "${package}.deb" . | |
33 | fi | |
34 | ||
35 | unset fields | |
36 | declare -A fields | |
37 | elif [[ ${line} =~ ${regex} ]]; then | |
38 | name=${BASH_REMATCH[1],,} | |
39 | value=${BASH_REMATCH[2]} | |
40 | fields[${name}]=${value} | |
41 | fi | |
42 | done | |
43 | } | |
44 | ||
45 | rm -f *.deb | |
46 | ||
47 | mkdir -p usr/include | |
48 | cd usr/include | |
49 | ||
50 | mkdir CoreFoundation | |
51 | wget -O CoreFoundation/CFBundlePriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFBundlePriv.h?txt" | |
52 | wget -O CoreFoundation/CFPriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFPriv.h?txt" | |
53 | wget -O CoreFoundation/CFUniChar.h "http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt" | |
54 | ||
55 | if true; then | |
56 | mkdir -p WebCore | |
57 | wget -O WebCore/WebCoreThread.h 'http://www.opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h?txt' | |
58 | else | |
59 | wget -O WebCore.tgz http://www.opensource.apple.com/tarballs/WebCore/WebCore-658.28.tar.gz | |
60 | tar -zx --transform 's@^[^/]*/@WebCore.d/@' -f WebCore.tgz | |
61 | ||
62 | mkdir WebCore | |
63 | cp -a WebCore.d/{*,rendering/style,platform/graphics/transforms}/*.h WebCore | |
64 | cp -a WebCore.d/platform/{animation,graphics,network,text}/*.h WebCore | |
65 | cp -a WebCore.d/{accessibility,platform{,/{graphics,network,text}}}/{cf,mac,iphone}/*.h WebCore | |
66 | cp -a WebCore.d/bridge/objc/*.h WebCore | |
67 | ||
68 | wget -O JavaScriptCore.tgz http://www.opensource.apple.com/tarballs/JavaScriptCore/JavaScriptCore-554.1.tar.gz | |
69 | #tar -zx --transform 's@^[^/]*/API/@JavaScriptCore/@' -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | grep '/API/[^/]*.h$') | |
70 | tar -zx \ | |
71 | --transform 's@^[^/]*/@@' \ | |
72 | --transform 's@^icu/@@' \ | |
73 | -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | sed -e ' | |
74 | /\/icu\/unicode\/.*\.h$/ p; | |
75 | /\/profiler\/.*\.h$/ p; | |
76 | /\/runtime\/.*\.h$/ p; | |
77 | /\/wtf\/.*\.h$/ p; | |
78 | d; | |
79 | ') | |
80 | fi | |
81 | ||
82 | for framework in ApplicationServices CoreServices IOKit IOSurface JavaScriptCore QuartzCore WebKit; do | |
83 | ln -s /System/Library/Frameworks/"${framework}".framework/Headers "${framework}" | |
84 | done | |
85 | ||
86 | for framework in /System/Library/Frameworks/CoreServices.framework/Frameworks/*.framework; do | |
87 | name=${framework} | |
88 | name=${name%.framework} | |
89 | name=${name##*/} | |
90 | ln -s "${framework}/Headers" "${name}" | |
91 | done | |
92 | ||
93 | mkdir -p Cocoa | |
94 | cat >Cocoa/Cocoa.h <<EOF | |
95 | #define NSImage UIImage | |
96 | #define NSView UIView | |
97 | #define NSWindow UIWindow | |
98 | ||
99 | #define NSPoint CGPoint | |
100 | #define NSRect CGRect | |
101 | ||
102 | #define NSPasteboard UIPasteboard | |
103 | #define NSSelectionAffinity int | |
104 | @protocol NSUserInterfaceValidations; | |
105 | EOF | |
106 | ||
107 | mkdir -p GraphicsServices | |
108 | cat >GraphicsServices/GraphicsServices.h <<EOF | |
109 | typedef struct __GSEvent *GSEventRef; | |
110 | typedef struct __GSFont *GSFontRef; | |
111 | EOF |