]> git.saurik.com Git - cydia.git/blame - sysroot.sh
Move private ivars in CyteKit to @implementations.
[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
6a451713
JF
8set -o pipefail
9set -e
10
c21004b9
JF
11shopt -s extglob
12shopt -s nullglob
13
8a2c6d14
JF
14for command in unlzma wget; do
15 if ! which "${command}" &>/dev/null; then
16 echo "Cannot run \`${command}\`. Please read compiling.txt." 1>&2
17 exit 1
18 fi
19done
20
21if tar --help | grep bsdtar &>/dev/null; then
22 echo "Running \`tar\` is bsdtar :(. Please read compiling.txt." 1>&2
23 exit 1
24fi
25
e67b009f
JF
26xcode=$(xcodebuild -sdk macosx -version Path)
27
c21004b9
JF
28rm -rf sysroot
29mkdir sysroot
30cd sysroot
31
32repository=http://apt.saurik.com/
33distribution=tangelo
34component=main
35architecture=iphoneos-arm
36
569d107c
JF
37declare -A dpkgz
38dpkgz[gz]=gunzip
39dpkgz[lzma]=unlzma
40
e052c855
JF
41function extract() {
42 package=$1
43 url=$2
44
45 wget -O "${package}.deb" "${url}"
46 for z in lzma gz; do
47 compressed=data.tar.${z}
48
49 if ar -x "${package}.deb" "${compressed}" 2>/dev/null; then
50 ${dpkgz[${z}]} "${compressed}"
51 break
52 fi
53 done
54
55 if ! [[ -e data.tar ]]; then
56 echo "unable to extract package" 1>&2
57 exit 1
58 fi
59
60 ls -la data.tar
61 tar -xf ./data.tar
62 rm -f data.tar
63}
64
54287d55
JF
65declare -A urls
66
42cc196d
JF
67urls[apt7]=http://apt.saurik.com/debs/apt7_0.7.25.3-7_iphoneos-arm.deb
68urls[apt7-lib]=http://apt.saurik.com/debs/apt7-lib_0.7.25.3-12_iphoneos-arm.deb
d3b5a983 69urls[coreutils]=http://apt.saurik.com/debs/coreutils_7.4-11_iphoneos-arm.deb
53a83cf2 70
c05866df 71if [[ 0 ]]; then
89353a16
JF
72 wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture}/Packages.bz2" | bzcat | {
73 regex='^([^ \t]*): *(.*)'
74 declare -A fields
75
76 while IFS= read -r line; do
77 if [[ ${line} == '' ]]; then
78 package=${fields[package]}
53a83cf2 79 if [[ -n ${urls[${package}]} ]]; then
89353a16
JF
80 filename=${fields[filename]}
81 urls[${package}]=${repository}${filename}
82 fi
83
84 unset fields
85 declare -A fields
86 elif [[ ${line} =~ ${regex} ]]; then
87 name=${BASH_REMATCH[1],,}
88 value=${BASH_REMATCH[2]}
89 fields[${name}]=${value}
c21004b9 90 fi
89353a16
JF
91 done
92 }
93fi
c21004b9 94
54287d55
JF
95for package in "${!urls[@]}"; do
96 extract "${package}" "${urls[${package}]}"
97done
98
c21004b9
JF
99rm -f *.deb
100
101mkdir -p usr/include
102cd usr/include
103
104mkdir CoreFoundation
c21004b9
JF
105wget -O CoreFoundation/CFUniChar.h "http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt"
106
63755c48
JF
107mkdir -p WebCore
108wget -O WebCore/WebCoreThread.h 'http://www.opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h?txt'
c21004b9 109
63755c48 110ln -s /System/Library/Frameworks/IOKit.framework/Headers IOKit