forked from willtr101/XcodeClangFormat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·46 lines (39 loc) · 1.43 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
44
45
46
#!/usr/bin/env bash
set -e
set -x
set -o pipefail
set -u
# https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.2/clang+llvm-15.0.2-arm64-apple-darwin21.0.tar.xz
LLVM_VERSION=15.0.2
LLVM_CONFIG=${LLVM_CONFIG:-llvm-config}
ARCH=arm64
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="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-${ARCH}-apple-darwin21.0.tar.xz"
echo "Downloading ${URL}..."
curl --retry 3 -# -S -L "${URL}" -o "${FILE}.tmp" && mv "${FILE}.tmp" "${FILE}"
fi
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
*\ *)
(echo >&2 "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