From 136cc0a23da9281874ee88b7b51174538fcb9269 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 19 May 2019 16:37:51 -0700 Subject: [PATCH] Mostly make Cydia compile using the iOS Simulator. --- CyteKit/CyteObject.mm | 2 ++ MobileCydia.mm | 6 +++--- apt32 | 2 +- makefile | 30 +++++++++++++++++++++--------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/CyteKit/CyteObject.mm b/CyteKit/CyteObject.mm index f55ddb95..382b4f40 100644 --- a/CyteKit/CyteObject.mm +++ b/CyteKit/CyteObject.mm @@ -105,6 +105,8 @@ static NSObject *CYIOGetValue(const char *path, NSString *property) { - (unsigned) bittage { #if 0 +#elif defined(__x86_64__) + return 64; #elif defined(__arm64__) return 64; #elif defined(__arm__) diff --git a/MobileCydia.mm b/MobileCydia.mm index 3d299b63..22c12725 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -2454,7 +2454,7 @@ struct PackageNameOrdering : } while (false); _end _profile(Package$initWithVersion$Tags) -#ifdef __arm64__ +#ifndef __arm__ pkgCache::TagIterator tag(version_.TagList()); #else pkgCache::TagIterator tag(iterator.TagList()); @@ -3480,7 +3480,7 @@ class CydiaLogCleaner : if (static_cast(cache_) == NULL) return nil; pkgCache::PkgIterator iterator(cache_->FindPkg([name UTF8String] -#ifdef __arm64__ +#ifndef __arm__ , "any" #endif )); @@ -9223,7 +9223,7 @@ int main(int argc, char *argv[]) { else if (!strcmp(argv0, "lzma")) return main_gzip(argc, argv); #endif -#ifdef __arm64__ +#ifndef __arm__ else if (!strcmp(argv0, "store")) return main_store(argc, argv); #endif diff --git a/apt32 b/apt32 index cd00e182..e239300f 160000 --- a/apt32 +++ b/apt32 @@ -1 +1 @@ -Subproject commit cd00e1829d369c12bef3ad86e5b9ac8af1c24c51 +Subproject commit e239300f20a50c4a4698b2ea8d25c0ae1c2479b9 diff --git a/makefile b/makefile index 9ce7a0cc..fe9650b9 100644 --- a/makefile +++ b/makefile @@ -10,16 +10,28 @@ link := libs := lapt := -gxx := $(shell xcrun --sdk iphoneos -f g++) +ifeq ($(doIA),yes) +kind := iphonesimulator +arch := x86_64 +else +kind := iphoneos +arch := arm64 +endif + +gxx := $(shell xcrun --sdk $(kind) -f g++) cycc := $(gxx) -sdk := $(shell xcodebuild -sdk iphoneos -version Path) +sdk := $(shell xcodebuild -sdk $(kind) -version Path) mac := $(shell xcodebuild -sdk macosx -version Path) cycc += -isysroot $(sdk) cycc += -idirafter $(mac)/usr/include cycc += -F$(sdk)/System/Library/PrivateFrameworks +ifeq ($(doIA),yes) +cycc += -Xarch_x86_64 -F$(sdk)/../../../../iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks +endif + cycc += -include system.h cycc += -fmessage-length=0 @@ -40,7 +52,7 @@ ifeq ($(do32),yes) flag += $(patsubst %,-Xarch_armv6 %,$(iapt)) endif -flag += $(patsubst %,-Xarch_arm64 %,$(subst apt32,apt64,$(iapt))) +flag += $(patsubst %,-Xarch_$(arch) %,$(subst apt32,apt64,$(iapt))) flag += -I. flag += -isystem sysroot/usr/include @@ -70,18 +82,18 @@ libs += -framework IOKit libs += -framework QuartzCore libs += -framework SpringBoardServices libs += -framework SystemConfiguration -libs += -framework WebCore libs += -framework WebKit libs += -framework CFNetwork -libs += -llockdown ifeq ($(do32),yes) +libs += -framework WebCore +libs += -llockdown libs += -Xarch_armv6 -Wl,-force_load,Objects/libapt32.a lapt += Objects/libapt32.a endif -libs += -Xarch_arm64 -Wl,-force_load,Objects/libapt64.a +libs += -Xarch_$(arch) -Wl,-force_load,Objects/libapt64.a lapt += Objects/libapt64.a libs += -licucore @@ -131,7 +143,7 @@ libapt64 := $(filter-out %/srvrec.cc,$(libapt64)) libapt64 := $(patsubst %.cc,Objects/%.o,$(libapt64)) link += -Wl,-liconv -link += -Xarch_arm64 -Wl,-lz +link += -Xarch_$(arch) -Wl,-lz flag += -DAPT_PKG_EXPOSE_STRING_VIEW flag += -Dsighandler_t=sig_t @@ -157,8 +169,8 @@ apt32 += -Wno-unused-variable endif flag64 := -flag64 += -arch arm64 -flag64 += -Xarch_arm64 -miphoneos-version-min=7.0 +flag64 += -arch $(arch) +flag64 += -Xarch_$(arch) -m$(kind)-version-min=7.0 apt64 := $(cycc) $(flag64) $(flag) apt64 += -include apt.h -- 2.45.2