X-Git-Url: https://git.saurik.com/ldid.git/blobdiff_plain/604cc486bdefb246c984a21dbb30cdaf8b0a7f4d..ef3241bbef1af51f26a052299c0a0ad2ff2d9a01:/make.sh?ds=sidebyside diff --git a/make.sh b/make.sh index 03f1b72..d574ae7 100755 --- a/make.sh +++ b/make.sh @@ -1,19 +1,65 @@ #!/bin/bash set -e +shopt -s extglob -flags=() - -sdk=/Developer/SDKs/MacOSX10.4u.sdk -if [[ -e $sdk ]]; then - flags+=(-mmacosx-version-min=10.4 -isysroot "$sdk") +if [[ $# == 0 ]]; then + ios=false +else + ios=$1 + shift fi -for arch in i386 x86_64; do - if g++ -arch "${arch}" --version &>/dev/null; then +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 + flags=(xcrun -sdk macosx g++) + flags+=(-mmacosx-version-min=10.4) + + for arch in i386 x86_64; do flags+=(-arch "${arch}") + done +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) + +flags+=("$@") + +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 -g++ "${flags[@]}" -o ldid ldid.cpp -I. -x c lookup2.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 -lxml2 -framework Security -lcrypto + +if ! "${ios}"; then + ln -sf out/ldid . +fi