]> git.saurik.com Git - cydia.git/blobdiff - sysroot.sh
Add cydia.setPasteboard*() for clipboard access.
[cydia.git] / sysroot.sh
index db06c108ed2e9862482e73872c74c4748a83b18b..5e87c3c432b3d6fd92f2efd5cc904d2624b1cab1 100755 (executable)
@@ -5,10 +5,23 @@ if [[ ${BASH_VERSION} != 4* ]]; then
     exit 1
 fi
 
+set -o pipefail
+set -e
+
 shopt -s extglob
 shopt -s nullglob
 
-PATH=/Library/Cydia/bin:$PATH
+for command in unlzma wget; do
+    if ! which "${command}" &>/dev/null; then
+        echo "Cannot run \`${command}\`. Please read compiling.txt." 1>&2
+        exit 1
+    fi
+done
+
+if tar --help | grep bsdtar &>/dev/null; then
+    echo "Running \`tar\` is bsdtar :(. Please read compiling.txt." 1>&2
+    exit 1
+fi
 
 rm -rf sysroot
 mkdir sysroot
@@ -19,6 +32,10 @@ distribution=tangelo
 component=main
 architecture=iphoneos-arm
 
+declare -A dpkgz
+dpkgz[gz]=gunzip
+dpkgz[lzma]=unlzma
+
 wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture}/Packages.bz2" | bzcat | {
     regex='^([^ \t]*): *(.*)'
     declare -A fields
@@ -26,10 +43,27 @@ wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture
     while IFS= read -r line; do
         if [[ ${line} == '' ]]; then
             package=${fields[package]}
-            if [[ ${package} == *(apr|apr-lib|apt7|apt7-lib|mobilesubstrate|pcre) ]]; then
+            if [[ ${package} == *(apr|apr-lib|apt7|apt7-lib|coreutils|mobilesubstrate|pcre) ]]; then
                 filename=${fields[filename]}
+
                 wget -O "${package}.deb" "${repository}${filename}"
-                dpkg-deb -x "${package}.deb" .
+                for z in lzma gz; do
+                    compressed=data.tar.${z}
+
+                    if ar -x "${package}.deb" "${compressed}" 2>/dev/null; then
+                        ${dpkgz[${z}]} "${compressed}"
+                        break
+                    fi
+                done
+
+                if ! [[ -e data.tar ]]; then
+                    echo "unable to extract package" 1>&2
+                    exit 1
+                fi
+
+                ls -la data.tar
+                tar -xf ./data.tar
+                rm -f data.tar
             fi
 
             unset fields
@@ -44,6 +78,12 @@ wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture
 
 rm -f *.deb
 
+if substrate=$(readlink usr/include/substrate.h); then
+    if [[ ${substrate} == /* ]]; then
+        ln -sf "../..${substrate}" usr/include/substrate.h
+    fi
+fi
+
 mkdir -p usr/include
 cd usr/include