]> git.saurik.com Git - uikittools.git/commitdiff
Remove gratuitous linking from gssc (for Substrate).
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 26 Oct 2011 14:23:08 +0000 (14:23 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 26 Oct 2011 14:27:40 +0000 (14:27 +0000)
gssc.mm
makefile

diff --git a/gssc.mm b/gssc.mm
index 49321748c396ae9b6d00dd7c53a16dbecf8a021d..434431a12a67b59520c166453914cee57b53082a 100644 (file)
--- a/gssc.mm
+++ b/gssc.mm
@@ -2,6 +2,7 @@
 #import <UIKit/UIKit.h>
 #include <stdio.h>
 #include <dlfcn.h>
+#include <objc/runtime.h>
 
 static CFArrayRef (*$GSSystemCopyCapability)(CFStringRef);
 static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
@@ -17,12 +18,15 @@ void OnGSCapabilityChanged(
 }
 
 int main(int argc, char *argv[]) {
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    dlopen("/System/Library/Frameworks/Foundation.framework/Foundation", RTLD_GLOBAL | RTLD_LAZY);
+    dlopen("/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices", RTLD_GLOBAL | RTLD_LAZY);
+
+    NSAutoreleasePool *pool = [[objc_getClass("NSAutoreleasePool") alloc] init];
 
     NSString *name = nil;
 
     if (argc == 2)
-        name = [NSString stringWithUTF8String:argv[0]];
+        name = [objc_getClass("NSString") stringWithUTF8String:argv[0]];
     else if (argc > 2) {
         fprintf(stderr, "usage: %s [capability]\n", argv[0]);
         exit(1);
@@ -60,10 +64,7 @@ int main(int argc, char *argv[]) {
         CFRunLoopRun();
     }
 
-    NSLog(@"%@", capability);
-
-    /*for (NSString *value in capability)
-        printf("%s\n", [value UTF8String]);*/
+    printf("%s\n", capability == nil ? "(null)" : [[capability description] UTF8String]);
 
     [pool release];
 
index 1695a7582ff42203266fdf6b72db8bbc48406f52..6b390416f84185a2b80863ef7740d5d519ff6101 100644 (file)
--- a/makefile
+++ b/makefile
@@ -7,8 +7,16 @@ clean:
 
 .PHONY: all clean package
 
+cfversion := -framework CoreFoundation
+gssc := -framework CoreFoundation
+sbdidlaunch := -framework CoreFoundation -framework SpringBoardServices
+uicache := -framework Foundation
+uiduid := -framework Foundation -framework UIKit
+uiopen := -framework Foundation -framework UIKit
+uishoot := -framework CoreFoundation -framework Foundation -framework UIKit
+
 %: %.mm
-       $${PKG_TARG}-g++ -Wall -Werror -o $@ $< -framework CoreFoundation -framework Foundation -framework UIKit -framework GraphicsServices -F"$${PKG_ROOT}"/System/Library/PrivateFrameworks -lobjc -framework SpringBoardServices
+       $${PKG_TARG}-g++ -Wall -Werror -o $@ $< $($@) -F"$${PKG_ROOT}"/System/Library/PrivateFrameworks -lobjc
        ldid -S $@
 
 %: %.c