-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.sh
executable file
·65 lines (48 loc) · 1.13 KB
/
make.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/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.app
flags=(cycc -- -miphoneos-version-min=2.0 -arch armv7 arm64)
else
out=out
sudo xcode-select --switch /Applications/Xcode.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
"${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