-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathinstall_llvm.sh
61 lines (56 loc) · 2.1 KB
/
install_llvm.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
#!/bin/bash
set -ex
IFS='.' read -ra VER_ARR <<< "$PKG_VERSION"
# temporary prefix to be able to install files more granularly
mkdir temp_prefix
MAJOR_VER="${VER_ARR[0]}"
MAJOR_EXT="${MAJOR_VER}"
# default SOVER for tagged releases is major.minor version
SOVER_EXT="${VER_ARR[0]}.${VER_ARR[1]}"
# for rc's, both MAJOR_EXT & SOVER_EXT get suffixes
if [[ "${PKG_VERSION}" == *rc* ]]; then
# rc's get "-rcX" suffix; in this case, PKG_VERSION has 4 parts,
# (e.g. 19.1.0.rc1), so take the last part after splitting on "."
MAJOR_EXT="${MAJOR_EXT}-${VER_ARR[3]}"
SOVER_EXT="${SOVER_EXT}-${VER_ARR[3]}"
elif [[ "${PKG_VERSION}" == *dev* ]]; then
# otherwise with git suffix
MAJOR_EXT="${MAJOR_EXT}git"
SOVER_EXT="${SOVER_EXT}git"
fi
if [[ "${PKG_NAME}" == libllvm-c* ]]; then
cmake --install ./build --prefix=./temp_prefix
# only libLLVM-C
mv ./temp_prefix/lib/libLLVM-C${SOVER_EXT}${SHLIB_EXT} $PREFIX/lib
elif [[ "${PKG_NAME}" == libllvm* ]]; then
cmake --install ./build --prefix=./temp_prefix
# all other libraries
mv ./temp_prefix/lib/libLLVM-${MAJOR_EXT}${SHLIB_EXT} $PREFIX/lib
mv ./temp_prefix/lib/lib*.so.${SOVER_EXT} $PREFIX/lib || true
mv ./temp_prefix/lib/lib*.${SOVER_EXT}.dylib $PREFIX/lib || true
elif [[ "${PKG_NAME}" == "llvm-tools-${MAJOR_VER}" ]]; then
cmake --install ./build --prefix=./temp_prefix
# install all binaries with a -${MAJOR_VER}
pushd ./temp_prefix
for f in bin/*; do
cp $f $PREFIX/bin/$(basename $f)-${MAJOR_VER}
done
popd
# except one binary that belongs to llvmdev
rm $PREFIX/bin/llvm-config-${MAJOR_VER}
elif [[ "${PKG_NAME}" == "llvm-tools" ]]; then
cmake --install ./build --prefix=./temp_prefix
# Install a symlink without the major version
pushd ./temp_prefix
for f in bin/*; do
ln -sf $PREFIX/bin/$(basename $f)-${MAJOR_VER} $PREFIX/bin/$(basename $f)
done
popd
# opt-viewer tool
mv ./temp_prefix/share/* $PREFIX/share
rm $PREFIX/bin/llvm-config
else
# llvmdev: install everything else
cmake --install ./build --prefix=$PREFIX
fi
rm -rf temp_prefix