3 if [[ ${BASH_VERSION} != 4* ]]; then
4 echo "bash 4.0 required" 1>&2
14 for command in unlzma wget
; do
15 if ! which "${command}" &>/dev
/null
; then
16 echo "Cannot run \`${command}\`. Please read compiling.txt." 1>&2
21 if tar --help | grep bsdtar
&>/dev
/null
; then
22 echo "Running \`tar\` is bsdtar :(. Please read compiling.txt." 1>&2
30 repository
=http
://apt.saurik.com
/
33 architecture
=iphoneos
-arm
39 wget
-qO- "${repository}dists/${distribution}/${component}/binary-${architecture}/Packages.bz2" | bzcat
| {
40 regex
='^([^ \t]*): *(.*)'
43 while IFS
= read -r line
; do
44 if [[ ${line} == '' ]]; then
45 package
=${fields[package]}
46 if [[ ${package} == *(apr
|apr
-lib|apt7
|apt7
-lib|coreutils
|mobilesubstrate
|pcre
) ]]; then
47 filename
=${fields[filename]}
49 wget
-O "${package}.deb" "${repository}${filename}"
51 compressed
=data.
tar.
${z}
53 if ar -x "${package}.deb" "${compressed}" 2>/dev
/null
; then
54 ${dpkgz[${z}]} "${compressed}"
59 if ! [[ -e data.
tar ]]; then
60 echo "unable to extract package" 1>&2
71 elif [[ ${line} =~
${regex} ]]; then
72 name
=${BASH_REMATCH[1],,}
73 value
=${BASH_REMATCH[2]}
74 fields
[${name}]=${value}
81 if substrate
=$(readlink usr/include/substrate.h); then
82 if [[ ${substrate} == /* ]]; then
83 ln -sf "../..${substrate}" usr
/include
/substrate.h
91 wget
-O CoreFoundation
/CFBundlePriv.h
"http://www.opensource.apple.com/source/CF/CF-550/CFBundlePriv.h?txt"
92 wget
-O CoreFoundation
/CFPriv.h
"http://www.opensource.apple.com/source/CF/CF-550/CFPriv.h?txt"
93 wget
-O CoreFoundation
/CFUniChar.h
"http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt"
97 wget
-O WebCore
/WebCoreThread.h
'http://www.opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h?txt'
99 wget
-O WebCore.tgz http
://www.opensource.apple.com
/tarballs
/WebCore
/WebCore
-658.28.
tar.gz
100 tar -zx --transform 's@^[^/]*/@WebCore.d/@' -f WebCore.tgz
103 cp -a WebCore.d
/{*,rendering
/style
,platform
/graphics
/transforms
}/*.h WebCore
104 cp -a WebCore.d
/platform
/{animation
,graphics
,network
,text
}/*.h WebCore
105 cp -a WebCore.d
/{accessibility
,platform
{,/{graphics
,network
,text
}}}/{cf
,mac
,iphone
}/*.h WebCore
106 cp -a WebCore.d
/bridge
/objc
/*.h WebCore
108 wget
-O JavaScriptCore.tgz http
://www.opensource.apple.com
/tarballs
/JavaScriptCore
/JavaScriptCore
-554.1.
tar.gz
109 #tar -zx --transform 's@^[^/]*/API/@JavaScriptCore/@' -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | grep '/API/[^/]*.h$')
111 --transform 's@^[^/]*/@@' \
112 --transform 's@^icu/@@' \
113 -f JavaScriptCore.tgz $
(tar -ztf JavaScriptCore.tgz
| sed -e '
114 /\/icu\/unicode\/.*\.h$/ p;
115 /\/profiler\/.*\.h$/ p;
116 /\/runtime\/.*\.h$/ p;
122 for framework
in ApplicationServices CoreServices IOKit IOSurface JavaScriptCore WebKit
; do
123 ln -s /System
/Library
/Frameworks
/"${framework}".framework
/Headers
"${framework}"
126 for framework
in /System
/Library
/Frameworks
/CoreServices.framework
/Frameworks
/*.framework
; do
128 name
=${name%.framework}
130 ln -s "${framework}/Headers" "${name}"
134 cat >Cocoa
/Cocoa.h
<<EOF
135 #define NSImage UIImage
136 #define NSView UIView
137 #define NSWindow UIWindow
139 #define NSPoint CGPoint
140 #define NSRect CGRect
142 #define NSPasteboard UIPasteboard
143 #define NSSelectionAffinity int
144 @protocol NSUserInterfaceValidations;
147 mkdir -p GraphicsServices
148 cat >GraphicsServices
/GraphicsServices.h
<<EOF
149 typedef struct __GSEvent *GSEventRef;
150 typedef struct __GSFont *GSFontRef;