+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 "${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