]> git.saurik.com Git - ldid.git/blame - make.sh
Store SHA256 as hash2 in files2 for CodeDirectory.
[ldid.git] / make.sh
CommitLineData
6212944b 1#!/bin/bash
6579543e 2
a5b37447 3set -e
15babeef 4shopt -s extglob
1d58df4c 5
15babeef
JF
6if [[ $# == 0 ]]; then
7 ios=false
8else
9 ios=$1
a50bb1be 10 shift
15babeef
JF
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
69d2fe54
JF
22sudo xcode-select --switch /Applications/Xcode-5.1.1.app
23
cd35ba9e
JF
24if 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
31else
32 flags=(g++)
33fi
bf29b0fe 34
15babeef
JF
35fi
36
37sdk=$(xcodebuild -sdk iphoneos -version Path)
38
4374152f 39flags+=(-I.)
15babeef
JF
40flags+=(-I"${sdk}"/usr/include/libxml2)
41flags+=(-Ilibplist/include)
42flags+=(-Ilibplist/libcnary/include)
43
a50bb1be
JF
44flags+=("$@")
45
15babeef
JF
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
4374152f 57
bf29b0fe 58set -x
15babeef
JF
59
60"${flags[@]}" -c -std=c++11 -o "${out}"/ldid.o ldid.cpp
661226a8 61"${flags[@]}" -o "${out}"/ldid "${out}"/ldid.o "${os[@]}" -x c lookup2.c -lxml2 -framework Security -lcrypto
15babeef
JF
62
63if ! "${ios}"; then
64 ln -sf out/ldid .
65fi