From 1e4922b8442669a0f94a6602a49d950233555fff Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 4 Oct 2010 02:40:27 -0700 Subject: [PATCH] Rewrote the build environment from scratch. --- .gitignore | 4 + Cydia.mm | 227 +++++++++++----------- Reachability.m => Reachability.mm | 4 +- UICaboodle/BrowserView.h | 25 +-- UICaboodle/BrowserView.mm | 79 +++++--- UICaboodle/RVBook.h | 8 +- UICaboodle/RVBook.mm | 8 +- UICaboodle/RVPage.h | 1 + UICaboodle/ResetView.h | 10 - UICaboodle/ResetView.mm | 24 --- compiling.txt | 5 + iPhonePrivate.h | 307 ++++++++++++++++++++++++++++++ makefile | 59 ++++-- sysroot.sh | 111 +++++++++++ 14 files changed, 659 insertions(+), 213 deletions(-) create mode 100644 .gitignore rename Reachability.m => Reachability.mm (99%) create mode 100644 compiling.txt create mode 100644 iPhonePrivate.h create mode 100755 sysroot.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..a4a6c1c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +sysroot +Cydia +_ +*.deb diff --git a/Cydia.mm b/Cydia.mm index 005dc2ee..efbb9b83 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -41,14 +41,13 @@ #define USE_SYSTEM_MALLOC 1 /* #include Directives {{{ */ -#import "UICaboodle/UCPlatform.h" -#import "UICaboodle/UCLocalize.h" +#include "UICaboodle/UCPlatform.h" +#include "UICaboodle/UCLocalize.h" #include #include #include -#include #include #if 0 @@ -60,10 +59,12 @@ #include #include -#import +#include +#include "iPhonePrivate.h" + +#include #include -#import #include #include @@ -100,6 +101,7 @@ #include #include +#include #include #include @@ -116,55 +118,13 @@ extern "C" { #include -#include - -#import "UICaboodle/BrowserView.h" -#import "UICaboodle/ResetView.h" +#include "UICaboodle/BrowserView.h" +#include "UICaboodle/ResetView.h" -#import "substrate.h" +#include "substrate.h" // Apple's sample Reachability code, ASPL licensed. -#import "Reachability.h" -/* }}} */ - -/* Header Fixes and Updates {{{ */ -typedef enum { - UIModalPresentationFullScreen = 0, - UIModalPresentationPageSheet, - UIModalPresentationFormSheet, - UIModalPresentationCurrentContext, -} UIModalPresentationStyle; - -@interface UIAlertView (Private) -- (void)setNumberOfRows:(int)rows; -- (void)setContext:(id)context; -- (id)context; -@end - -@interface UIViewController (UIKit) -- (id)navigationItem; -- (id)navigationController; -- (id)tabBarItem; -@end - -@interface UITabBarController : UIViewController { - id _tabBar; - id _containerView; - id _viewControllerTransitionView; - id _viewControllers; - id _tabBarItemsToViewControllers; - id _selectedViewController; - id _moreNavigationController; - id _customizableViewControllers; - id _delegate; - id _selectedViewControllerDuringWillAppear; - id _transientViewController; - unsigned int isShowingMoreItem:1; - unsigned int needsToRebuildItems:1; - unsigned int isBarHidden:1; - unsigned int editButtonOnLeft:1; -} -@end +#include "Reachability.h" /* }}} */ /* Profiler {{{ */ @@ -686,10 +646,6 @@ NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *s return length; } -@interface NSString (UIKit) -- (NSString *) stringByAddingPercentEscapes; -@end - /* Cydia NSString Additions {{{ */ @interface NSString (Cydia) + (NSString *) stringWithUTF8BytesNoCopy:(const char *)bytes length:(int)length; @@ -1250,13 +1206,15 @@ bool isSectionVisible(NSString *section) { - (void) installPackage:(Package *)package; - (void) installPackages:(NSArray *)packages; - (void) removePackage:(Package *)package; +- (void) beginUpdate; +- (BOOL) updating; - (void) distUpgrade; - (void) updateData; - (void) syncData; - (void) showSettings; - (UIProgressHUD *) addProgressHUD; - (void) removeProgressHUD:(UIProgressHUD *)hud; -- (UIViewController *) pageForPackage:(NSString *)name; +- (UCViewController *) pageForPackage:(NSString *)name; - (PackageController *) packageController; @end /* }}} */ @@ -1448,7 +1406,7 @@ typedef std::map< unsigned long, _H > SourceMap; @end /* }}} */ /* Delegate Helpers {{{ */ -@implementation NSObject(ProgressDelegate) +@implementation NSObject (ProgressDelegate) - (void) _setProgressErrorPackage:(NSArray *)args { [self performSelector:@selector(setProgressError:forPackage:) @@ -1474,7 +1432,7 @@ typedef std::map< unsigned long, _H > SourceMap; - (void) setProgressError:(NSString *)error forPackage:(NSString *)id { Package *package = id == nil ? nil : [[Database sharedInstance] packageWithName:id]; // XXX: holy typecast batman! - [self setProgressError:error withTitle:(package == nil ? id : [package name])]; + [(id)self setProgressError:error withTitle:(package == nil ? id : [package name])]; } @end @@ -4292,7 +4250,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [database_ setDelegate:self]; delegate_ = delegate; - [[self view] setBackgroundColor:(CGColor *)[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]]; + [[self view] setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]]; progress_ = [[UIProgressBar alloc] init]; [progress_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin)]; @@ -4366,7 +4324,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) viewWillAppear:(BOOL)animated { [super viewDidAppear:animated]; [[self navigationItem] setHidesBackButton:YES]; - [[[self navigationController] navigationBar] setBarStyle:1]; + [[[self navigationController] navigationBar] setBarStyle:UIBarStyleBlack]; [self positionViews]; } @@ -4649,8 +4607,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { /* }}} */ /* Cell Content View {{{ */ +@protocol ContentDelegate +- (void) drawContentRect:(CGRect)rect; +@end + @interface ContentView : UIView { - _transient id delegate_; + _transient id delegate_; } @end @@ -4663,7 +4625,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } return self; } -- (void) setDelegate:(id)delegate { +- (void) setDelegate:(id)delegate { delegate_ = delegate; } @@ -4674,7 +4636,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ /* Package Cell {{{ */ -@interface PackageCell : UITableViewCell { +@interface PackageCell : UITableViewCell < + ContentDelegate +> { UIImage *icon_; NSString *name_; NSString *description_; @@ -4889,7 +4853,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ /* Section Cell {{{ */ -@interface SectionCell : UITableViewCell { +@interface SectionCell : UITableViewCell < + ContentDelegate +> { NSString *basic_; NSString *section_; NSString *name_; @@ -4900,7 +4866,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { BOOL editing_; } -- (id) init; - (void) setSection:(Section *)section editing:(BOOL)editing; @end @@ -4997,7 +4962,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [switch_ setOn:(isSectionVisible(basic_) ? 1 : 0) animated:NO]; } - [self setAccessoryType:editing ? 0 : 1 /*UITableViewCellAccessoryDisclosureIndicator*/]; + [self setAccessoryType:editing ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDisclosureIndicator]; [content_ setNeedsDisplay]; } @@ -5036,7 +5001,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { /* }}} */ /* File Table {{{ */ -@interface FileTable : CYViewController { +@interface FileTable : CYViewController < + UITableViewDataSource, + UITableViewDelegate +> { _transient Database *database_; Package *package_; NSString *name_; @@ -5078,7 +5046,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [cell setFont:[UIFont systemFontOfSize:16]]; } [cell setText:[files_ objectAtIndex:indexPath.row]]; - [cell setSelectionStyle:0 /*UITableViewCellSelectionStyleNone*/]; + [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; return cell; } @@ -5208,8 +5176,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } [sheet dismissWithClickedButtonIndex:-1 animated:YES]; - } else { - [super alertSheet:sheet clickedButtonAtIndex:button]; } } @@ -5361,7 +5327,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ /* Package Table {{{ */ -@interface PackageTable : UIView { +@interface PackageTable : UIView < + UITableViewDataSource, + UITableViewDelegate +> { _transient Database *database_; NSMutableArray *packages_; NSMutableArray *sections_; @@ -5425,7 +5394,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } - (UITableViewCell *) tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path { - PackageCell *cell([table dequeueReusableCellWithIdentifier:@"Package"]); + PackageCell *cell((PackageCell *) [table dequeueReusableCellWithIdentifier:@"Package"]); if (cell == nil) cell = [[[PackageCell alloc] init] autorelease]; [cell setPackage:[self packageAtIndexPath:path]]; @@ -5699,7 +5668,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ /* Source Cell {{{ */ -@interface SourceCell : UITableViewCell { +@interface SourceCell : UITableViewCell < + ContentDelegate +> { UIImage *icon_; NSString *origin_; NSString *description_; @@ -5793,7 +5764,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ /* Source Table {{{ */ -@interface SourceTable : CYViewController { +@interface SourceTable : CYViewController < + UITableViewDataSource, + UITableViewDelegate +> { _transient Database *database_; UITableView *list_; NSMutableArray *sources_; @@ -5814,6 +5788,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (id) initWithDatabase:(Database *)database; +- (void) updateButtonsForEditingStatus:(BOOL)editing animated:(BOOL)animated; + @end @implementation SourceTable @@ -5899,8 +5875,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return cell; } -- (int) tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath { - return 1; //UITableViewCellAccessoryDisclosureIndicator? +- (UITableViewCellAccessoryType) tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath { + return UITableViewCellAccessoryDisclosureIndicator; } - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { @@ -6255,6 +6231,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (id) initWithDatabase:(Database *)database; +- (void) updateRoleButton; +- (void) queueStatusDidChange; + @end @implementation InstalledController @@ -6386,6 +6365,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @interface ManageController : CYBrowserController { } +- (void) queueStatusDidChange; @end @implementation ManageController @@ -6499,10 +6479,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; [self setTintColor:[UIColor colorWithRed:0.23 green:0.23 blue:0.23 alpha:1]]; - [self setBarStyle:1]; + [self setBarStyle:UIBarStyleBlack]; - int barstyle([self _barStyle:NO]); - bool ugly(barstyle == 0); + UIBarStyle barstyle([self _barStyle:NO]); + bool ugly(barstyle == UIBarStyleDefault); UIProgressIndicatorStyle style = ugly ? UIProgressIndicatorStyleMediumBrown : @@ -6558,6 +6538,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ +@class CYNavigationController; + /* Cydia Tab Bar Controller {{{ */ @interface CYTabBarController : UITabBarController { Database *database_; @@ -6573,7 +6555,7 @@ freeing the view controllers on tab change */ - (void) reloadData { size_t count([[self viewControllers] count]); for (size_t i(0); i != count; ++i) { - UIViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]); + CYNavigationController *page([[self viewControllers] objectAtIndex:(count - i - 1)]); [page reloadData]; } } @@ -6588,9 +6570,7 @@ freeing the view controllers on tab change */ /* }}} */ /* Cydia Navigation Controller {{{ */ -@interface CYNavigationController : UINavigationController < - ProgressDelegate -> { +@interface CYNavigationController : UINavigationController { _transient Database *database_; id delegate_; } @@ -6619,7 +6599,7 @@ freeing the view controllers on tab change */ - (void) reloadData { size_t count([[self viewControllers] count]); for (size_t i(0); i != count; ++i) { - UIViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]); + CYViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]); [page reloadData]; } } @@ -6738,7 +6718,10 @@ freeing the view controllers on tab change */ /* }}} */ /* Sections Controller {{{ */ -@interface SectionsController : CYViewController { +@interface SectionsController : CYViewController < + UITableViewDataSource, + UITableViewDelegate +> { _transient Database *database_; NSMutableArray *sections_; NSMutableArray *filtered_; @@ -6751,6 +6734,8 @@ freeing the view controllers on tab change */ - (void) reloadData; - (void) resetView; +- (void) editButtonClicked; + @end @implementation SectionsController @@ -6967,7 +6952,10 @@ freeing the view controllers on tab change */ @end /* }}} */ /* Changes Controller {{{ */ -@interface ChangesController : CYViewController { +@interface ChangesController : CYViewController < + UITableViewDataSource, + UITableViewDelegate +> { _transient Database *database_; NSMutableArray *packages_; NSMutableArray *sections_; @@ -7027,7 +7015,7 @@ freeing the view controllers on tab change */ } - (UITableViewCell *) tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path { - PackageCell *cell([table dequeueReusableCellWithIdentifier:@"Package"]); + PackageCell *cell((PackageCell *) [table dequeueReusableCellWithIdentifier:@"Package"]); if (cell == nil) cell = [[[PackageCell alloc] init] autorelease]; [cell setPackage:[self packageAtIndexPath:path]]; @@ -7048,7 +7036,7 @@ freeing the view controllers on tab change */ } - (void) refreshButtonClicked { - [[UIApplication sharedApplication] beginUpdate]; + [delegate_ beginUpdate]; [[self navigationItem] setLeftBarButtonItem:nil]; } @@ -7187,15 +7175,17 @@ freeing the view controllers on tab change */ target:self action:@selector(refreshButtonClicked) ]; - if (![[UIApplication sharedApplication] updating]) [[self navigationItem] setLeftBarButtonItem:leftItem]; + if (![delegate_ updating]) [[self navigationItem] setLeftBarButtonItem:leftItem]; [leftItem release]; } @end /* }}} */ /* Search Controller {{{ */ -@interface SearchController : FilteredPackageController { - id search_; +@interface SearchController : FilteredPackageController < + UISearchBarDelegate +> { + UISearchBar *search_; } - (id) initWithDatabase:(Database *)database; @@ -7230,7 +7220,7 @@ freeing the view controllers on tab change */ - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if (!search_) { - search_ = [[objc_getClass("UISearchBar") alloc] initWithFrame:CGRectMake(0, 0, [[self view] bounds].size.width, 44.0f)]; + search_ = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, [[self view] bounds].size.width, 44.0f)]; [search_ layoutSubviews]; [search_ setPlaceholder:UCLocalize("SEARCH_EX")]; UITextField *textField = [search_ searchField]; @@ -7260,7 +7250,10 @@ freeing the view controllers on tab change */ @end /* }}} */ /* Settings Controller {{{ */ -@interface SettingsController : CYViewController { +@interface SettingsController : CYViewController < + UITableViewDataSource, + UITableViewDelegate +> { _transient Database *database_; NSString *name_; Package *package_; @@ -7438,13 +7431,20 @@ freeing the view controllers on tab change */ @end /* }}} */ /* Role Controller {{{ */ -@interface RoleController : CYViewController { +@interface RoleController : CYViewController < + UITableViewDataSource, + UITableViewDelegate +> { _transient Database *database_; id roledelegate_; UITableView *table_; UISegmentedControl *segment_; UIView *container_; } + +- (void) showDoneButton; +- (void) resizeSegmentedControl; + @end @implementation RoleController @@ -7605,9 +7605,15 @@ freeing the view controllers on tab change */ bool dropped_; bool updating_; id updatedelegate_; - UIViewController *root_; + UITabBarController *root_; } +- (void) setTabBarController:(UITabBarController *)controller; + +- (void) dropBar:(BOOL)animated; +- (void) beginUpdate; +- (void) raiseBar:(BOOL)animated; + @end @implementation CYContainer @@ -7639,7 +7645,7 @@ freeing the view controllers on tab change */ return YES; /* XXX: return YES; */ } -- (void) setRootController:(UIViewController *)controller { +- (void) setTabBarController:(UITabBarController *)controller { root_ = controller; [[self view] addSubview:[root_ view]]; } @@ -7862,8 +7868,8 @@ typedef enum { bool loaded_; } -- (UIViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class; -- (void) setPage:(UIViewController *)page; +- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class; +- (void) setPage:(UCViewController *)page; @end @@ -7945,7 +7951,7 @@ static _finline void _setHomePage(Cydia *self) { if (tag_ != 4 && search_ != nil) [search_ reloadData]; - [[tabbar_ selectedViewController] reloadData]; + [(CYNavigationController *)[tabbar_ selectedViewController] reloadData]; } - (int)indexOfTabWithTag:(int)tag { @@ -8187,17 +8193,17 @@ static _finline void _setHomePage(Cydia *self) { [self complete]; } -- (void) setPage:(UIViewController *)page { +- (void) setPage:(UCViewController *)page { [page setDelegate:self]; - UINavigationController *navController = [tabbar_ selectedViewController]; + CYNavigationController *navController = (CYNavigationController *) [tabbar_ selectedViewController]; [navController setViewControllers:[NSArray arrayWithObject:page] animated:NO]; - for (UIViewController *page in [tabbar_ viewControllers]) { + for (CYNavigationController *page in [tabbar_ viewControllers]) { if (page != navController) [page setViewControllers:nil]; } } -- (UIViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class { +- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class { CYBrowserController *browser = [[[_class alloc] init] autorelease]; [browser loadURL:url]; return browser; @@ -8249,7 +8255,7 @@ static _finline void _setHomePage(Cydia *self) { - (void) tabBarController:(id)tabBarController didSelectViewController:(UIViewController *)viewController { int tag = [[viewController tabBarItem] tag]; if (tag == tag_) { - [[tabbar_ selectedViewController] popToRootViewControllerAnimated:YES]; + [(CYNavigationController *)[tabbar_ selectedViewController] popToRootViewControllerAnimated:YES]; return; } else if (tag_ == 1) { [[self sectionsController] resetView]; @@ -8333,7 +8339,7 @@ static _finline void _setHomePage(Cydia *self) { Queuing_ = true; [[[[tabbar_ viewControllers] objectAtIndex:[self indexOfTabWithTag:kManageTag] != -1 ? [self indexOfTabWithTag:kManageTag] : [self indexOfTabWithTag:kInstalledTag]] tabBarItem] setBadgeValue:UCLocalize("Q_D")]; - [[tabbar_ selectedViewController] reloadData]; + [(CYNavigationController *)[tabbar_ selectedViewController] reloadData]; [queueDelegate_ queueStatusDidChange]; } @@ -8426,7 +8432,7 @@ static _finline void _setHomePage(Cydia *self) { [window_ setUserInteractionEnabled:YES]; } -- (UIViewController *) pageForPackage:(NSString *)name { +- (UCViewController *) pageForPackage:(NSString *)name { if (Package *package = [database_ packageWithName:name]) { PackageController *view([self packageController]); [view setPackage:package]; @@ -8438,7 +8444,7 @@ static _finline void _setHomePage(Cydia *self) { } } -- (UIViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag { +- (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag { if (tag != NULL) *tag = -1; @@ -8490,7 +8496,7 @@ static _finline void _setHomePage(Cydia *self) { - (void) applicationOpenURL:(NSURL *)url { [super applicationOpenURL:url]; int tag; - if (UIViewController *page = [self pageForURL:url hasTag:&tag]) { + if (UCViewController *page = [self pageForURL:url hasTag:&tag]) { [self setPage:page]; tag_ = tag; [tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])]; @@ -8590,9 +8596,8 @@ static _finline void _setHomePage(Cydia *self) { [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("MANAGE") image:[UIImage applicationImageNamed:@"manage.png"] tag:kManageTag] autorelease] atIndex:3]; } - for (int i = 0; i < [items count]; i++) { + for (size_t i(0); i != [items count]; i++) [[controllers objectAtIndex:i] setTabBarItem:[items objectAtIndex:i]]; - } tabbar_ = [[CYTabBarController alloc] initWithDatabase:database_]; [tabbar_ setViewControllers:controllers]; @@ -8601,7 +8606,7 @@ static _finline void _setHomePage(Cydia *self) { container_ = [[CYContainer alloc] initWithDatabase:database_]; [container_ setUpdateDelegate:self]; - [container_ setRootController:tabbar_]; + [container_ setTabBarController:tabbar_]; [window_ addSubview:[container_ view]]; [[tabbar_ view] setFrame:CGRectMake(0, -20.0f, [window_ bounds].size.width, [window_ bounds].size.height)]; diff --git a/Reachability.m b/Reachability.mm similarity index 99% rename from Reachability.m rename to Reachability.mm index 5ecdcf4e..31c0ed0b 100644 --- a/Reachability.m +++ b/Reachability.mm @@ -192,7 +192,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach { PrintReachabilityFlags(flags, "localWiFiStatusForFlags"); - BOOL retVal = NotReachable; + NetworkStatus retVal = NotReachable; if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect)) { retVal = ReachableViaWiFi; @@ -209,7 +209,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach return NotReachable; } - BOOL retVal = NotReachable; + NetworkStatus retVal = NotReachable; if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) { diff --git a/UICaboodle/BrowserView.h b/UICaboodle/BrowserView.h index ec779c94..2f77f841 100644 --- a/UICaboodle/BrowserView.h +++ b/UICaboodle/BrowserView.h @@ -1,22 +1,9 @@ #import "ResetView.h" -#include -#include -#include -#include #include -#include - #include -#include -#include #include - -#import -#import - -#include -#include +#include #import @@ -43,7 +30,9 @@ - (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag; @end -@interface BrowserController : UCViewController { +@interface BrowserController : UCViewController < + HookProtocol +> { UIScroller *scroller_; UIWebDocumentView *document_; UIProgressIndicator *indicator_; @@ -118,4 +107,10 @@ - (bool) promptForSensitive:(NSString *)name; - (bool) allowSensitiveRequests; +- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button; +- (void) applyRightButton; + +- (void) _startLoading; +- (void) close; + @end \ No newline at end of file diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index 5fa21e16..8dd2afa0 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -1,12 +1,28 @@ +#include +#include "iPhonePrivate.h" + +#include "UCPlatform.h" + #include #include -#import +//#include // XXX: fix the minimum requirement extern NSString * const kCAFilterNearest; #include -#include + +#include +#include + +#include +#include +#include +#include +#include + +//#include +//#include #include "substrate.h" @@ -19,12 +35,10 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); static Class $UIFormAssistant; static Class $UIWebBrowserView; -@interface NSString (UIKit) -- (NSString *) stringByAddingPercentEscapes; -@end - /* Indirect Delegate {{{ */ -@interface IndirectDelegate : NSObject { +@interface IndirectDelegate : NSObject < + HookProtocol +> { _transient volatile id delegate_; } @@ -89,6 +103,11 @@ static Class $UIWebBrowserView; return nil; } +- (void) didDismissModalViewController { + if (delegate_ != nil) + return [delegate_ didDismissModalViewController]; +} + - (IMP) methodForSelector:(SEL)sel { if (IMP method = [super methodForSelector:sel]) return method; @@ -125,11 +144,19 @@ static Class $UIWebBrowserView; /* }}} */ @interface WebView (UICaboodle) -- (void) setScriptDebugDelegate:(id)delegate; ++ (BOOL) _canHandleRequest:(NSURLRequest *)request; - (void) _setFormDelegate:(id)delegate; +- (void) _setLayoutInterval:(float)interval; +- (void) setScriptDebugDelegate:(id)delegate; - (void) _setUIKitDelegate:(id)delegate; +- (void) _setUsesLoaderCache:(BOOL)uses; - (void) setWebMailDelegate:(id)delegate; -- (void) _setLayoutInterval:(float)interval; +@end + +@interface WebPreferences (Apple) ++ (void) _setInitialDefaultTextEncodingToSystemEncoding; +- (void) _setLayoutInterval:(NSInteger)interval; +- (void) setOfflineWebApplicationCacheEnabled:(BOOL)enabled; @end @implementation WebScriptObject (UICaboodle) @@ -356,7 +383,7 @@ static Class $UIWebBrowserView; if ([scroller_ respondsToSelector:@selector(setScrollerIndicatorSubrect:)]) [scroller_ setScrollerIndicatorSubrect:subrect]; - [document_ setValue:[NSValue valueWithSize:NSMakeSize(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize]; + [document_ setValue:[NSValue valueWithSize:CGSizeMake(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize]; CGSize size(size_); size.height += extra; @@ -581,7 +608,7 @@ static Class $UIWebBrowserView; } - (void) _openMailToURL:(NSURL *)url { - [UIApp openURL:url];// asPanel:YES]; + [[UIApplication sharedApplication] openURL:url];// asPanel:YES]; } - (void) webView:(WebView *)sender willBeginEditingFormElement:(id)element { @@ -675,7 +702,7 @@ static Class $UIWebBrowserView; WebView *webview([document_ webView]); if (frame == [webview mainFrame]) - [UIApp openURL:[request URL]]; + [[UIApplication sharedApplication] openURL:[request URL]]; } } @@ -728,7 +755,7 @@ static Class $UIWebBrowserView; )) { url = open; open: - [UIApp openURL:url]; + [[UIApplication sharedApplication] openURL:url]; goto ignore; } @@ -1027,17 +1054,13 @@ static Class $UIWebBrowserView; [self _startLoading]; } -- (UINavigationButtonStyle) rightButtonStyle { +- (UIBarButtonItemStyle) rightButtonStyle { if (style_ == nil) normal: - return UINavigationButtonStyleNormal; + return UIBarButtonItemStylePlain; else if ([style_ isEqualToString:@"Normal"]) - return UINavigationButtonStyleNormal; - else if ([style_ isEqualToString:@"Back"]) - return UINavigationButtonStyleBack; + return UIBarButtonItemStylePlain; else if ([style_ isEqualToString:@"Highlighted"]) - return UINavigationButtonStyleHighlighted; - else if ([style_ isEqualToString:@"Destructive"]) - return UINavigationButtonStyleDestructive; + return UIBarButtonItemStyleDone; else goto normal; } @@ -1522,8 +1545,12 @@ static Class $UIWebBrowserView; WebView *webview([document_ webView]); WebFrame *frame([webview mainFrame]); + WebPreferences *preferences([webview preferences]); + + bool maybe([preferences javaScriptCanOpenWindowsAutomatically]); + [preferences setJavaScriptCanOpenWindowsAutomatically:NO]; - id _private(MSHookIvar(webview, "_private")); + /*id _private(MSHookIvar(webview, "_private")); WebCore::Page *page(_private == nil ? NULL : MSHookIvar(_private, "page")); WebCore::Settings *settings(page == NULL ? NULL : page->settings()); @@ -1533,7 +1560,7 @@ static Class $UIWebBrowserView; else { no = settings->JavaScriptCanOpenWindowsAutomatically(); settings->setJavaScriptCanOpenWindowsAutomatically(true); - } + }*/ if (UIWindow *window = [[self view] window]) if (UIResponder *responder = [window firstResponder]) @@ -1543,8 +1570,10 @@ static Class $UIWebBrowserView; JSGlobalContextRef context([frame globalContext]); JSObjectCallAsFunction(context, object, NULL, 0, NULL, NULL); - if (settings != NULL) - settings->setJavaScriptCanOpenWindowsAutomatically(no); + /*if (settings != NULL) + settings->setJavaScriptCanOpenWindowsAutomatically(no);*/ + + [preferences setJavaScriptCanOpenWindowsAutomatically:maybe]; WebThreadUnlock(); } diff --git a/UICaboodle/RVBook.h b/UICaboodle/RVBook.h index b605cc65..09b1baf5 100644 --- a/UICaboodle/RVBook.h +++ b/UICaboodle/RVBook.h @@ -2,10 +2,14 @@ #import +@protocol HookProtocol +- (void) didDismissModalViewController; +@end + @interface UCNavigationController : UINavigationController { - id hook_; + id hook_; } -- (void) setHook:(id)hook; +- (void) setHook:(id)hook; @end diff --git a/UICaboodle/RVBook.mm b/UICaboodle/RVBook.mm index 2271cee7..ba201aef 100644 --- a/UICaboodle/RVBook.mm +++ b/UICaboodle/RVBook.mm @@ -1,12 +1,6 @@ #import "RVBook.h" -#import -#import - -#import - -#import -#import +#import #import #import diff --git a/UICaboodle/RVPage.h b/UICaboodle/RVPage.h index 270c248f..d2f84fa5 100644 --- a/UICaboodle/RVPage.h +++ b/UICaboodle/RVPage.h @@ -6,5 +6,6 @@ id delegate_; } - (void)setDelegate:(id)delegate; +- (void) reloadData; @end diff --git a/UICaboodle/ResetView.h b/UICaboodle/ResetView.h index 1f925903..9f9fafbe 100644 --- a/UICaboodle/ResetView.h +++ b/UICaboodle/ResetView.h @@ -8,17 +8,7 @@ - (void) clearView; @end -@interface UITable (RVBook) -- (void) resetViewAnimated:(BOOL)animated; -- (void) clearView; -@end - @interface UITableView (RVBook) - (void) resetViewAnimated:(BOOL)animated; - (void) clearView; @end - -@interface UISectionList (RVBook) -- (void) resetViewAnimated:(BOOL)animated; -- (void) clearView; -@end diff --git a/UICaboodle/ResetView.mm b/UICaboodle/ResetView.mm index bd1c8ee8..ffdb0431 100644 --- a/UICaboodle/ResetView.mm +++ b/UICaboodle/ResetView.mm @@ -22,18 +22,6 @@ @end -@implementation UITable (RVBook) - -- (void) resetViewAnimated:(BOOL)animated { - [self selectRow:-1 byExtendingSelection:NO withFade:animated]; -} - -- (void) clearView { - [self clearAllData]; -} - -@end - @implementation UITableView (RVBook) - (void) resetViewAnimated:(BOOL)animated { @@ -47,15 +35,3 @@ } @end - -@implementation UISectionList (RVBook) - -- (void) resetViewAnimated:(BOOL)animated { - [[self table] resetViewAnimated:animated]; -} - -- (void) clearView { - [[self table] clearView]; -} - -@end diff --git a/compiling.txt b/compiling.txt new file mode 100644 index 00000000..411d0b16 --- /dev/null +++ b/compiling.txt @@ -0,0 +1,5 @@ +0) use a Mac (I'm sorry, I really am) +1) install Cydia Substrate (in beta) +2) install Fink (the only sane choice) +3) activate Fink (. /sw/bin/init.sh) +4) fink install bash ldid wget diff --git a/iPhonePrivate.h b/iPhonePrivate.h new file mode 100644 index 00000000..8e63ef12 --- /dev/null +++ b/iPhonePrivate.h @@ -0,0 +1,307 @@ +#ifndef CYDIA_UIKITPRIVATE_H + +#include + +typedef enum { + UIGestureAttributeMinDegrees, /*float*/ + UIGestureAttributeMaxDegrees, /*float*/ + UIGestureAttributeMinScale, /*float*/ + UIGestureAttributeMaxScale, /*float*/ + UIGestureAttributeIsZoomRubberBandEnabled, /*BOOL*/ + UIGestureAttributeZoomsFromCurrentToMinOrMax, /*BOOL*/ + UIGestureAttributeVisibleSize, /*CGSize*/ + UIGestureAttributeUpdatesScroller, /*BOOL*/ +} UIGestureAttribute; + +typedef enum { + UINavigationButtonStyleNormal, + UINavigationButtonStyleBack, + UINavigationButtonStyleHighlighted, + UINavigationButtonStyleDestructive +} UINavigationButtonStyle; + +typedef enum { + UIProgressIndicatorStyleLargeWhite, + UIProgressIndicatorStyleMediumWhite, + UIProgressIndicatorStyleMediumBrown, + UIProgressIndicatorStyleSmallWhite, + UIProgressIndicatorStyleSmallBlack, + UIProgressIndicatorStyleTinyWhite, +} UIProgressIndicatorStyle; + + +@class WebView; + + +@interface NSString (Apple) +- (void) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font ellipsis:(BOOL)ellipsis; +- (NSString *) stringByAddingPercentEscapes; +- (NSString *) stringByReplacingCharacter:(UniChar)from withCharacter:(UniChar)to; +@end + +@interface NSURL (Apple) +- (BOOL) isGoogleMapsURL; +- (BOOL) isSpringboardHandledURL; +// XXX: make this an enum +- (NSURL *) itmsURL:(NSInteger *)store; +- (NSURL *) mapsURL; +- (NSURL *) phobosURL; +- (NSURL *) youTubeURL; +@end + +@interface NSValue (Apple) ++ (NSValue *) valueWithSize:(CGSize)size; +@end + + +@interface UIActionSheet (Apple) +- (NSString *) context; +@end + +@interface UIAlertView (Apple) +- (void) addTextFieldWithValue:(NSString *)value label:(NSString *)label; +- (id) buttons; +- (NSString *) context; +- (void) setContext:(NSString *)context; +- (void) setNumberOfRows:(int)rows; +- (void) setRunsModal:(BOOL)modal; +- (UITextField *) textField; +- (UITextField *) textFieldAtIndex:(NSUInteger)index; +- (void) _updateFrameForDisplay; +@end + +@interface UIApplication (Apple) +- (void) applicationSuspend:(GSEventRef)event; +- (void) _animateSuspension:(BOOL)suspend duration:(double)duration startTime:(double)start scale:(float)scale; +- (void) applicationOpenURL:(NSURL *)url; +- (void) applicationWillResignActive:(UIApplication *)application; +- (void) applicationWillSuspend; +- (void) launchApplicationWithIdentifier:(NSString *)identifier suspended:(BOOL)suspended; +- (void) removeApplicationBadge; +- (void) setApplicationBadge:(NSString *)badge; +- (void) setApplicationBadgeString:(NSString *)badge; +- (void) setStatusBarShowsProgress:(BOOL)shows; +- (void) _setSuspended:(BOOL)suspended; +- (void) terminateWithSuccess; +@end + +@interface UIBarButtonItem (Apple) +- (UIView *) view; +@end + +@interface UIColor (Apple) ++ (UIColor *) pinStripeColor; +@end + +@interface UIControl (Apple) +- (void) addTarget:(id)target action:(SEL)action forEvents:(NSInteger)events; +@end + +@interface UIDevice (Apple) +- (BOOL) isWildcat; +@end + +@interface UIImage (Apple) ++ (UIImage *) applicationImageNamed:(NSString *)name; ++ (UIImage *) imageAtPath:(NSString *)path; +@end + +@interface UINavigationBar (Apple) ++ (CGSize) defaultSize; +- (UIBarStyle) _barStyle:(BOOL)style; +@end + +@interface UISearchBar (Apple) +- (UITextField *) searchField; +@end + +@interface UITabBarItem (Apple) +- (void) setAnimatedBadge:(BOOL)animated; +@end + +@interface UITableViewCell (Apple) +- (float) selectionPercent; +@end + +@interface UITextField (Apple) +- (UITextInputTraits *) textInputTraits; +@end + +@interface UITextView (Apple) +- (UIFont *) font; +- (void) setAllowsRubberBanding:(BOOL)rubberbanding; +- (void) setFont:(UIFont *)font; +- (void) setMarginTop:(int)margin; +- (void) setTextColor:(UIColor *)color; +@end + +@interface UIView (Apple) +- (void) setEnabledGestures:(NSInteger)gestures; +- (void) setGestureDelegate:(id)delegate; +- (void) setNeedsDisplayOnBoundsChange:(BOOL)needs; +- (void) setValue:(NSValue *)value forGestureAttribute:(NSInteger)attribute; +- (void) setZoomScale:(float)scale duration:(double)duration; +- (void) _setZoomScale:(float)scale duration:(double)duration; +@end + +@interface UIViewController (Apple) +- (void) _updateLayoutForStatusBarAndInterfaceOrientation; +@end + +@interface UIWindow (Apple) +- (UIResponder *) firstResponder; +- (void) makeKey:(UIApplication *)application; +- (void) orderFront:(UIApplication *)application; +@end + + +@interface UIFormAssistant : UIView ++ (UIFormAssistant *) sharedFormAssistant; +- (CGRect) peripheralFrame; +@end + +@interface UIKeyboard : UIView ++ (void) initImplementationNow; +@end + +@interface UIProgressBar : UIView ++ (CGSize) defaultSize; +- (void) setProgress:(float)progress; +- (void) setStyle:(NSInteger)style; +@end + +@interface UIProgressHUD : UIView +- (id) initWithWindow:(UIWindow *)window; +- (void) setText:(NSString *)text; +- (void) show:(BOOL)show; +@end + +@interface UIProgressIndicator : UIView ++ (CGSize) defaultSizeForStyle:(NSUInteger)style; +- (NSUInteger) activityIndicatorViewStyle; +- (void) setStyle:(UIProgressIndicatorStyle)style; +- (void) startAnimation; +@end + +@interface UIScroller : UIView +- (CGSize) contentSize; +- (BOOL) releaseRubberBandIfNecessary; +- (void) scrollPointVisibleAtTopLeft:(CGPoint)point; +- (void) scrollRectToVisible:(CGRect)rect animated:(BOOL)animated; +- (void) setAdjustForContentSizeChange:(BOOL)adjust; +- (void) setAllowsRubberBanding:(BOOL)allows; +- (void) setBounces:(BOOL)bounces; +- (void) setClipsSubviews:(BOOL)clips; +- (void) setContentSize:(CGSize)size; +- (void) setDelegate:(id)delegate; +- (void) setDirectionalScrolling:(BOOL)directional; +- (void) setEventMode:(NSInteger)mode; +- (void) setFixedBackgroundPattern:(BOOL)fixed; +- (void) setOffset:(CGPoint)offset; +- (void) setScrollHysteresis:(float)hysteresis; +- (void) setScrollerIndicatorSubrect:(CGRect)rect; +- (void) setScrollingEnabled:(BOOL)enabled; +- (void) setShowBackgroundShadow:(BOOL)shows; +- (void) setThumbDetectionEnabled:(BOOL)enabled; +@end + +@interface UITextLabel : UIView +- (void) setCentersHorizontally:(BOOL)centers; +- (void) setColor:(UIColor *)color; +- (void) setFont:(UIFont *)font; +- (void) setText:(NSString *)text; +@end + +@interface UIWebDocumentView : UIView +- (CGRect) documentBounds; +- (void) enableReachability; +- (void) loadRequest:(NSURLRequest *)request; +- (void) redrawScaledDocument; +- (UIScroller *) _scroller; +- (void) setAllowsImageSheet:(BOOL)allows; +- (void) setAllowsMessaging:(BOOL)allows; +- (void) setAutoresizes:(BOOL)autoresizes; +- (void) setContentsPosition:(NSInteger)position; +- (void) setDataDetectorTypes:(NSUInteger)types; +- (void) setDelegate:(id)delegate; +- (void) setDetectsPhoneNumbers:(BOOL)detects; +- (void) _setDocumentType:(NSInteger)type; +- (void) setDrawsGrid:(BOOL)draws; +- (void) setFormEditingDelegate:(id)delegate; +- (void) setInitialScale:(float)scale forDocumentTypes:(NSInteger)types; +- (void) setInteractionDelegate:(id)delegate; +- (void) setLogsTilingChanges:(BOOL)logs; +- (void) setMinimumScale:(float)scale forDocumentTypes:(NSInteger)types; +- (void) setMinimumSize:(CGSize)size; +- (void) setMaximumScale:(float)scale forDocumentTypes:(NSInteger)tpyes; +- (void) setSmoothsFonts:(BOOL)smooths; +- (void) setTileMinificationFilter:(NSString *)filter; +- (void) setTileSize:(CGSize)size; +- (void) setTilingEnabled:(BOOL)enabled; +- (void) setViewportSize:(CGSize)size forDocumentTypes:(NSInteger)types; +- (void) setZoomsFocusedFormControl:(BOOL)zooms; +- (void) useSelectionAssistantWithMode:(NSInteger)mode; +- (WebView *) webView; +- (void) webView:(WebView *)view attachRootLayer:(id)layer; +- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didFailLoadWithError:(id)error forFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didFinishDocumentLoadForFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didFinishLoadForFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didFirstLayoutInFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didFirstVisuallyNonEmptyLayoutInFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didHideFullScreenForPlugInView:(id)plugin; +- (void) webView:(WebView *)view didObserveDeferredContentChange:(NSInteger)change forFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didReceiveDocTypeForFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view didReceiveMessage:(id)message; +- (void) webView:(WebView *)view didReceiveViewportArguments:(id)arguments forFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view formStateDidBlurNode:(id)state; +- (void) webView:(WebView *)view formStateDidFocusNode:(id)state; +- (void) webView:(WebView *)view needsScrollNotifications:(id)notifications forFrame:(WebFrame *)frame; +- (id) webView:(WebView *)view plugInViewWithArguments:(id)arguments fromPlugInPackage:(id)package; +- (void) webView:(WebView *)view restoreStateFromHistoryItem:(id)item forFrame:(WebFrame *)frame force:(BOOL)force; +- (void) webView:(WebView *)view saveStateToHistoryItem:(id)item forFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view willAddPlugInView:(id)plugin; +- (void) webView:(WebView *)view willCloseFrame:(WebFrame *)frame; +- (void) webView:(WebView *)view willShowFullScreenForPlugInView:(id)plugin; +- (BOOL) webView:(WebView *)view shouldScrollToPoint:(CGPoint)point forFrame:(WebFrame *)frame; +- (void) webViewDidLayout:(WebView *)view; +- (void) webViewDidPreventDefaultForEvent:(WebView *)view; +- (void) webViewFormEditedStatusHasChanged:(WebView *)changed; +@end + + +@interface UINavigationButton : UIButton +- (id) initWithTitle:(NSString *)title style:(UINavigationButtonStyle)style; +- (void) setBarStyle:(UIBarStyle)style; +@end + +@interface UIPushButton : UIControl +- (id) backgroundForState:(NSUInteger)state; +- (void) setAutosizesToFit:(BOOL)autosizes; +- (void) setBackground:(id)background forState:(NSUInteger)state; +- (void) setDrawsShadow:(BOOL)draws; +- (void) setStretchBackground:(BOOL)stretch; +- (void) setTitle:(NSString *)title; +- (void) setTitleFont:(UIFont *)font; +@end + +@interface UIThreePartButton : UIPushButton +@end + + +@interface WebDefaultUIKitDelegate : NSObject ++ (WebDefaultUIKitDelegate *) sharedUIKitDelegate; +@end + + +extern "C" CFStringRef const kGSDisplayIdentifiersCapability; + +extern "C" float const UIWebViewGrowsAndShrinksToFitHeight; +extern "C" float const UIWebViewScalesToFitScale; + + +extern "C" UIImage *_UIImageWithName(NSString *name); +extern "C" void UISetColor(CGColorRef color); + + +#endif//CYDIA_UIKITPRIVATE_H diff --git a/makefile b/makefile index e13ebfab..ddb9024a 100644 --- a/makefile +++ b/makefile @@ -1,42 +1,67 @@ -ifndef PKG_TARG -target := -else -target := $(PKG_TARG)- -endif +ios := 3.2 + +flags := +link := + +#dpkg := /Library/Cydia/bin/dpkg-deb -Zlzma +dpkg := dpkg-deb + +flags += -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(ios).sdk/System/Library/PrivateFrameworks +flags += -I. -isystem sysroot/usr/include -Lsysroot/usr/lib +flags += -Wall -Werror -Wno-deprecated-declarations +flags += -fmessage-length=0 +flags += -g0 -O2 +flags += -fobjc-call-cxx-cdtors -fobjc-exceptions + +link += -framework CoreFoundation +link += -framework CoreGraphics +link += -framework Foundation +link += -framework GraphicsServices +link += -framework IOKit +link += -framework JavaScriptCore +link += -framework QuartzCore +link += -framework SystemConfiguration +link += -framework UIKit +link += -framework WebCore +link += -framework WebKit + +link += -lapr-1 +link += -lapt-pkg +link += -lpcre + +link += -multiply_defined suppress all: Cydia clean: rm -f Cydia -Cydia: Cydia.mm UICaboodle/*.mm ../mobilesubstrate/*.h #makefile - $(target)g++ -march=armv6 -mcpu=arm1176jzf-s -mthumb -I. -I../mobilesubstrate -fobjc-call-cxx-cdtors -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework IOKit -framework CoreFoundation -framework Foundation -framework CoreGraphics -framework GraphicsServices -framework QuartzCore -framework JavaScriptCore -framework WebCore -framework WebKit -lobjc -lapt-pkg -lpcre -fobjc-exceptions -F"$${PKG_ROOT}"/System/Library/PrivateFrameworks -multiply_defined suppress -lapr-1 - -sign: Cydia - CODESIGN_ALLOCATE=$$(which "$(target)codesign_allocate") ldid -Slaunch.xml Cydia +Cydia: Cydia.mm Reachability.mm UICaboodle/*.mm + cycc -r4.2 -i$(ios) -o$@ -- $(filter %.mm,$^) $(flags) $(link) -package: sign +package: Cydia rm -rf _ mkdir -p _/var/lib/cydia mkdir -p _/usr/libexec - svn export Library _/usr/libexec/cydia - cp -a /apl/tel/dest/iphoneos-arm/coreutils/usr/bin/du _/usr/libexec/cydia + cp -a Library _/usr/libexec/cydia + # XXX: fix du + #cp -a /apl/tel/dest/iphoneos-arm/coreutils/usr/bin/du _/usr/libexec/cydia mkdir -p _/System/Library - svn export LaunchDaemons _/System/Library/LaunchDaemons + cp -a LaunchDaemons _/System/Library/LaunchDaemons mkdir -p _/Applications - svn export Cydia.app _/Applications/Cydia.app + cp -a Cydia.app _/Applications/Cydia.app cp -a Cydia _/Applications/Cydia.app/Cydia_ chmod 6755 _/Applications/Cydia.app/Cydia_ mkdir -p _/System/Library/PreferenceBundles - svn export CydiaSettings.bundle _/System/Library/PreferenceBundles/CydiaSettings.bundle + cp -a CydiaSettings.bundle _/System/Library/PreferenceBundles/CydiaSettings.bundle mkdir -p _/DEBIAN echo "$$(cat control)"$$'\nInstalled-Size: '"$$(du -s _ | cut -f 1)" > _/DEBIAN/control - dpkg-deb -Zlzma -b _ $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb + $(dpkg) -b _ $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb .PHONY: all clean sign diff --git a/sysroot.sh b/sysroot.sh new file mode 100755 index 00000000..db06c108 --- /dev/null +++ b/sysroot.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash + +if [[ ${BASH_VERSION} != 4* ]]; then + echo "bash 4.0 required" 1>&2 + exit 1 +fi + +shopt -s extglob +shopt -s nullglob + +PATH=/Library/Cydia/bin:$PATH + +rm -rf sysroot +mkdir sysroot +cd sysroot + +repository=http://apt.saurik.com/ +distribution=tangelo +component=main +architecture=iphoneos-arm + +wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture}/Packages.bz2" | bzcat | { + regex='^([^ \t]*): *(.*)' + declare -A fields + + while IFS= read -r line; do + if [[ ${line} == '' ]]; then + package=${fields[package]} + if [[ ${package} == *(apr|apr-lib|apt7|apt7-lib|mobilesubstrate|pcre) ]]; then + filename=${fields[filename]} + wget -O "${package}.deb" "${repository}${filename}" + dpkg-deb -x "${package}.deb" . + fi + + unset fields + declare -A fields + elif [[ ${line} =~ ${regex} ]]; then + name=${BASH_REMATCH[1],,} + value=${BASH_REMATCH[2]} + fields[${name}]=${value} + fi + done +} + +rm -f *.deb + +mkdir -p usr/include +cd usr/include + +mkdir CoreFoundation +wget -O CoreFoundation/CFBundlePriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFBundlePriv.h?txt" +wget -O CoreFoundation/CFPriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFPriv.h?txt" +wget -O CoreFoundation/CFUniChar.h "http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt" + +if true; then + mkdir -p WebCore + wget -O WebCore/WebCoreThread.h 'http://www.opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h?txt' +else + wget -O WebCore.tgz http://www.opensource.apple.com/tarballs/WebCore/WebCore-658.28.tar.gz + tar -zx --transform 's@^[^/]*/@WebCore.d/@' -f WebCore.tgz + + mkdir WebCore + cp -a WebCore.d/{*,rendering/style,platform/graphics/transforms}/*.h WebCore + cp -a WebCore.d/platform/{animation,graphics,network,text}/*.h WebCore + cp -a WebCore.d/{accessibility,platform{,/{graphics,network,text}}}/{cf,mac,iphone}/*.h WebCore + cp -a WebCore.d/bridge/objc/*.h WebCore + + wget -O JavaScriptCore.tgz http://www.opensource.apple.com/tarballs/JavaScriptCore/JavaScriptCore-554.1.tar.gz + #tar -zx --transform 's@^[^/]*/API/@JavaScriptCore/@' -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | grep '/API/[^/]*.h$') + tar -zx \ + --transform 's@^[^/]*/@@' \ + --transform 's@^icu/@@' \ + -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | sed -e ' + /\/icu\/unicode\/.*\.h$/ p; + /\/profiler\/.*\.h$/ p; + /\/runtime\/.*\.h$/ p; + /\/wtf\/.*\.h$/ p; + d; + ') +fi + +for framework in ApplicationServices CoreServices IOKit IOSurface JavaScriptCore QuartzCore WebKit; do + ln -s /System/Library/Frameworks/"${framework}".framework/Headers "${framework}" +done + +for framework in /System/Library/Frameworks/CoreServices.framework/Frameworks/*.framework; do + name=${framework} + name=${name%.framework} + name=${name##*/} + ln -s "${framework}/Headers" "${name}" +done + +mkdir -p Cocoa +cat >Cocoa/Cocoa.h <GraphicsServices/GraphicsServices.h <