]> git.saurik.com Git - ldid.git/blob - make.sh
Separate lookup of LC_ENCRYPTION_INFO from usages.
[ldid.git] / make.sh
1 #!/bin/bash
2
3 set -e
4 shopt -s extglob
5
6 if [[ $# == 0 ]]; then
7 ios=false
8 else
9 ios=$1
10 fi
11
12 if "${ios}"; then
13
14 out=ios
15 sudo xcode-select --switch /Applications/Xcode-4.6.3.app
16 flags=(cycc -- -miphoneos-version-min=2.0 -arch armv6)
17
18 else
19
20 out=out
21 sudo xcode-select --switch /Applications/Xcode-5.1.1.app
22
23 if which xcrun &>/dev/null; then
24 flags=(xcrun -sdk macosx g++)
25 flags+=(-mmacosx-version-min=10.4)
26
27 for arch in i386 x86_64; do
28 flags+=(-arch "${arch}")
29 done
30 else
31 flags=(g++)
32 fi
33
34 fi
35
36 sdk=$(xcodebuild -sdk iphoneos -version Path)
37
38 flags+=(-I.)
39 flags+=(-I"${sdk}"/usr/include/libxml2)
40 flags+=(-Ilibplist/include)
41 flags+=(-Ilibplist/libcnary/include)
42
43 mkdir -p "${out}"
44 os=()
45
46 for c in libplist/libcnary/!(cnary).c libplist/src/*.c; do
47 o=${c%.c}.o
48 o="${out}"/${o##*/}
49 os+=("${o}")
50 if [[ "${c}" -nt "${o}" ]]; then
51 "${flags[@]}" -c -o "${o}" -x c "${c}"
52 fi
53 done
54
55 set -x
56
57 "${flags[@]}" -c -std=c++11 -o "${out}"/ldid.o ldid.cpp
58 "${flags[@]}" -o "${out}"/ldid "${out}"/ldid.o "${os[@]}" -x c lookup2.c -x c sha1.c -lxml2
59
60 if ! "${ios}"; then
61 ln -sf out/ldid .
62 fi