Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installs the iOS SDK without headers.
#!/bin/bash
######
## Installs an sdk from a dyld decache plus some goodies.
## Slightly based on BigBoss's installsdk3.
## Created by theiostream. Public Domain.
## ADVANTAGES:
## - Uses the latest on-device frameworks/libraries
## - Is completely legal
## LIMITATIONS:
## - Does not install **ANY** headers.
## - The cache is copied using a non-ASLR program to make it readable. It adds a temporary ~190MB file to your system.
## - A complete decache is performed, for non-essential parts to be removed later. It adds a temporary (big) weight.
## - The Developer/ part of the official SDK is not added. I am unaware of the implications.
## CREDITS:
## - KennyTM~: dyld_decache
## - rpetrich: fake-libgcc
## - saurik: telesphoreo
## - BigBoss: original install script
######
## Install curl and svn (for script downloads)
apt-get -y install curl svn
## Install csu (required for the sdk)
apt-get -y install csu
## Install dyld_decache and class-dump-z
apt-get -y install dyld-decache class-dump-z
## Install fake-libgcc (required by iphone-gcc)
curl http://thebigboss.org/hostedfiles/fake-libgcc_1.0_iphoneos-arm.deb -o /var/tmp/libgcc.deb
dpkg -i /var/tmp/libgcc.deb
rm /var/tmp/libgcc.deb
## Create SDK Directories
mkdir -p /var/sdk
pushd /var/sdk
mkdir -p System/Library/AccessibilityBundles
mkdir -p System/Library/CoreServices
mkdir -p System/Library/DataClassMigrators
mkdir -p System/Library/Extensions
mkdir -p System/Library/Frameworks
mkdir -p System/Library/PrivateFrameworks
mkdir -p System/Library/TextInput
mkdir -p System/Library/VideoDecoders
mkdir -p usr/include
mkdir -p usr/lib
## Perform the decache
# Copy the cache with a non-ASLR program.
curl http://theiostream.com/cachecopier -o /var/tmp/cachecopier
chmod +x /var/tmp/cachecopier
/var/tmp/cachecopier
rm /var/tmp/cachecopier
# Extract the cache
/usr/bin/dyld_decache -o . /var/tmp/dyld_shared_cache_*
rm /var/tmp/dyld_shared_cache_*
# Remove unneeded generated directories
pushd System/Library
find . -maxdepth 1 \
-not -name AccessibilityBundles \
-not -name CoreServices \
-not -name DataClassMigrators \
-not -name Extensions \
-not -name Frameworks \
-not -name PrivateFrameworks \
-not -name TextInput \
-not -name VideoDecoders | xargs rm -r
popd # System/Library
## Fix symlinks
pushd usr/lib
# csu
ln -s /usr/lib/bundle1.o .
ln -s /usr/lib/crt0.o .
ln -s /usr/lib/crt1.o .
ln -s /usr/lib/crt1.10.5.o .
ln -s /usr/lib/dylib1.o .
ln -s /usr/lib/dylib1.10.5.o .
# libgcc
ln -s libgcc_s.1.dylib libgcc_s.10.4.dylib
ln -s libgcc_s.1.dylib libgcc_s.10.5.dylib
# fake-libgcc
ln -s libgcc_s.1.dylib /usr/lib/libgcc_s.10.4.dylib
ln -s libgcc_s.1.dylib /usr/lib/libgcc_s.10.5.dylib
popd # usr/lib
popd # /var/sdk
## Install iphone-gcc
apt-get -y install iphone-gcc
for gcc in /usr/bin/arm-apple-darwin9-*; do
symlink="/usr/bin/arm-apple-darwin-${gcc##*(g|c)-}"
if [ ! -e ${symlink} ]; then
ln -s "$gcc" "$symlink"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment