forked from bpftrace/bpftrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
67 lines (63 loc) · 1.75 KB
/
Vagrantfile
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Environment variables:
#
# SKIP_BCC_BUILD: Set to skip the building bcc from source
$ubuntu_18_deps = <<EOF
apt-get -qq update
apt-get -qq install linux-headers-$(uname -r)
apt-get -qq install bison cmake flex g++ git libelf-dev zlib1g-dev libfl-dev systemtap-sdt-dev
apt-get -qq install llvm-7-dev llvm-7-runtime libclang-7-dev clang-7
EOF
$build_bcc = <<EOF
if [ -e /usr/local/lib/libbcc.so ]; then
echo "libbcc already built, skipping"
exit 0
fi
git clone https://github.com/iovisor/bcc.git
mkdir -p bcc/build
cd bcc/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make && sudo make install && sudo ldconfig
EOF
Vagrant.configure("2") do |config|
boxes = {
'ubuntu-18.04' => {
'image' => 'ubuntu/bionic64',
'scripts' => [ $ubuntu_18_deps, ],
},
'ubuntu-18.10' => {
'image' => 'ubuntu/cosmic64',
'scripts' => [ $ubuntu_18_deps, ],
},
'ubuntu-19.04' => {
'image' => 'ubuntu/disco64',
'scripts' => [ $ubuntu_18_deps, ],
},
}
boxes.each do | name, params |
config.vm.define name do |box|
box.vm.box = params['image']
box.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
box.vm.provider :libvirt do |v|
v.memory = 2048
v.cpus = 2
end
(params['scripts'] || []).each do |script|
box.vm.provision :shell, inline: script
end
unless ENV['SKIP_BCC_BUILD']
box.vm.provision :shell, privileged: false, inline: $build_bcc
end
config.vm.post_up_message = <<-HEREDOC
#######
bpftrace source is available in /vagrant
Build command: cmake /vagrant -DCMAKE_INSTALL_PREFIX=/usr/local && make
#######
HEREDOC
end
end
end