]> git.saurik.com Git - ldid.git/blobdiff - make.sh
Replace Windows stat::st_mode with dirent::d_type.
[ldid.git] / make.sh
diff --git a/make.sh b/make.sh
index 6a3f530a2c3776e450f6070b10fe705c6e75f064..bca0983db44aec38c6f9bcd262fc7706a2100b79 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -1,6 +1,25 @@
 #!/bin/bash
 
 set -e
+shopt -s extglob
+
+if [[ $# == 0 ]]; then
+    ios=false
+else
+    ios=$1
+    shift
+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
     flags=(xcrun -sdk macosx g++)
@@ -13,5 +32,36 @@ 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[@]}" -o ldid ldid.cpp -I. -x c lookup2.c -x c sha1.c
+
+plist=(-Llibplist/src/.libs -lplist++)
+
+"${flags[@]}" -c -std=c++11 -o "${out}"/ldid.o ldid.cpp
+"${flags[@]}" -o "${out}"/ldid "${out}"/ldid.o "${os[@]}" -x c lookup2.c -lxml2 -lcrypto "${plist[@]}"
+
+if ! "${ios}"; then
+    ln -sf out/ldid .
+fi