forked from mapbox/XcodeClangFormat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·43 lines (36 loc) · 1.42 KB
/
configure
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
#!/usr/bin/env bash
set -e
set -o pipefail
set -u
LLVM_VERSION=3.9.0
LLVM_HASH=e2e15b3e5c5f3713174bfbe5a45cc3e01af8e0c21a34750c2daeabd37f2dc6f2
LLVM_CONFIG=${LLVM_CONFIG:-llvm-config}
command -v "${LLVM_CONFIG}" >/dev/null 2>&1 || {
PREFIX="deps/clang-${LLVM_VERSION}"
if [ ! -f "${PREFIX}/bin/llvm-config" ]; then
mkdir -p "deps"
FILE="deps/clang-${LLVM_VERSION}.tar.xz"
if [ ! -f "${FILE}" ]; then
URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
echo "Downloading ${URL}..."
curl --retry 3 -# -S -L "${URL}" -o "${FILE}.tmp" && mv "${FILE}.tmp" "${FILE}"
fi
echo -n "Checking file... "
echo "${LLVM_HASH} ${FILE}" | shasum -a 512256 -c
rm -rf "${PREFIX}"
mkdir -p "${PREFIX}"
echo -n "Unpacking archive... "
tar xf "${FILE}" -C "${PREFIX}" --strip-components 1
echo "done."
fi
LLVM_CONFIG="${PREFIX}/bin/llvm-config"
}
PREFIX="$("${LLVM_CONFIG}" --prefix)"
case "${PREFIX}" in
*\ *) (>&2 echo "Error: Path to LLVM may not contain spaces: '${PREFIX}'"); exit 1 ;;
esac
echo "// Do not modify this file. Instead, rerun ./configure" > config.xcconfig
echo "LLVM_LIBDIR=$(${LLVM_CONFIG} --libdir)" >> config.xcconfig
echo "LLVM_CXXFLAGS=$(${LLVM_CONFIG} --cxxflags)" >> config.xcconfig
echo "Wrote config.xcconfig."
open XcodeClangFormat.xcodeproj