]> git.saurik.com Git - ldid.git/blob - make.sh
Complete padding of final fat code directory blob.
[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 shift
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
22 sudo xcode-select --switch /Applications/Xcode-5.1.1.app
23
24 if which xcrun &>/dev/null; then
25 flags=(xcrun -sdk macosx g++)
26 flags+=(-mmacosx-version-min=10.4)
27
28 for arch in i386 x86_64; do
29 flags+=(-arch "${arch}")
30 done
31 else
32 flags=(g++)
33 fi
34
35 fi
36
37 sdk=$(xcodebuild -sdk iphoneos -version Path)
38
39 flags+=(-I.)
40 flags+=(-I"${sdk}"/usr/include/libxml2)
41 flags+=(-Ilibplist/include)
42 flags+=(-Ilibplist/libcnary/include)
43
44 flags+=("$@")
45
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
57
58 set -x
59
60 "${flags[@]}" -c -std=c++11 -o "${out}"/ldid.o ldid.cpp
61 "${flags[@]}" -o "${out}"/ldid "${out}"/ldid.o "${os[@]}" -x c lookup2.c -lxml2 -lcrypto
62
63 if ! "${ios}"; then
64 ln -sf out/ldid .
65 fi