From 533d9675271212f948b4284471b7be15d3a56d99 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 19 May 2019 14:40:15 -0700 Subject: [PATCH] Make Cydia compile "out of the box" on Xcode 10.2. --- apt32 | 2 +- make.sh | 2 +- makefile | 30 +++++++++++++++++++++++------- sysroot.sh | 2 +- system.h | 7 +++++++ 5 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 system.h diff --git a/apt32 b/apt32 index 9439ca0e..cd00e182 160000 --- a/apt32 +++ b/apt32 @@ -1 +1 @@ -Subproject commit 9439ca0e8c0cb2523b756a4675f3fd1c69ce7eac +Subproject commit cd00e1829d369c12bef3ad86e5b9ac8af1c24c51 diff --git a/make.sh b/make.sh index 0b279814..7926a00f 100755 --- a/make.sh +++ b/make.sh @@ -1,2 +1,2 @@ #!/bin/bash -DEVELOPER_DIR=/Applications/Xcode-5.1.1.app make "$@" +DEVELOPER_DIR=/Applications/Xcode-5.1.1.app make "$@" do32=yes diff --git a/makefile b/makefile index 4d64d5e4..9ce7a0cc 100644 --- a/makefile +++ b/makefile @@ -8,6 +8,7 @@ flag := plus := link := libs := +lapt := gxx := $(shell xcrun --sdk iphoneos -f g++) cycc := $(gxx) @@ -19,6 +20,8 @@ cycc += -isysroot $(sdk) cycc += -idirafter $(mac)/usr/include cycc += -F$(sdk)/System/Library/PrivateFrameworks +cycc += -include system.h + cycc += -fmessage-length=0 cycc += -gfull -O2 cycc += -fvisibility=hidden @@ -33,7 +36,10 @@ iapt += -Iapt32-deb iapt += -Iapt-extra iapt += -IObjects/apt32 +ifeq ($(do32),yes) flag += $(patsubst %,-Xarch_armv6 %,$(iapt)) +endif + flag += $(patsubst %,-Xarch_arm64 %,$(subst apt32,apt64,$(iapt))) flag += -I. @@ -70,16 +76,19 @@ libs += -framework WebKit libs += -framework CFNetwork libs += -llockdown +ifeq ($(do32),yes) libs += -Xarch_armv6 -Wl,-force_load,Objects/libapt32.a +lapt += Objects/libapt32.a +endif + libs += -Xarch_arm64 -Wl,-force_load,Objects/libapt64.a +lapt += Objects/libapt64.a libs += -licucore uikit := uikit += -framework UIKit -link += -Xarch_armv6 -Wl,-segalign,4000 - dirs := Menes CyteKit Cydia SDURLCache code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext)))) @@ -127,17 +136,16 @@ link += -Xarch_arm64 -Wl,-lz flag += -DAPT_PKG_EXPOSE_STRING_VIEW flag += -Dsighandler_t=sig_t +ifeq ($(do32),yes) flag32 := flag32 += -arch armv6 flag32 += -Xarch_armv6 -miphoneos-version-min=2.0 flag32 += -Xarch_armv6 -marm # @synchronized flag32 += -Xarch_armv6 -mcpu=arm1176jzf-s flag32 += -mllvm -arm-reserve-r9 -link += -Xarch_armv6 -Wl,-lgcc_s.1 -flag64 := -flag64 += -arch arm64 -flag64 += -Xarch_arm64 -miphoneos-version-min=7.0 +link += -Xarch_armv6 -Wl,-lgcc_s.1 +link += -Xarch_armv6 -Wl,-segalign,4000 apt32 := $(cycc) $(flag32) $(flag) apt32 += -Wno-deprecated-register @@ -146,6 +154,11 @@ apt32 += -Wno-tautological-compare apt32 += -Wno-uninitialized apt32 += -Wno-unused-private-field apt32 += -Wno-unused-variable +endif + +flag64 := +flag64 += -arch arm64 +flag64 += -Xarch_arm64 -miphoneos-version-min=7.0 apt64 := $(cycc) $(flag64) $(flag) apt64 += -include apt.h @@ -161,7 +174,10 @@ eapt += -Wno-format eapt += -Wno-logical-op-parentheses iapt += $(eapt) +ifeq ($(do32),yes) cycc += $(flag32) +endif + cycc += $(flag64) plus += -std=c++11 @@ -249,7 +265,7 @@ Objects/libapt64.a: $(libapt64) @echo "[arch] $@" @ar -rc $@ $^ -MobileCydia: $(object) entitlements.xml Objects/libapt32.a Objects/libapt64.a +MobileCydia: $(object) entitlements.xml $(lapt) @echo "[link] $@" @$(cycc) -o $@ $(filter %.o,$^) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0 @mkdir -p bins diff --git a/sysroot.sh b/sysroot.sh index a124baa3..469e14ff 100755 --- a/sysroot.sh +++ b/sysroot.sh @@ -107,4 +107,4 @@ wget --no-check-certificate -O CoreFoundation/CFUniChar.h "https://opensource.ap mkdir -p WebCore wget --no-check-certificate -O WebCore/WebCoreThread.h "https://opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h" -ln -s /System/Library/Frameworks/IOKit.framework/Headers IOKit +ln -s "$(xcodebuild -sdk macosx -version Path)"/System/Library/Frameworks/IOKit.framework/Headers IOKit diff --git a/system.h b/system.h new file mode 100644 index 00000000..132f524b --- /dev/null +++ b/system.h @@ -0,0 +1,7 @@ +#define system apl_system +#include +#undef system +#ifdef __cplusplus +extern "C" +#endif +int system(const char *); -- 2.45.2