From 5f6bff8c3ad91b45f72d8975d110876a4d6bf300 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 10 Apr 2008 02:26:36 +0000 Subject: Ported Cydia to gcc 4.2. --- Cydia.mm | 39 ++++++++++++++++----------------------- exec.mm | 2 +- make.sh | 2 ++ makefile | 14 +++++++++----- 4 files changed, 28 insertions(+), 29 deletions(-) create mode 100755 make.sh diff --git a/Cydia.mm b/Cydia.mm index 8702e29..0da4550 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -1,7 +1,8 @@ /* #include Directives {{{ */ -#include -#include +#include #include +#include +#include #include @@ -150,7 +151,7 @@ class Pcre { } }; /* }}} */ -/* CoreGraphicsServices Primitives {{{ */ +/* CoreGraphics Primitives {{{ */ class CGColor { private: CGColorRef color_; @@ -176,7 +177,6 @@ class GSFont { public: ~GSFont() { - /* XXX: no GSFontRelease()? */ CFRelease(font_); } }; @@ -353,6 +353,13 @@ class Progress : }; /* }}} */ +@protocol CydiaDelegate +- (void) resolve; +- (void) perform; +- (void) upgrade; +- (void) update; +@end + /* External Constants {{{ */ extern NSString *kUIButtonBarButtonAction; extern NSString *kUIButtonBarButtonInfo; @@ -1689,7 +1696,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { UITextLabel *name_; UITextLabel *description_; UITextLabel *source_; - UITextLabel *version_; UIImageView *trusted_; SEL versioner_; } @@ -1713,7 +1719,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [name_ release]; [description_ release]; [source_ release]; - [version_ release]; [trusted_ release]; [super dealloc]; } @@ -1744,10 +1749,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [source_ setBackgroundColor:clear]; [source_ setFont:large]; - version_ = [[UIRightTextLabel alloc] initWithFrame:CGRectMake(286, 69, 70, 25)]; - [version_ setBackgroundColor:clear]; - [version_ setFont:large]; - //trusted_ = [[UIImageView alloc] initWithFrame:CGRectMake(278, 7, 16, 16)]; trusted_ = [[UIImageView alloc] initWithFrame:CGRectMake(30, 30, 16, 16)]; [trusted_ setImage:[UIImage applicationImageNamed:@"trusted.png"]]; @@ -1756,7 +1757,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [self addSubview:name_]; [self addSubview:description_]; [self addSubview:source_]; - [self addSubview:version_]; CGColorSpaceRelease(space); @@ -1782,7 +1782,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [icon_ setFrame:CGRectMake(10, 10, 30, 30)]; [name_ setText:[package name]]; - [version_ setText:[package latest]]; [description_ setText:[package tagline]]; NSString *label; @@ -1815,12 +1814,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { interpolate(0.0, 1.0, fraction), 1.0); - CGColor blue(space, - interpolate(0.2, 1.0, fraction), - interpolate(0.2, 1.0, fraction), - interpolate(1.0, 1.0, fraction), - 1.0); - CGColor gray(space, interpolate(0.4, 1.0, fraction), interpolate(0.4, 1.0, fraction), @@ -1830,7 +1823,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [name_ setColor:black]; [description_ setColor:gray]; [source_ setColor:black]; - [version_ setColor:blue]; CGColorSpaceRelease(space); } @@ -1919,7 +1911,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { } - (Package *) packageWithName:(NSString *)name { - pkgCache::PkgIterator iterator(cache_->FindPkg([name cString])); + pkgCache::PkgIterator iterator(cache_->FindPkg([name UTF8String])); return iterator.end() ? nil : [Package packageWithIterator:iterator database:self]; } @@ -3435,7 +3427,8 @@ NSString *Scour(const char *field, const char *begin, const char *end) { @interface Cydia : UIApplication < ConfirmationViewDelegate, ProgressViewDelegate, - SearchViewDelegate + SearchViewDelegate, + CydiaDelegate > { UIWindow *window_; UIView *underlay_; @@ -4000,7 +3993,7 @@ id Alloc_(id self, SEL selector) { int main(int argc, char *argv[]) { struct nlist nl[2]; memset(nl, 0, sizeof(nl)); - nl[0].n_un.n_name = "_useMDNSResponder"; + nl[0].n_un.n_name = (char *) "_useMDNSResponder"; nlist("/usr/lib/libc.dylib", nl); if (nl[0].n_type != N_UNDF) *(int *) nl[0].n_value = 0; @@ -4018,7 +4011,7 @@ int main(int argc, char *argv[]) { if (NSDictionary *sysver = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]) { if (NSString *prover = [sysver valueForKey:@"ProductVersion"]) { - Firmware_ = strdup([prover cString]); + Firmware_ = strdup([prover UTF8String]); NSArray *versions = [prover componentsSeparatedByString:@"."]; int count = [versions count]; Major_ = count > 0 ? [[versions objectAtIndex:0] intValue] : 0; diff --git a/exec.mm b/exec.mm index 751a84a..f53d2cf 100644 --- a/exec.mm +++ b/exec.mm @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) { if (NSDictionary *sysver = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]) { if (NSString *prover = [sysver valueForKey:@"ProductVersion"]) { - Firmware_ = strdup([prover cString]); + Firmware_ = strdup([prover UTF8String]); NSArray *versions = [prover componentsSeparatedByString:@"."]; int count = [versions count]; Major_ = count > 0 ? [[versions objectAtIndex:0] intValue] : 0; diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..f5e82dd --- /dev/null +++ b/make.sh @@ -0,0 +1,2 @@ +#!/bin/bash +PATH=/apl/n42/pre/bin:$PATH exec /apl/tel/exec.sh cydia make "$@" diff --git a/makefile b/makefile index 88785d3..70b511f 100644 --- a/makefile +++ b/makefile @@ -1,16 +1,20 @@ iPhone := 192.168.1.100 +target := $${PKG_TARG}- + all: Cydia exec +clean: + rm -f Cydia exec + test: all scp -p Cydia saurik@$(iPhone):/dat ssh saurik@$(iPhone) /dat/Cydia exec: exec.mm makefile - arm-apple-darwin-g++ -Wall -Werror -o $@ $< -framework Foundation -framework CoreFoundation -lobjc - -Cydia-1.2: Cydia.mm *.h makefile - arm-apple-darwin9-g++ -fobjc-abi-version=2 -fobjc-call-cxx-cdtors -g3 -O2 -Wall -o $@ $< -framework UIKit -framework IOKit -framework Foundation -framework CoreFoundation -framework CoreGraphics -framework GraphicsServices -lobjc -lapt-pkg -lpcre -fobjc-exceptions -save-temps -DTARGET_OS_EMBEDDED -DSRK_ASPEN + $(target)g++ -Wall -Werror -o $@ $< -framework Foundation -framework CoreFoundation -lobjc Cydia: Cydia.mm *.h makefile - arm-apple-darwin-g++ -fobjc-call-cxx-cdtors -g3 -O2 -Wall -Werror -o $@ $< -framework UIKit -framework IOKit -framework Foundation -framework CoreFoundation -framework CoreGraphics -framework GraphicsServices -lobjc -lapt-pkg -lpcre -fobjc-exceptions + $(target)g++ -fobjc-call-cxx-cdtors -g3 -O2 -Wall -Werror -o $@ $< -framework UIKit -framework IOKit -framework Foundation -framework CoreFoundation -framework CoreGraphics -framework GraphicsServices -lobjc -lapt-pkg -lpcre -fobjc-exceptions + +.PHONY: all clean test -- cgit v1.2.3