From ae2e967c43880fbd1b7e7f130541e9dbbca0debf Mon Sep 17 00:00:00 2001 From: Sam Bingner Date: Sun, 30 Sep 2018 22:50:49 -1000 Subject: Make Cydia compatible back to iOS5 - unable to support older with this apt version due to newer apt requiring functions provided via libc++ on iOS --- .gitmodules | 2 +- CyteKit/InterfaceOrientation.h | 3 ++- CyteKit/ViewController.mm | 3 ++- MobileCydia.app/Info.plist | 2 +- MobileCydia.mm | 5 ---- Sources.list/saurik.list | 2 -- Sources.mm | 10 +++++++- apt.h | 30 ---------------------- cydia.control | 2 +- cydo.cpp | 2 +- makefile | 58 ++++++++++++++++++++---------------------- postinst.mm | 4 +-- sysroot.sh | 9 ++++--- 13 files changed, 51 insertions(+), 81 deletions(-) delete mode 100644 Sources.list/saurik.list delete mode 100644 apt.h diff --git a/.gitmodules b/.gitmodules index cc667a6..e12edad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,4 @@ url = git://git.saurik.com/apple/icu.git [submodule "apt"] path = apt - url = git://git.saurik.com/apt.git + url = git://git.bingner.com/apt.git diff --git a/CyteKit/InterfaceOrientation.h b/CyteKit/InterfaceOrientation.h index eddfaf4..813958e 100644 --- a/CyteKit/InterfaceOrientation.h +++ b/CyteKit/InterfaceOrientation.h @@ -22,7 +22,8 @@ - (NSUInteger) supportedInterfaceOrientations { extern bool IsWildcat_; extern CGFloat ScreenScale_; - return IsWildcat_ || ScreenScale_ == 3 ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait; + //return IsWildcat_ || ScreenScale_ == 3 ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait; + return UIInterfaceOrientationMaskAll; } - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { diff --git a/CyteKit/ViewController.mm b/CyteKit/ViewController.mm index 72b7593..2e5d5a1 100644 --- a/CyteKit/ViewController.mm +++ b/CyteKit/ViewController.mm @@ -84,7 +84,8 @@ // Load on first appearance. We don't need to set the loaded flag here // because it is set for us the first time -reloadData is called. - self.navigationController.navigationBar.prefersLargeTitles = YES; + if (kCFCoreFoundationVersionNumber >= 1443.00) + self.navigationController.navigationBar.prefersLargeTitles = YES; if (![self hasLoaded]) [self reloadData]; } diff --git a/MobileCydia.app/Info.plist b/MobileCydia.app/Info.plist index 6a7bac4..a1b5326 100644 --- a/MobileCydia.app/Info.plist +++ b/MobileCydia.app/Info.plist @@ -58,7 +58,7 @@ 8.0 MinimumOSVersion - 2.0 + 5.0 UIDeviceFamily diff --git a/MobileCydia.mm b/MobileCydia.mm index 20fe182..1efa9af 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -64,7 +64,6 @@ #undef ABS -#include "apt.h" #include #include #include @@ -2458,11 +2457,7 @@ struct PackageNameOrdering : } while (false); _end _profile(Package$initWithVersion$Tags) -#ifdef __arm64__ pkgCache::TagIterator tag(version_.TagList()); -#else - pkgCache::TagIterator tag(iterator.TagList()); -#endif if (!tag.end()) { tags_ = [NSMutableArray arrayWithCapacity:8]; diff --git a/Sources.list/saurik.list b/Sources.list/saurik.list deleted file mode 100644 index a639f78..0000000 --- a/Sources.list/saurik.list +++ /dev/null @@ -1,2 +0,0 @@ -# DO NOT EDIT | This is the story of a time long ago, A time of myth and legend, when the Earth was still young. -# The ancient gods were petty and cruel, and they plagued mankind with suffering and beseiged them with terrors. diff --git a/Sources.mm b/Sources.mm index 0e48168..9957123 100644 --- a/Sources.mm +++ b/Sources.mm @@ -35,13 +35,21 @@ void CydiaWriteSources() { FILE *file(fopen(SOURCES_LIST, "w")); _assert(file != NULL); - fprintf(file, "deb http://apt.bingner.com/ ios/%.2f main\n", kCFCoreFoundationVersionNumber); + if (kCFCoreFoundationVersionNumber >= 1443) { + fprintf(file, "deb https://apt.bingner.com/ ios/%.2f main\n", kCFCoreFoundationVersionNumber); + } else { + fprintf(file, "deb http://apt.saurik.com/ ios/%.2f main\n", kCFCoreFoundationVersionNumber); + fprintf(file, "deb https://apt.bingner.com/ ./\n"); + } for (NSString *key in [Sources_ allKeys]) { if ([key hasPrefix:@"deb:http:"] && [Sources_ objectForKey:[NSString stringWithFormat:@"deb:https:%s", [key UTF8String] + 9]]) continue; NSDictionary *source([Sources_ objectForKey:key]); + // Ignore it if main source is added again + if ([[source objectForKey:@"URI"] hasPrefix:@"http://apt.bingner.com"] || [[source objectForKey:@"URI"] hasPrefix:@"https://apt.bingner.com"]) + continue; NSArray *sections([source objectForKey:@"Sections"] ?: [NSArray array]); diff --git a/apt.h b/apt.h deleted file mode 100644 index c00968c..0000000 --- a/apt.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef APT_H -#define APT_H - -#include - -template -Type_ *memrchr(Type_ *data, int value, int size) { - for (int i = 0; i != size; ++i) - if (data[size - i - 1] == value) - return data + size - i - 1; - return 0; -} - -template -static Type_ *strchrnul(Type_ *s, int c) { - while (*s != c && *s != '\0') - ++s; - return s; -} - -#define faccessat(arg0, arg1, arg2, arg3) \ - access(arg1, arg2) - -#if 0 -#include -static unsigned nonce(0); -#define _trace() syslog(LOG_ERR, "_trace():%s[%u] #%u\n", __FILE__, __LINE__, ++nonce) -#endif - -#endif//APT_H diff --git a/cydia.control b/cydia.control index c8bfbbe..8f389bb 100644 --- a/cydia.control +++ b/cydia.control @@ -7,7 +7,7 @@ Version: Replaces: bigboss, bigbossbetarepo, com.sosiphone.addcydia, cydia-sources, ispazio.net, modmyifone, saurik, ste, yellowsn0w.com, zodttd Depends: apt7-lib, apt7-key, cydia-lproj (>= 1.1.10), darwintools, debianutils, dpkg (>= 1.18), org.thebigboss.repo.icons, sed, shell-cmds, system-cmds, uikittools (>= 1.1.4) Conflicts: bigboss, bigbossbetarepo, com.sosiphone.addcydia, cydia-sources, ispazio.net, modmyifone, ste, yellowsn0w.com, zodttd -Pre-Depends: debianutils, dpkg (>= 1.14.25-8) +Pre-Depends: debianutils, dpkg (>= 1.14.25-8), xz, firmware (>=5.0) Provides: bigbossbetarepo, cydia-sources Description: graphical iPhone front-end for APT Name: Cydia Installer diff --git a/cydo.cpp b/cydo.cpp index 71009cd..39e69e4 100644 --- a/cydo.cpp +++ b/cydo.cpp @@ -76,7 +76,7 @@ void launch_data_dict_iterate(launch_data_t data, LaunchDataIterator code) { } int main(int argc, char *argv[]) { - patch_setuidandplatformize(); + patch_setuidandplatformize(); auto request(launch_data_new_string(LAUNCH_KEY_GETJOBS)); auto response(launch_msg(request)); launch_data_free(request); diff --git a/makefile b/makefile index 2a572b5..5f86664 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ .DELETE_ON_ERROR: .SECONDARY: -dpkg := dpkg-deb -Zlzma +dpkg := fakeroot dpkg-deb -Zlzma version := $(shell ./version.sh) flag := @@ -9,14 +9,15 @@ plus := link := libs := -gxx := $(shell xcrun --sdk iphoneos -f g++) +gxx := xcrun --sdk iphoneos g++ cycc := $(gxx) sdk := $(shell xcodebuild -sdk iphoneos -version Path) -cycc += -isysroot $(sdk) cycc += -idirafter /usr/include cycc += -F$(sdk)/System/Library/PrivateFrameworks +cycc += -arch armv6 +cycc += -Xarch_armv6 -miphoneos-version-min=5.0 cycc += -arch arm64 cycc += -Xarch_arm64 -miphoneos-version-min=7.0 @@ -27,11 +28,11 @@ cycc += -fvisibility=hidden link += -Wl,-dead_strip link += -Wl,-no_dead_strip_inits_and_terms -flag += -Xarch_arm64 -Iapt -flag += -Xarch_arm64 -Iapt-contrib -flag += -Xarch_arm64 -Iapt-deb -flag += -Xarch_arm64 -Iapt-extra -flag += -Xarch_arm64 -Iapt-tag +flag += -Iapt +flag += -Iapt-contrib +flag += -Iapt-deb +flag += -Iapt-extra +flag += -Iapt-tag flag += -I. flag += -isystem sysroot/usr/include @@ -51,7 +52,6 @@ flag += -Wno-unknown-warning-option plus += -fobjc-call-cxx-cdtors plus += -fvisibility-inlines-hidden -link += -Lsysroot/usr/lib link += -multiply_defined suppress libs += -framework CoreFoundation @@ -65,8 +65,7 @@ libs += -framework SystemConfiguration libs += -framework WebCore libs += -framework WebKit -libs += -Xarch_armv6 -Wl,-lapt-pkg -libs += -Xarch_arm64 -Wl,Objects/libapt64.a +libs += Objects/libapt.a libs += -licucore uikit := @@ -100,26 +99,23 @@ libapt += apt/methods/store.cc libapt := $(filter-out %/srvrec.cc,$(libapt)) libapt := $(patsubst %.cc,Objects/%.o,$(libapt)) -link += -Xarch_arm64 -Wl,-lz,-liconv +link += -Wl,-lz,-liconv flag += -DAPT_PKG_EXPOSE_STRING_VIEW flag += -Dsighandler_t=sig_t aptc := $(cycc) $(flag) -aptc += -include apt.h aptc += -Wno-deprecated-register aptc += -Wno-unused-private-field aptc += -Wno-unused-variable -cycc += -arch armv6 -cycc += -Xarch_armv6 -miphoneos-version-min=2.0 flag += -Xarch_armv6 -marm # @synchronized flag += -Xarch_armv6 -mcpu=arm1176jzf-s -flag += -mllvm -arm-reserve-r9 +flag += -Xarch_armv6 -ffixed-r9 link += -Xarch_armv6 -Wl,-lgcc_s.1 plus += -std=c++11 -#plus += -Wp,-stdlib=libc++ +plus += -stdlib=libc++ #link += libcxx/lib/libc++.a images := $(shell find MobileCydia.app/ -type f -name '*.png') @@ -130,10 +126,10 @@ lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb all: MobileCydia clean: - rm -f MobileCydia postinst + rm -f MobileCydia postinst cydo setnsfpn cfversion rm -rf Objects/ Images/ -Objects/%.o: %.cc $(header) apt.h apt-extra/*.h +Objects/%.o: %.cc $(header) apt-extra/*.h @mkdir -p $(dir $@) @echo "[cycc] $<" @$(aptc) $(plus) -c -o $@ $< -Dmain=main_$(basename $(notdir $@)) @@ -170,13 +166,13 @@ sysroot: sysroot.sh @echo 1>&2 @exit 1 -Objects/libapt64.a: $(libapt) - @echo "[arch] $@" - @ar -rc $@ $^ +Objects/libapt.a: $(libapt) + @echo "[create] $@" + @libtool -static -o $@ $^ -MobileCydia: sysroot $(object) entitlements.xml Objects/libapt64.a +MobileCydia: sysroot Objects/libapt.a $(object) entitlements.xml # Objects/UIKit.tbd @echo "[link] $@" - @$(cycc) -o $@ $(filter %.o,$^) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0 + @$(cycc) -o $@ $(filter %.o,$^) $(link) $(plus) $(libs) $(uikit) -Wl,-sdk_version,11.0 @mkdir -p bins @cp -a $@ bins/$@-$(version)_$(shell date +%s) @echo "[strp] $@" @@ -203,7 +199,7 @@ postinst: postinst.mm CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes @ldid -T0 -Sgenent.xml $@ debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion setnsfpn cydo $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/move.sh Library/startup - sudo rm -rf _ + fakeroot rm -rf _ mkdir -p _/var/lib/cydia mkdir -p _/etc/apt @@ -239,9 +235,9 @@ debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion s find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';' - sudo chown -R 0 _ - sudo chgrp -R 0 _ - sudo chmod 6755 _/usr/libexec/cydia/cydo + fakeroot chown -R 0 _ + fakeroot chgrp -R 0 _ + fakeroot chmod 6755 _/usr/libexec/cydia/cydo mkdir -p debs ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb @@ -249,7 +245,7 @@ debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion s @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)" $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control - sudo rm -rf __ + fakeroot rm -rf __ mkdir -p __/Applications/Cydia.app cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app @@ -257,8 +253,8 @@ $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.contro mkdir -p __/DEBIAN ./control.sh cydia-lproj.control __ >__/DEBIAN/control - sudo chown -R 0 __ - sudo chgrp -R 0 __ + fakeroot chown -R 0 __ + fakeroot chgrp -R 0 __ mkdir -p debs ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb diff --git a/postinst.mm b/postinst.mm index c1a6f8d..8995801 100644 --- a/postinst.mm +++ b/postinst.mm @@ -262,7 +262,7 @@ int main(int argc, const char *argv[]) { unlink(CYDIA_LIST); if (kCFCoreFoundationVersionNumber >= 1443) { [@( - "deb http://apt.bingner.com/ ./\n" + "deb https://apt.bingner.com/ ./\n" "deb http://apt.thebigboss.org/repofiles/cydia/ stable main\n" "deb http://cydia.zodttd.com/repo/cydia/ stable main\n" "deb http://apt.modmyi.com/ stable main\n" @@ -271,7 +271,7 @@ int main(int argc, const char *argv[]) { } else { [[NSString stringWithFormat:@ "deb http://apt.saurik.com/ ios/%.2f main\n" - "deb http://apt.bingner.com/ ./\n" + "deb https://apt.bingner.com/ ./\n" "deb http://apt.thebigboss.org/repofiles/cydia/ stable main\n" "deb http://cydia.zodttd.com/repo/cydia/ stable main\n" "deb http://apt.modmyi.com/ stable main\n" diff --git a/sysroot.sh b/sysroot.sh index 2a2c4b8..8395c0b 100755 --- a/sysroot.sh +++ b/sysroot.sh @@ -37,13 +37,14 @@ architecture=iphoneos-arm declare -A dpkgz dpkgz[gz]=gunzip dpkgz[lzma]=unlzma +dpkgz[xz]=unxz function extract() { package=$1 url=$2 - wget -O "${package}.deb" "${url}" - for z in lzma gz; do + wget -O "${package}.deb" "${url}" --no-check-certificate + for z in lzma gz xz; do compressed=data.tar.${z} if ar -x "${package}.deb" "${compressed}" 2>/dev/null; then @@ -102,9 +103,9 @@ mkdir -p usr/include cd usr/include mkdir CoreFoundation -wget -O CoreFoundation/CFUniChar.h "http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt" +wget -O CoreFoundation/CFUniChar.h "http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt" --no-check-certificate mkdir -p WebCore -wget -O WebCore/WebCoreThread.h 'http://www.opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h?txt' +wget -O WebCore/WebCoreThread.h 'http://www.opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h?txt' --no-check-certificate ln -s /System/Library/Frameworks/IOKit.framework/Headers IOKit -- cgit v1.2.3