Skip to content

Commit

Permalink
Add support for Xcode 4.3.2 and iOS 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
walm committed Mar 30, 2012
1 parent 6a3077f commit 4939b20
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IOS_CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
IOS_CC = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc

all: demo.app fruitstrap

Expand All @@ -9,16 +9,16 @@ demo.app: demo Info.plist
codesign -f -s "iPhone Developer" --entitlements Entitlements.plist demo.app

demo: demo.c
$(IOS_CC) -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -framework CoreFoundation -o demo demo.c
$(IOS_CC) -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -framework CoreFoundation -o demo demo.c

fruitstrap: fruitstrap.c
gcc -o fruitstrap -framework CoreFoundation -framework MobileDevice -F/System/Library/PrivateFrameworks fruitstrap.c

install: all
./fruitstrap demo.app
./fruitstrap -b demo.app

debug: all
./fruitstrap -d demo.app
./fruitstrap -d -b demo.app

clean:
rm -rf *.app demo fruitstrap
rm -rf *.app demo fruitstrap
23 changes: 11 additions & 12 deletions fruitstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#define FDVENDOR_PATH "/tmp/fruitstrap-remote-debugserver"
#define PREP_CMDS_PATH "/tmp/fruitstrap-gdb-prep-cmds"
#define GDB_SHELL "/Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gdb/gdb-arm-apple-darwin --arch armv7 -q -x " PREP_CMDS_PATH
#define GDB_SHELL "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gdb/gdb-arm-apple-darwin --arch armv7 -q -x " PREP_CMDS_PATH

// approximation of what Xcode does:
#define GDB_PREP_CMDS CFSTR("set mi-show-protections off\n\
Expand Down Expand Up @@ -77,25 +77,24 @@ CFStringRef copy_device_support_path(AMDeviceRef device) {

if (!found)
{
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@)"), version, build);
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/%@"), home, version);
found = path_exists(path);
}
if (!found)
{
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/%@"), home, version);
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@"), version);
found = path_exists(path);
}
if (!found)
{
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@"), version);
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@)"), version, build);
found = path_exists(path);
}
if (!found)
{
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@"), version);
path = CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest");
found = path_exists(path);
}

CFRelease(version);
CFRelease(build);

Expand All @@ -120,23 +119,23 @@ CFStringRef copy_developer_disk_image_path(AMDeviceRef device) {
found = path_exists(path);

if (!found) {
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@/DeveloperDiskImage.dmg)"), version, build);
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/@%/DeveloperDiskImage.dmg"), home, version);
found = path_exists(path);
}
if (!found) {
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/@%/DeveloperDiskImage.dmg"), home, version);
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/Latest/DeveloperDiskImage.dmg"), home);
found = path_exists(path);
}
if (!found) {
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/@%/DeveloperDiskImage.dmg"), version);
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@/DeveloperDiskImage.dmg"), version);
found = path_exists(path);
}
if (!found) {
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/Latest/DeveloperDiskImage.dmg"), home);
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@)/DeveloperDiskImage.dmg"), version, build);
found = path_exists(path);
}
if (!found) {
path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/DeveloperDiskImage.dmg"));
path = CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/DeveloperDiskImage.dmg");
found = path_exists(path);
}

Expand Down Expand Up @@ -451,8 +450,8 @@ void handle_device(AMDeviceRef device) {
printf("[100%%] Installed package %s\n", app_path);

if (!debug) exit(0); // no debug phase

AMDeviceConnect(device);

assert(AMDeviceIsPaired(device));
assert(AMDeviceValidatePairing(device) == 0);
assert(AMDeviceStartSession(device) == 0);
Expand Down

0 comments on commit 4939b20

Please sign in to comment.