]> git.saurik.com Git - ldid.git/blame_incremental - make.sh
Use std::string more often, and factor out Commit.
[ldid.git] / make.sh
... / ...
CommitLineData
1#!/bin/bash
2
3set -e
4shopt -s extglob
5
6if [[ $# == 0 ]]; then
7 ios=false
8else
9 ios=$1
10 shift
11fi
12
13if "${ios}"; then
14
15out=ios
16sudo xcode-select --switch /Applications/Xcode-4.6.3.app
17flags=(cycc -- -miphoneos-version-min=2.0 -arch armv6)
18
19else
20
21out=out
22sudo xcode-select --switch /Applications/Xcode-5.1.1.app
23
24if 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
31else
32 flags=(g++)
33fi
34
35fi
36
37sdk=$(xcodebuild -sdk iphoneos -version Path)
38
39flags+=(-I.)
40flags+=(-I"${sdk}"/usr/include/libxml2)
41flags+=(-Ilibplist/include)
42flags+=(-Ilibplist/libcnary/include)
43
44flags+=("$@")
45
46mkdir -p "${out}"
47os=()
48
49for 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
56done
57
58set -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
63if ! "${ios}"; then
64 ln -sf out/ldid .
65fi