-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsymredirect-host-build.sh
executable file
·42 lines (31 loc) · 1.34 KB
/
symredirect-host-build.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
#!/bin/bash
set -e
set -x
if [ $(uname -s) != "Darwin" ]; then
echo "*** Cloning ld64 repository ..."
[ -d ld64 ] && rm -rf ld64
git clone https://github.com/ProcursusTeam/ld64.git
echo "*** Checking the non-darwin headers ..."
if [ ! -d ./ld64/EXTERNAL_HEADERS/non-darwin ]; then
echo "The non-darwin headers are not present in the ld64 repository."
fi
EXTRA_HEADER_FLAG="-I./ld64/EXTERNAL_HEADERS/non-darwin"
fi
echo "*** Building the symredirect-host executable ..."
clang++ -v -std=c++11 $EXTRA_HEADER_FLAG -o symredirect-host symredirect.cpp
if [ $(uname -s) = "Darwin" ] && [ "$(sw_vers -productName)" != "macOS" ]; then
echo "*** Signing the symredirect-host with entitlements ..."
ldid -S./entitlements.plist ./symredirect-host
if [ -f /basebin/fastPathSign ]; then
echo "*** Signing the symredirect-host with fastPathSign ..."
ldid -M -S/basebin/bootstrap.entitlements ./symredirect-host
/basebin/fastPathSign ./symredirect-host
fi
fi
echo "*** Checking built symredirect-host executable ..."
chmod +x ./symredirect-host
./symredirect-host
echo "*** Installing symredirect-host to /usr/local/bin/symredirect ..."
sudo rm -f /usr/local/bin/symredirect #clear signature cache
[ -d /usr/local/bin ] || sudo mkdir -p /usr/local/bin
sudo cp symredirect-host /usr/local/bin/symredirect