forked from klzgrad/naiveproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-clang.sh
executable file
·93 lines (84 loc) · 2.95 KB
/
get-clang.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
set -ex
ARCH=$(uname)
case "$ARCH" in
MINGW*) ARCH=Windows;;
MSYS*) ARCH=Windows;;
esac
build_sysroot() {
./build/linux/sysroot_scripts/sysroot-creator-sid-naive.sh "BuildSysroot$1"
}
if [ "$ARCH" = Linux ]; then
if [ "$OPENWRT_FLAGS" ]; then
./get-openwrt.sh
else
eval "$EXTRA_FLAGS"
case "$target_cpu" in
x64) build_sysroot Amd64;;
x86) build_sysroot I386;;
arm64) build_sysroot ARM64;;
arm) build_sysroot ARM;;
esac
fi
fi
# Clang
python2=$(which python2 2>/dev/null || which python 2>/dev/null)
CLANG_REVISION=$($python2 tools/clang/scripts/update.py --print-revision)
CLANG_PATH="clang-$CLANG_REVISION.tgz"
case "$ARCH" in
Linux) clang_url="https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/$CLANG_PATH";;
Darwin) clang_url="https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/$CLANG_PATH";;
Windows) clang_url="https://commondatastorage.googleapis.com/chromium-browser-clang/Win/$CLANG_PATH";;
*) exit 1;;
esac
if [ ! -d third_party/llvm-build/Release+Asserts/bin ]; then
mkdir -p third_party/llvm-build/Release+Asserts
curl "$clang_url" | tar xzf - -C third_party/llvm-build/Release+Asserts
fi
# AFDO profile (Linux)
if [ "$ARCH" = Linux -a ! -f chrome/android/profiles/afdo.prof ]; then
AFDO_PATH=$(cat chrome/android/profiles/newest.txt)
afdo_url="https://storage.googleapis.com/chromeos-prebuilt/afdo-job/llvm/$AFDO_PATH"
curl "$afdo_url" | bzip2 -cd >chrome/android/profiles/afdo.prof
fi
# Profiles (Windows, Mac)
case "$ARCH" in
Windows)
case "$(uname -m)" in
x86_64) PGO_NAME=win64;;
*) PGO_NAME=win32;;
esac;;
Darwin) PGO_NAME=mac;;
esac
if [ "$PGO_NAME" ]; then
mkdir -p chrome/build/pgo_profiles
profile=$(cat chrome/build/$PGO_NAME.pgo.txt)
cd chrome/build/pgo_profiles
curl -LO "https://storage.googleapis.com/chromium-optimization-profiles/pgo_profiles/$profile"
cd ../../..
fi
# dsymutil (Mac)
if [ "$ARCH" = Darwin ]; then
mkdir -p tools/clang/dsymutil
DSYMUTIL_PATH="dsymutil-$CLANG_REVISION.tgz"
dsymutil_url="http://commondatastorage.googleapis.com/chromium-browser-clang-staging/Mac/$DSYMUTIL_PATH"
curl "$dsymutil_url" | tar xzf - -C tools/clang/dsymutil
fi
# sccache (Windows)
if [ "$ARCH" = Windows ]; then
sccache_url="https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-pc-windows-msvc.tar.gz"
mkdir -p ~/.cargo/bin
curl -L "$sccache_url" | tar xzf - --strip=1 -C ~/.cargo/bin
fi
# gn
if [ ! -f gn/out/gn ]; then
GN_VERSION=$(grep "'gn_version':" buildtools/DEPS | cut -d"'" -f4)
mkdir -p gn/out
cd gn/out
case "$ARCH" in
Linux) curl -L "https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/$GN_VERSION" -o gn.zip;;
Darwin) curl -L "https://chrome-infra-packages.appspot.com/dl/gn/gn/mac-amd64/+/$GN_VERSION" -o gn.zip;;
Windows) curl -L "https://chrome-infra-packages.appspot.com/dl/gn/gn/windows-amd64/+/$GN_VERSION" -o gn.zip;;
esac
unzip gn.zip
fi