forked from metashell/metashell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_build_dependencies.sh
executable file
·138 lines (131 loc) · 3.48 KB
/
install_build_dependencies.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/sh
#
# Metashell - Interactive C++ template metaprogramming shell
# Copyright (C) 2015, Abel Sinkovics ([email protected])
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
SRC_ROOT=$(dirname "$0")
# Arguments
if [ -z "${BUILD_THREADS}" ]
then
BUILD_THREADS=1
fi
if [ -z "${NO_SUDO}" ]
then
SUDO=sudo
else
SUDO=
fi
PLATFORM="$($SRC_ROOT/tools/detect_platform.sh)"
CLANG_VERSION=10.0.1
GRAPHVIZ_VERSION=2.40.1
# Show argument & config summary
echo "Number of threads used: ${BUILD_THREADS}"
echo "Platform: ${PLATFORM}"
echo "sudo: ${SUDO}"
case "${PLATFORM}" in
arch)
# If `gcc-multilib` is already installed, don't try to install plain `gcc`
pacman -Qqs gcc-multilib > /dev/null
if [ $? ]; then
${SUDO} pacman --needed -S cmake git python
else
${SUDO} pacman --needed -S cmake git python gcc
fi
;;
fedora)
${SUDO} yum -y install \
git \
gcc \
gcc-c++ \
cmake \
rpm-build \
python \
dpkg-dev \
make
;;
gentoo)
${SUDO} emerge dev-vcs/git dev-util/cmake sys-libs/libtermcap-compat app-arch/zip
;;
opensuse)
${SUDO} zypper --non-interactive install \
git \
cmake \
gcc-c++ \
rpm-build \
termcap \
zip
;;
ubuntu)
apt-cache policy | grep universe > /dev/null
if [ $? -ne 0 ]
then
${SUDO} apt-add-repository universe
fi
${SUDO} apt-get -y install \
git g++ cmake zip python3-pip libtinfo5 \
libtool automake autoconf libltdl-dev pkg-config bison flex rpm
PLATFORM_VERSION="$($SRC_ROOT/tools/detect_platform.sh --version)"
if [ "${PLATFORM_VERSION}" = "22.04" ]
then
${SUDO} apt -y install g++-12
fi
${SUDO} -H pip3 install pycodestyle pylint gitpython daemonize mkdocs cheetah3
PLATFORM_ID="$($SRC_ROOT/tools/detect_platform.sh --id)"
CLANG_ARCHIVE="clang+llvm-${CLANG_VERSION}-x86_64-linux-gnu-ubuntu-16.04"
mkdir -p "bin/${PLATFORM_ID}"
cd "bin/${PLATFORM_ID}"
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/${CLANG_ARCHIVE}.tar.xz
tar -xf ${CLANG_ARCHIVE}.tar.xz
rm -rf clang
mv ${CLANG_ARCHIVE} clang
rm ${CLANG_ARCHIVE}.tar.xz
if [ "${NO_GRAPHVIZ}" = "" ]
then
rm -rf graphviz
mkdir graphviz
cd graphviz
GRAPHVIZ_BIN="$(pwd)"
cp -r "../../../3rd/graphviz" src
cd src
./autogen.sh
./configure --prefix "${GRAPHVIZ_BIN}"
make -j${BUILD_THREADS}
make install
cd ..
cd ..
fi
cd ../..
;;
debian)
${SUDO} apt-get -y install git g++ cmake zip python3 file rpm
;;
freebsd)
pkg install -y git cmake gcc
;;
openbsd)
if [ "$($SRC_ROOT/tools/detect_platform.sh --version)" = "5.5" ]
then
export PKG_PATH="ftp://ftp.fsn.hu/pub/OpenBSD/5.5/packages/$(machine -a)/"
pkg_add git g++ cmake python
else
echo Unsupported OpenBSD version
exit 1
fi
;;
*)
echo Unknown platform. Please install dependencies manually.
exit 1
;;
esac