From 1d744444486fc66c8f12e2a8f0e81773a65bf545 Mon Sep 17 00:00:00 2001 From: Sam Bingner Date: Mon, 27 May 2019 15:43:29 -1000 Subject: Make it actually compile with saurik's updates --- CyteKit/stringWith.mm | 2 +- MobileCydia.mm | 18 ++++++++++++++++++ apt.h | 30 ++++++++++++++++++++++++++++++ apt32 | 2 +- apt64 | 2 +- makefile | 16 ++++++++-------- postinst.mm | 2 +- 7 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 apt.h diff --git a/CyteKit/stringWith.mm b/CyteKit/stringWith.mm index da647df..bba6108 100644 --- a/CyteKit/stringWith.mm +++ b/CyteKit/stringWith.mm @@ -36,7 +36,7 @@ + (NSString *) stringWithFormat:(NSString *)format :(size_t)count :(id *)args { switch (count) { case 0: - return [[[NSString alloc] initWithFormat:format] autorelease];; + return [[[NSString alloc] initWithString:format] autorelease];; case 1: return [[[NSString alloc] initWithFormat:format, args[0]] autorelease];; case 2: diff --git a/MobileCydia.mm b/MobileCydia.mm index 87af12d..0e94ec3 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -66,6 +66,7 @@ #undef ABS +#include "apt.h" #include #include #include @@ -2589,12 +2590,14 @@ struct PackageNameOrdering : ignored_ = iterator->SelectedState == pkgCache::State::Hold; _end +#ifndef __arm__ _profile(Package$initWithVersion$Priority) // ignore "essential" tags from non-pinned repos if (essential_ && [database cache].Policy->GetPriority(version, true) == 500) { essential_ = NO; } _end +#endif _end } return self; } @@ -2603,7 +2606,11 @@ struct PackageNameOrdering : pkgCache::VerIterator version; _profile(Package$packageWithIterator$GetCandidateVer) +#ifndef __arm__ version = [database cache]->GetCandidateVersion(iterator); +#else + version = [database policy]->GetCandidateVer(iterator); +#endif _end if (version.end()) @@ -3542,10 +3549,14 @@ class CydiaLogCleaner : if (static_cast(cache_) == NULL) return nil; pkgCache::PkgIterator iterator; +#ifndef __arm__ // try common arch first iterator = cache_->FindPkg([name UTF8String], common_arch); if (iterator.end()) iterator = cache_->FindPkg([name UTF8String], "any"); +#else + iterator = cache_->FindPkg([name UTF8String]); +#endif return iterator.end() ? nil : [[Package newPackageWithIterator:iterator withZone:NULL inPool:NULL database:self] autorelease]; } } @@ -4771,6 +4782,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { pkgCacheFile &cache([database_ cache]); NSArray *packages([database_ packages]); +#ifdef __arm__ + pkgDepCache::Policy *policy([database_ policy]); +#endif issues_ = [NSMutableArray arrayWithCapacity:4]; @@ -4885,7 +4899,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [removes addObject:name]; } +#ifndef __arm__ substrate_ |= DepSubstrate(cache->GetCandidateVersion(iterator)); +#else + substrate_ |= DepSubstrate(policy->GetCandidateVer(iterator)); +#endif substrate_ |= DepSubstrate(iterator.CurrentVer()); } diff --git a/apt.h b/apt.h new file mode 100644 index 0000000..c00968c --- /dev/null +++ b/apt.h @@ -0,0 +1,30 @@ +#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/apt32 b/apt32 index e239300..9439ca0 160000 --- a/apt32 +++ b/apt32 @@ -1 +1 @@ -Subproject commit e239300f20a50c4a4698b2ea8d25c0ae1c2479b9 +Subproject commit 9439ca0e8c0cb2523b756a4675f3fd1c69ce7eac diff --git a/apt64 b/apt64 index 9d801c7..fb97f96 160000 --- a/apt64 +++ b/apt64 @@ -1 +1 @@ -Subproject commit 9d801c75cdf8e48a8013257c684c7702806dde6c +Subproject commit fb97f9603ada7961f30b123962a11981aee475a3 diff --git a/makefile b/makefile index 2d6565a..e0183d7 100644 --- a/makefile +++ b/makefile @@ -86,9 +86,9 @@ 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 @@ -154,7 +154,7 @@ 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 +flag32 += -Xarch_armv6 -ffixed-r9 link += -Xarch_armv6 -Wl,-lgcc_s.1 link += -Xarch_armv6 -Wl,-segalign,4000 @@ -222,11 +222,6 @@ Objects/apt64/apt-pkg/tagfile-keys%h apt64/apt-pkg/tagfile-keys%cc: ../apt64/apt-pkg/tagfile-keys.list sed -i -e 's@typedef char static_assert64@//\\0@' apt64/apt-pkg/tagfile-keys.cc -Objects/%.o: %.cc $(header) - @mkdir -p $(dir $@) - @echo "[cycc] $<" - @$(cycc) $(plus) -c -o $@ $< $(flag) -Wno-format -include apt.h -Dmain=main_$(basename $(notdir $@)) - Objects/apt32/%.o: apt32/%.cc $(header) apt.h apt-extra/*.h @mkdir -p $(dir $@) @echo "[cycc] $<" @@ -237,6 +232,11 @@ Objects/apt64/%.o: apt64/%.cc $(header) apt.h apt-extra/*.h @echo "[cycc] $<" @$(apt64) $(plus) -c -o $@ $< -Dmain=main_$(basename $(notdir $@)) +Objects/%.o: %.cc $(header) + @mkdir -p $(dir $@) + @echo "[cycc] $<" + $(cycc) $(plus) -c -o $@ $< $(flag) -Wno-format -include apt.h -Dmain=main_$(basename $(notdir $@)) + Objects/%.o: %.c $(header) @mkdir -p $(dir $@) @echo "[cycc] $<" @@ -280,7 +280,7 @@ Objects/libapt64.a: $(libapt64) MobileCydia: $(object) entitlements.xml $(lapt) @echo "[link] $@" - @$(cycc) -o $@ $(filter %.o,$^) $(link) $(plus) $(libs) $(uikit) -Wl,-sdk_version,11.0 + @$(cycc) -o $@ $(filter %.o,$^) $(link) $(libs) $(uikit) -Wl,-sdk_version,11.0 @mkdir -p bins @cp -a $@ bins/$@-$(version)_$(shell date +%s) @echo "[strp] $@" diff --git a/postinst.mm b/postinst.mm index 07a1611..014fa60 100644 --- a/postinst.mm +++ b/postinst.mm @@ -266,7 +266,7 @@ int main(int argc, const char *argv[]) { "deb http://apt.modmyi.com/ stable main\n" "deb https://repo.chariz.io/ ./\n" "deb https://repo.dynastic.co/ ./\n" - , kCFCoreFoundationVersionNumber] writeToFile:@ CYDIA_LIST atomically:YES]; + ] writeToFile:@ CYDIA_LIST atomically:YES]; } else { [[NSString stringWithFormat:@ "deb http://apt.saurik.com/ ios/%.2f main\n" -- cgit v1.2.3