From 15babeef559bba763d48d47f65dff17b0c56a7e7 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 21 Aug 2015 05:32:58 -0700 Subject: [PATCH] Add libplist (and libcnary) so to sign Info.plist. --- .gitignore | 4 ++-- .gitmodules | 3 +++ deb.sh | 10 ++++++++++ ios.sh | 17 +---------------- ldid.cpp | 2 ++ libplist | 1 + make.sh | 44 ++++++++++++++++++++++++++++++++++++++++++-- 7 files changed, 61 insertions(+), 20 deletions(-) create mode 100755 deb.sh create mode 160000 libplist diff --git a/.gitignore b/.gitignore index 4311c69..faf313b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ +ios +out ldid -ldid.arm -ldid.o ldid.deb debs _ diff --git a/.gitmodules b/.gitmodules index 691ae3a..f360e2a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "minimal"] path = minimal url = git://git.saurik.com/minimal.git +[submodule "libplist"] + path = libplist + url = http://git.libimobiledevice.org/libplist.git diff --git a/deb.sh b/deb.sh new file mode 100755 index 0000000..3fb31a5 --- /dev/null +++ b/deb.sh @@ -0,0 +1,10 @@ +#!/bin/bash +rm -rf _ +mkdir -p _/usr/bin +cp -a ios/ldid _/usr/bin/ldid +mkdir -p _/DEBIAN +./control.sh _ >_/DEBIAN/control +mkdir -p debs +ln -sf debs/ldid_$(./version.sh)_iphoneos-arm.deb ldid.deb +dpkg-deb -b _ ldid.deb +readlink ldid.deb diff --git a/ios.sh b/ios.sh index a9dae80..f4c112c 100755 --- a/ios.sh +++ b/ios.sh @@ -1,17 +1,2 @@ #!/bin/bash - -set -e -x - -sudo xcode-select --switch /Applications/Xcode-4.6.3.app -cycc -i2.0 -oldid.arm -- -c -std=c++11 ldid.cpp -I. -cycc -i2.0 -oldid.arm -- ldid.arm -x c sha1.c lookup2.c -I . - -rm -rf _ -mkdir -p _/usr/bin -cp -a ldid.arm _/usr/bin/ldid -mkdir -p _/DEBIAN -./control.sh _ >_/DEBIAN/control -mkdir -p debs -ln -sf debs/ldid_$(./version.sh)_iphoneos-arm.deb ldid.deb -dpkg-deb -b _ ldid.deb -readlink ldid.deb +./make.sh true diff --git a/ldid.cpp b/ldid.cpp index 7998ede..3b21b8a 100644 --- a/ldid.cpp +++ b/ldid.cpp @@ -31,6 +31,8 @@ extern "C" { #include #include +#include + struct fat_header { uint32_t magic; uint32_t nfat_arch; diff --git a/libplist b/libplist new file mode 160000 index 0000000..9ca25d2 --- /dev/null +++ b/libplist @@ -0,0 +1 @@ +Subproject commit 9ca25d293fe7f8aca8d952fc7bb91464fe2d34ab diff --git a/make.sh b/make.sh index 4ab6acf..da019ac 100755 --- a/make.sh +++ b/make.sh @@ -1,7 +1,23 @@ #!/bin/bash set -e +shopt -s extglob +if [[ $# == 0 ]]; then + ios=false +else + ios=$1 +fi + +if "${ios}"; then + +out=ios +sudo xcode-select --switch /Applications/Xcode-4.6.3.app +flags=(cycc -- -miphoneos-version-min=2.0 -arch armv6) + +else + +out=out sudo xcode-select --switch /Applications/Xcode-5.1.1.app if which xcrun &>/dev/null; then @@ -15,8 +31,32 @@ else flags=(g++) fi +fi + +sdk=$(xcodebuild -sdk iphoneos -version Path) + flags+=(-I.) +flags+=(-I"${sdk}"/usr/include/libxml2) +flags+=(-Ilibplist/include) +flags+=(-Ilibplist/libcnary/include) + +mkdir -p "${out}" +os=() + +for c in libplist/libcnary/!(cnary).c libplist/src/*.c; do + o=${c%.c}.o + o="${out}"/${o##*/} + os+=("${o}") + if [[ "${c}" -nt "${o}" ]]; then + "${flags[@]}" -c -o "${o}" -x c "${c}" + fi +done set -x -"${flags[@]}" -c -std=c++11 -o ldid.o ldid.cpp -"${flags[@]}" -o ldid ldid.o -x c lookup2.c -x c sha1.c + +"${flags[@]}" -c -std=c++11 -o "${out}"/ldid.o ldid.cpp +"${flags[@]}" -o "${out}"/ldid "${out}"/ldid.o "${os[@]}" -x c lookup2.c -x c sha1.c -lxml2 + +if ! "${ios}"; then + ln -sf out/ldid . +fi -- 2.45.2