From 014888d50dcedd8f2a7bcac53bc0ffc1fbb6555f 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 | 1 - Sources.list/saurik.list | 2 -- Sources.mm | 10 +++++++++- apt.h | 30 ------------------------------ cydia.control | 2 +- cydo.cpp | 2 +- makefile | 20 ++++++++++---------- postinst.mm | 4 ++-- sysroot.sh | 5 +++-- 13 files changed, 32 insertions(+), 54 deletions(-) delete mode 100644 Sources.list/saurik.list delete mode 100644 apt.h diff --git a/.gitmodules b/.gitmodules index 6d42b55..4c03b69 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = git://git.saurik.com/apple/icu.git [submodule "apt"] path = apt64 - url = git://git.saurik.com/apt.git + url = git://git.bingner.com/apt.git [submodule "apt-legacy"] path = apt32 url = git://git.saurik.com/apt-legacy.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 2fc28ec..9237251 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -64,7 +64,6 @@ #undef ABS -#include "apt.h" #include #include #include 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 4a8e3a8..2580893 100644 --- a/Sources.mm +++ b/Sources.mm @@ -42,13 +42,21 @@ void CydiaWriteSources() { FILE *file(fopen(sources, "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 7c756dc..f7213f5 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: 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 810e6eb..b3cc981 100644 --- a/cydo.cpp +++ b/cydo.cpp @@ -75,7 +75,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 3074878..1eaaf68 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 := @@ -202,7 +202,7 @@ 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/apt64/apt-pkg/tagfile.o: Objects/apt64/apt-pkg/tagfile-keys.h @@ -280,7 +280,7 @@ Objects/libapt64.a: $(libapt64) MobileCydia: $(object) entitlements.xml $(lapt) @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] $@" @@ -307,7 +307,7 @@ postinst: postinst.mm CyteKit/stringWith.mm CyteKit/stringWith.h CyteKit/UCPlatf @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 @@ -346,9 +346,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 @@ -356,7 +356,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 @@ -364,8 +364,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 6115c7b..47b485c 100644 --- a/postinst.mm +++ b/postinst.mm @@ -260,7 +260,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" @@ -269,7 +269,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 469e14f..d4305ce 100755 --- a/sysroot.sh +++ b/sysroot.sh @@ -39,13 +39,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 -- cgit v1.2.3