-
Notifications
You must be signed in to change notification settings - Fork 25
/
clang32-bootstrap.sh
executable file
·66 lines (53 loc) · 1.57 KB
/
clang32-bootstrap.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
abort() {
echo "ERROR: $1!"
exit 1
}
ret=0
# Avoid conflicts with PATH overrides.
CHMOD="/bin/chmod"
CURL="/usr/bin/curl"
MKDIR="/bin/mkdir"
RM="/bin/rm"
UNZIP="/usr/bin/unzip"
if [ -z "${OVERRIDE_PYTHON3}" ]; then
# Use whatever is in PATH
OVERRIDE_PYTHON3=python3
fi
CLANG32_DIR="clang32"
CLANG32_SCRIPTS_URL="https://raw.githubusercontent.com/acidanthera/ocbuild/master/scripts/"
CLANG32_SCRIPTS=(
"fix-macho32"
"libtool32"
)
CLANG32_ZIP="clang-12-xcode-14.zip"
"${CURL}" -LfsO "https://github.com/acidanthera/ocbuild/releases/download/llvm-kext32-latest/${CLANG32_ZIP}" || ret=$?
if [ $ret -ne 0 ]; then
abort "Failed to download clang32 with code ${ret}"
fi
"${MKDIR}" "${CLANG32_DIR}"
if [ $ret -ne 0 ]; then
abort "Failed to create clang32 directory with code ${ret}"
fi
"${UNZIP}" -q "${CLANG32_ZIP}" -d "${CLANG32_DIR}" || ret=$?
if [ $ret -ne 0 ]; then
abort "Failed to extract downloaded clang32 with code ${ret}"
fi
"${RM}" -rf "${CLANG32_ZIP}"
# Download tools to override
for tool in "${CLANG32_SCRIPTS[@]}"; do
url="${CLANG32_SCRIPTS_URL}/${tool}"
"${CURL}" -Lfs "${url}" -o "${CLANG32_DIR}/${tool}" || ret=$?
if [ $ret -ne 0 ]; then
abort "Failed to download ${tool} with code ${ret}"
fi
"${CHMOD}" a+x "${CLANG32_DIR}/${tool}" || ret=$?
if [ $ret -ne 0 ]; then
abort "Failed to chmod ${tool} with code ${ret}"
fi
done
# macholib required for fix-macho32
"${OVERRIDE_PYTHON3}" -m pip install --disable-pip-version-check --user -q macholib || ret=$?
if [ $ret -ne 0 ]; then
abort "Failed to install macholib with code ${ret}"
fi