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