]> git.saurik.com Git - cydia.git/blame - sysroot.sh
Allocate Package objects into an NSZone.
[cydia.git] / sysroot.sh
CommitLineData
c21004b9
JF
1#!/usr/bin/env bash
2
3if [[ ${BASH_VERSION} != 4* ]]; then
4 echo "bash 4.0 required" 1>&2
5 exit 1
6fi
7
8shopt -s extglob
9shopt -s nullglob
10
11PATH=/Library/Cydia/bin:$PATH
12
13rm -rf sysroot
14mkdir sysroot
15cd sysroot
16
17repository=http://apt.saurik.com/
18distribution=tangelo
19component=main
20architecture=iphoneos-arm
21
22wget -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]}
7e2bd591 29 if [[ ${package} == *(apr|apr-lib|apt7|apt7-lib|coreutils|mobilesubstrate|pcre) ]]; then
c21004b9
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
45rm -f *.deb
46
47mkdir -p usr/include
48cd usr/include
49
50mkdir CoreFoundation
51wget -O CoreFoundation/CFBundlePriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFBundlePriv.h?txt"
52wget -O CoreFoundation/CFPriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFPriv.h?txt"
53wget -O CoreFoundation/CFUniChar.h "http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt"
54
55if 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'
58else
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 ')
80fi
81
82for framework in ApplicationServices CoreServices IOKit IOSurface JavaScriptCore QuartzCore WebKit; do
83 ln -s /System/Library/Frameworks/"${framework}".framework/Headers "${framework}"
84done
85
86for 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}"
91done
92
93mkdir -p Cocoa
94cat >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;
105EOF
106
107mkdir -p GraphicsServices
108cat >GraphicsServices/GraphicsServices.h <<EOF
109typedef struct __GSEvent *GSEventRef;
110typedef struct __GSFont *GSFontRef;
111EOF