-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.prereqs
105 lines (86 loc) · 3.99 KB
/
default.prereqs
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
#!/bin/bash
set -e pipefail
source prereqs.lib
#######################################
# Installs clang suite packages.
# Arguments:
# Version of the clang suite package.
# Returns:
# 0 if no error was detected, non-zero otherwise.
#######################################
function install_clang_suite() {
local version=$1
prereqs.apt install \
clang-${version} \
lldb-${version} \
lld-${version} \
clang-format-${version} \
clang-tidy-${version} \
libc++-${version}-dev \
libc++abi-${version}-dev
}
#######################################
# Setups alternatives for clang suite.
# Arguments:
# Version of the clang suite package.
# Returns:
# 0 if no error was detected, 2 otherwise.
#######################################
function update_clang_suite_alternatives() {
local version=$1
local priority=$2
update-alternatives \
--install /usr/bin/clang clang /usr/bin/clang-${version} ${priority}\
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${version} \
--slave /usr/bin/asan_symbolize asan_symbolize /usr/bin/asan_symbolize-${version} \
--slave /usr/bin/c-index-test c-index-test /usr/bin/c-index-test-${version} \
--slave /usr/bin/clang-check clang-check /usr/bin/clang-check-${version} \
--slave /usr/bin/clang-cl clang-cl /usr/bin/clang-cl-${version} \
--slave /usr/bin/clang-cpp clang-cpp /usr/bin/clang-cpp-${version} \
--slave /usr/bin/clang-format clang-format /usr/bin/clang-format-${version} \
--slave /usr/bin/clang-format-diff clang-format-diff /usr/bin/clang-format-diff-${version} \
--slave /usr/bin/clang-import-test clang-import-test /usr/bin/clang-import-test-${version} \
--slave /usr/bin/clang-include-fixer clang-include-fixer /usr/bin/clang-include-fixer-${version} \
--slave /usr/bin/clang-offload-bundler clang-offload-bundler /usr/bin/clang-offload-bundler-${version} \
--slave /usr/bin/clang-query clang-query /usr/bin/clang-query-${version} \
--slave /usr/bin/clang-rename clang-rename /usr/bin/clang-rename-${version} \
--slave /usr/bin/clang-reorder-fields clang-reorder-fields /usr/bin/clang-reorder-fields-${version} \
--slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${version} \
--slave /usr/bin/lldb lldb /usr/bin/lldb-${version} \
--slave /usr/bin/lldb-server lldb-server /usr/bin/lldb-server-${version}
}
prereqs.init 'The default prerequisites of any DSim workspace'
prereqs.assert_sudo
declare -A DISTRO_MAP
DISTRO_MAP[bionic]=dashing
DISTRO_MAP[xenial]=bouncy
DISTRO=${DISTRO_MAP[$(lsb_release -sc)]}
ASSERT_MSG="Unknown ROS distro, maybe not on an Ubuntu box?" prereqs.assert [ ! -z "$DISTRO" ]
CLANG_SUITE_VERSION=8
CLANG_SUITE_ALTERNATIVE_PRIORITY=10
prereqs.install_apt_repo "ros2-latest" "http://packages.ros.org/ros2/ubuntu" "C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654"
prereqs.apt update
prereqs.apt install \
bash-completion \
build-essential \
curl \
gdb \
git \
mercurial \
python3 \
python3-setuptools \
python3-vcstool \
python3-rosdep \
python3-colcon-common-extensions \
ros-$DISTRO-ament-cmake \
tmux
install_clang_suite ${CLANG_SUITE_VERSION}
update_clang_suite_alternatives ${CLANG_SUITE_VERSION} ${CLANG_SUITE_ALTERNATIVE_PRIORITY}
if ! grep -q "^source /opt/ros/$DISTRO/setup.bash" ~/.bashrc; then
cat >> ~/.bashrc <<< "source /opt/ros/$DISTRO/setup.bash"
fi
if ! grep -q "^export ROS_DISTRO=" ~/.bashrc; then
cat >> ~/.bashrc <<< "export ROS_DISTRO=$DISTRO"
fi
rosdep init || true
prereqs.done