]> git.saurik.com Git - ldid.git/blobdiff - make.sh
Fix compilation via macOS 10.12 targetting iOS 11.
[ldid.git] / make.sh
diff --git a/make.sh b/make.sh
index 4ab6acffe3bd5c29e54ee956148fbdbf767386b3..d88a8b0555e45216454c69aa5d79a119019594ab 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -1,8 +1,25 @@
 #!/bin/bash
 
 set -e
+shopt -s extglob
 
-sudo xcode-select --switch /Applications/Xcode-5.1.1.app
+if [[ $# == 0 ]]; then
+    ios=false
+else
+    ios=$1
+    shift
+fi
+
+export DEVELOPER_DIR=/Applications/Xcode-5.1.1.app
+
+if "${ios}"; then
+
+out=ios
+flags=(cycc -- -miphoneos-version-min=2.0 -arch armv6 -arch arm64)
+
+else
+
+out=out
 
 if which xcrun &>/dev/null; then
     flags=(xcrun -sdk macosx g++)
@@ -15,8 +32,34 @@ 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
-"${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 -lxml2 -framework Security -lcrypto
+
+if ! "${ios}"; then
+    ln -sf out/ldid .
+fi