Created
November 3, 2008 13:39
-
-
Save typester/21870 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export iphonefs=/Users/typester/app/toolchain/iPhone-2.0 | |
export target=arm-apple-darwin9 | |
export leopardsdk=/Developer/SDKs/MacOSX10.5.sdk | |
export leopardinc=${leopardsdk}/usr/include | |
export leopardlib=${leopardsdk}/System/Library/Frameworks | |
export iphoneplt=/Developer/Platforms/iPhoneOS.platform | |
export iphonesdk=${iphoneplt}/Developer/SDKs/iPhoneOS2.0.sdk | |
export iphoneinc=${iphonesdk}/usr/include | |
export iphonelib=${iphonesdk}/System/Library/Frameworks | |
export toolchain_base=/Users/typester/app/toolchain | |
export prefix=${toolchain_base}/usr | |
export sysroot=${toolchain_base}/sysroot | |
export PATH="${prefix}/bin":"${PATH}" | |
export cctools=${toolchain_base}/src/cctools | |
export gcc=${toolchain_base}/src/gcc | |
export csu=${toolchain_base}/src/csu | |
export build=${toolchain_base}/build | |
export apple=/Users/typester/tmp/iphone/apple | |
mkdir -p "$(dirname "${sysroot}")" | |
cp -RH "${iphonefs}" "${sysroot}" | |
cd "${sysroot}" | |
rm -rf usr/include | |
cp -RH "${leopardinc}" usr/include | |
cd usr/include | |
ln -s . System | |
cp -RH "${iphoneinc}"/* . | |
cp -RH "${apple}"/xnu-*/osfmk/* . | |
cp -RH "${apple}"/xnu-*/bsd/* . | |
cp -RH "${apple}"/cctools-*/include/mach . | |
cp -RH "${apple}"/cctools-*/include/mach-o . | |
cp -RH "${iphoneinc}"/mach-o/dyld.h mach-o | |
cp -RH "${leopardinc}"/mach/machine mach | |
cp -RH "${leopardinc}"/mach/machine.h mach | |
cp -RH "${leopardinc}"/machine . | |
cp -RH "${iphoneinc}"/machine . | |
cp -RH "${iphoneinc}"/sys/cdefs.h sys | |
cp -RH "${leopardinc}"/sys/dtrace.h sys | |
cp -RH "${leopardlib}"/Kernel.framework/Headers/machine/disklabel.h machine | |
cp -RH "${apple}"/configd-*/dnsinfo/dnsinfo.h . | |
cp -RH "${apple}"/Libc-*/include/kvm.h . | |
cp -RH "${apple}"/launchd-*/launchd/src/*.h . | |
cp -RH i386/disklabel.h arm | |
cp -RH mach/i386/machine_types.defs mach/arm | |
# if you don't have mig, just ignore this for now | |
for defs in clock_reply exc mach_exc notify; do | |
mig -server /dev/null -user /dev/null -header /dev/null \ | |
-sheader mach/"${defs}"_server.h mach/"${defs}".defs | |
done | |
mkdir Kernel | |
cp -RH "${apple}"/xnu-*/libsa/libsa Kernel | |
mkdir Security | |
cp -RH "${apple}"/libsecurity_authorization-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_cdsa_client-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_cdsa_utilities-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_cms-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_codesigning-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_cssm-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_keychain-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_mds-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_ssl-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurity_utilities-*/lib/*.h Security | |
cp -RH "${apple}"/libsecurityd-*/lib/*.h Security | |
mkdir DiskArbitration | |
cp -RH "${apple}"/DiskArbitration-*/DiskArbitration/*.h DiskArbitration | |
cp -RH "${apple}"/xnu-*/iokit/IOKit . | |
cp -RH "${apple}"/IOKitUser-*/*.h IOKit | |
cp -RH "${apple}"/IOGraphics-*/IOGraphicsFamily/IOKit/graphics IOKit | |
cp -RH "${apple}"/IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem IOKit | |
for proj in kext ps pwr_mgt; do | |
mkdir -p IOKit/"${proj}" | |
cp -RH "${apple}"/IOKitUser-*/"${proj}".subproj/*.h IOKit/"${proj}" | |
done | |
mkdir IOKit/storage | |
cp -RH "${apple}"/IOStorageFamily-*/*.h IOKit/storage | |
cp -RH "${apple}"/IOCDStorageFamily-*/*.h IOKit/storage | |
cp -RH "${apple}"/IODVDStorageFamily-*/*.h IOKit/storage | |
mkdir SystemConfiguration | |
cp -RH "${apple}"/configd-*/SystemConfiguration.fproj/*.h SystemConfiguration | |
mkdir WebCore | |
cp -RH "${apple}"/WebCore-*/bindings/objc/*.h WebCore | |
cp -RH "${leopardlib}"/CoreFoundation.framework/Headers CoreFoundation | |
cp -RH "${apple}"/CF-*/*.h CoreFoundation | |
cp -RH "${iphonelib}"/CoreFoundation.framework/Headers/* CoreFoundation | |
for framework in AudioToolbox AudioUnit CoreAudio Foundation; do | |
cp -RH "${leopardlib}"/"${framework}".framework/Headers "${framework}" | |
cp -RH "${iphonelib}"/"${framework}".framework/Headers/* "${framework}" | |
done | |
for framework in AppKit Cocoa CoreData CoreVideo JavaScriptCore OpenGL QuartzCore WebKit; do | |
cp -RH "${leopardlib}"/"${framework}".framework/Headers "$(basename "${framework}" .framework)" | |
done | |
cp -RH "${leopardlib}"/ApplicationServices.framework/Headers ApplicationServices | |
for service in "${leopardlib}"/ApplicationServices.framework/Frameworks/*.framework; do | |
cp -RH "${service}"/Headers "$(basename "${service}" .framework)" | |
done | |
cp -RH "${leopardlib}"/CoreServices.framework/Headers CoreServices | |
for service in "${leopardlib}"/CoreServices.framework/Frameworks/*.framework; do | |
cp -RH "${service}"/Headers "$(basename "${service}" .framework)" | |
done | |
for framework in AddressBook AddressBookUI AudioToolbox AudioUnit CFNetwork CoreAudio \ | |
CoreFoundation CoreGraphics CoreLocation Foundation MediaPlayer \ | |
OpenAL OpenGLES QuartzCore Security SystemConfiguration UIKit; do | |
mkdir -p "${framework}" | |
cp -RH "${iphonelib}"/"${framework}".framework/Headers/* "${framework}" | |
done | |
# this step may have a bad hunk in CoreFoundation and thread_status while patching | |
# these errors are to be ignored, as these are changes for issues Apple has now fixed | |
wget -qO- http://svn.telesphoreo.org/trunk/tool/include.diff | patch -p3 | |
wget -qO arm/locks.h http://svn.telesphoreo.org/trunk/tool/patches/locks.h | |
mkdir GraphicsServices | |
cd GraphicsServices | |
#wget -q http://svn.telesphoreo.org/trunk/tool/patches/GraphicsServices.h | |
svn export -r 357 http://svn.telesphoreo.org/trunk/tool/patches/ | |
mv patches/GraphicsServices.h . | |
rm -rf patches | |
cd "${sysroot}" | |
ln -sf gcc/darwin/4.0/stdint.h usr/include | |
ln -s libstdc++.6.dylib usr/lib/libstdc++.dylib | |
ln -sfn A System/Library/Frameworks/IOKit.framework/Versions/Current | |
ln -sf Versions/Current/IOKit System/Library/Frameworks/IOKit.framework | |
mkdir -p "${csu}" | |
cd "${csu}" | |
svn co http://iphone-dev.googlecode.com/svn/trunk/csu . | |
cp -RH *.o "${sysroot}"/usr/lib | |
cd "${sysroot}"/usr/lib | |
chmod 644 *.o | |
cp -RH crt1.o crt1.10.5.o | |
cp -RH dylib1.o dylib1.10.5.o | |
rm -rf "${gcc}" | |
git clone git://git.saurik.com/llvm-gcc-4.2 "${gcc}" | |
rm -rf "${cctools}" | |
svn co http://iphone-dev.googlecode.com/svn/branches/odcctools-9.2-ld "${cctools}" | |
mkdir -p "${build}" | |
cd "${build}" | |
mkdir cctools-iphone | |
cd cctools-iphone | |
CFLAGS=-m32 LDFLAGS=-m32 "${cctools}"/configure \ | |
--target="${target}" \ | |
--prefix="${prefix}" \ | |
--disable-ld64 | |
make | |
make install | |
mkdir -p "${build}" | |
cd "${build}" | |
mkdir gcc-4.2-iphone | |
cd gcc-4.2-iphone | |
"${gcc}"/configure \ | |
--target="${target}" \ | |
--prefix="${prefix}" \ | |
--with-sysroot="${sysroot}" \ | |
--enable-languages=c,c++,objc,obj-c++ \ | |
--with-as="${prefix}"/bin/"${target}"-as \ | |
--with-ld="${prefix}"/bin/"${target}"-ld \ | |
--enable-wchar_t=no \ | |
--with-gxx-include-dir=/usr/include/c++/4.0.0 | |
make -j2 | |
make install | |
mkdir -p "${sysroot}"/"$(dirname "${prefix}")" | |
ln -s "${prefix}" "${sysroot}"/"$(dirname "${prefix}")" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment