forked from nmathewson/libevent_obsolete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
397 lines (336 loc) · 13.6 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# -*- mode: ruby -*-
# vi: set ft=ruby :
# DESCRIPTION:
# ============
# Vagrant for running libevent tests with:
# - timeout 30min, to avoid hungs
# - run tests in parallel under ctest (10 concurency)
# - if you have uncommited changes, you should commit them first to check
# - unix only, because of some tar'ing to avoid one vm affect another
#
# ENVIRONMENT:
# ============
# - NO_PKG -- do not install packages
# - NO_CMAKE -- do not run with cmake
# - NO_AUTOTOOLS -- do not run with autoconf/automake
Vagrant.configure("2") do |config|
# to allow running boxes provisions in parallel, we can't share the same dirs
# via virtualbox, however sometimes it is the only way, so instead let's
# create an archive of HEAD (this way we will not have any trash there) and
# extract it for every box to the separate folder.
#
# P.S. we will change this --prefix with tar(1) --trasnform
system('git archive --prefix=libevent/ --output=.vagrant/libevent.tar HEAD')
config.vm.provider "virtualbox" do |vb|
vb.memory = "512"
# otherwise osx fails, anyway we do not need this
vb.customize ["modifyvm", :id, "--usb", "off"]
vb.customize ["modifyvm", :id, "--usbehci", "off"]
end
# disable /vagrant share, in case we will not use default mount
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "ubuntu" do |ubuntu|
system('tar --overwrite --transform=s/libevent/libevent-linux/ -xf .vagrant/libevent.tar -C .vagrant/')
ubuntu.vm.box = "ubuntu/xenial64"
ubuntu.vm.synced_folder ".vagrant/libevent-linux", "/vagrant",
type: "rsync"
if ENV['NO_PKG'] != "true"
ubuntu.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y zlib1g-dev libssl-dev python2.7
apt-get install -y build-essential cmake ninja-build
apt-get install -y autoconf automake libtool
SHELL
end
if ENV['NO_CMAKE'] != "true"
ubuntu.vm.provision "shell", privileged: false, inline: <<-SHELL
cd /vagrant
rm -fr .cmake-vagrant
mkdir -p .cmake-vagrant
cd .cmake-vagrant
cmake -G Ninja ..
export CTEST_TEST_TIMEOUT=1800
export CTEST_OUTPUT_ON_FAILURE=1
export CTEST_PARALLEL_LEVEL=20
cmake --build . --target verify
SHELL
end
if ENV['NO_AUTOTOOLS'] != "true"
ubuntu.vm.provision "shell", privileged: false, inline: <<-SHELL
cd /vagrant
./autogen.sh
./configure
make -j20 verify
SHELL
end
end
config.vm.define "freebsd" do |freebsd|
system('tar --overwrite --transform=s/libevent/libevent-freebsd/ -xf .vagrant/libevent.tar -C .vagrant/')
freebsd.vm.box = "freebsd/FreeBSD-11.0-STABLE"
freebsd.vm.synced_folder ".vagrant/libevent-freebsd", "/vagrant",
type: "rsync", group: "wheel"
# otherwise reports error
freebsd.ssh.shell = "sh"
if ENV['NO_PKG'] != "true"
freebsd.vm.provision "shell", inline: <<-SHELL
pkg install --yes openssl cmake ninja automake autotools
SHELL
end
if ENV['NO_CMAKE'] != "true"
freebsd.vm.provision "shell", privileged: false, inline: <<-SHELL
cd /vagrant
rm -fr .cmake-vagrant
mkdir -p .cmake-vagrant
cd .cmake-vagrant
cmake -G Ninja ..
export CTEST_TEST_TIMEOUT=1800
export CTEST_OUTPUT_ON_FAILURE=1
export CTEST_PARALLEL_LEVEL=20
cmake --build . --target verify
SHELL
end
if ENV['NO_AUTOTOOLS'] != "true"
freebsd.vm.provision "shell", privileged: false, inline: <<-SHELL
cd /vagrant
./autogen.sh
./configure
make -j20 verify
SHELL
end
end
config.vm.define "netbsd" do |netbsd|
system('tar --overwrite --transform=s/libevent/libevent-netbsd/ -xf .vagrant/libevent.tar -C .vagrant/')
netbsd.vm.box = "kja/netbsd-7-amd64"
netbsd.vm.synced_folder ".vagrant/libevent-netbsd", "/vagrant",
type: "rsync", group: "wheel"
if ENV['NO_PKG'] != "true"
netbsd.vm.provision "shell", inline: <<-SHELL
export PKG_PATH="ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/7.0_2016Q2/All/"
pkg_add ncurses ninja-build automake cmake libtool
SHELL
end
if ENV['NO_CMAKE'] != "true"
netbsd.vm.provision "shell", privileged: false, inline: <<-SHELL
cd /vagrant
rm -fr .cmake-vagrant
mkdir -p .cmake-vagrant
cd .cmake-vagrant
cmake -G Ninja ..
export CTEST_TEST_TIMEOUT=1800
export CTEST_OUTPUT_ON_FAILURE=1
export CTEST_PARALLEL_LEVEL=20
cmake --build . --target verify
SHELL
end
if ENV['NO_AUTOTOOLS'] != "true"
netbsd.vm.provision "shell", privileged: false, inline: <<-SHELL
cd /vagrant
./autogen.sh
./configure
make -j20 verify
SHELL
end
end
config.vm.define "solaris" do |solaris|
system('tar --overwrite --transform=s/libevent/libevent-solaris/ -xf .vagrant/libevent.tar -C .vagrant/')
# XXX:
# - solaris do not have '-or' it only has '-o' for find(1), so we can't use
# rsync
# - and autoconf(1) doesn't work on virtualbox share, ugh
solaris.vm.synced_folder ".vagrant/libevent-solaris", "/vagrant-vbox",
type: "virtualbox"
solaris.vm.box = "tnarik/solaris10-minimal"
if ENV['NO_PKG'] != "true"
# TODO: opencsw does not include ninja(1)
solaris.vm.provision "shell", inline: <<-SHELL
pkgadd -d http://get.opencsw.org/now
pkgutil -U
pkgutil -y -i libssl_dev cmake rsync python gmake gcc5core automake autoconf libtool
SHELL
end
# copy from virtualbox mount to newly created folder
solaris.vm.provision "shell", privileged: false, inline: <<-SHELL
rm -fr ~/vagrant
cp -r /vagrant-vbox ~/vagrant
SHELL
if ENV['NO_CMAKE'] != "true"
# builtin compiler cc(1) is a wrapper, so we should use gcc5 manually,
# otherwise it will not work.
# Plus we should set some paths so that cmake/compiler can find tham.
solaris.vm.provision "shell", privileged: false, inline: <<-SHELL
export CMAKE_INCLUDE_PATH=/opt/csw/include
export CMAKE_LIBRARY_PATH=/opt/csw/lib
export CFLAGS=-I$CMAKE_INCLUDE_PATH
export LDFLAGS=-L$CMAKE_LIBRARY_PATH
cd ~/vagrant
rm -rf .cmake-vagrant
mkdir -p .cmake-vagrant
cd .cmake-vagrant
cmake -DCMAKE_C_COMPILER=gcc ..
export CTEST_TEST_TIMEOUT=1800
export CTEST_OUTPUT_ON_FAILURE=1
export CTEST_PARALLEL_LEVEL=20
cmake --build . --target verify
SHELL
end
if ENV['NO_AUTOTOOLS'] != "true"
# and we should set MAKE for `configure` otherwise it will try to use
# `make`
solaris.vm.provision "shell", privileged: false, inline: <<-SHELL
cd ~/vagrant
./autogen.sh
MAKE=gmake ./configure
gmake -j20 verify
SHELL
end
end
# known failures:
# - sometimes vm hangs
config.vm.define "osx" do |osx|
system('tar --overwrite --transform=s/libevent/libevent-osx/ -xf .vagrant/libevent.tar -C .vagrant/')
osx.vm.synced_folder ".vagrant/libevent-osx", "/vagrant",
type: "rsync", group: "wheel"
osx.vm.box = "jhcook/osx-elcapitan-10.11"
if ENV['NO_PKG'] != "true"
osx.vm.provision "shell", privileged: false, inline: <<-SHELL
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew uninstall libtool
brew install libtool openssl ninja cmake autoconf automake
SHELL
end
if ENV['NO_CMAKE'] != "true"
# we should set some paths so that cmake/compiler can find tham
osx.vm.provision "shell", privileged: false, inline: <<-SHELL
export OPENSSL_ROOT=$(echo /usr/local/Cellar/openssl/*)
export CMAKE_INCLUDE_PATH=$OPENSSL_ROOT/include
export CMAKE_LIBRARY_PATH=$OPENSSL_ROOT/lib
cd /vagrant
mkdir -p .cmake-vagrant
cd .cmake-vagrant
cmake -G Ninja ..
export CTEST_TEST_TIMEOUT=1800
export CTEST_OUTPUT_ON_FAILURE=1
export CTEST_PARALLEL_LEVEL=20
cmake --build . --target verify
SHELL
end
if ENV['NO_AUTOTOOLS'] != "true"
osx.vm.provision "shell", privileged: false, inline: <<-SHELL
export OPENSSL_ROOT=$(echo /usr/local/Cellar/openssl/*)
export CFLAGS=-I$OPENSSL_ROOT/include
export LDFLAGS=-L$OPENSSL_ROOT/lib
cd /vagrant
./autogen.sh
./configure
make -j20 verify
SHELL
end
end
config.vm.define "centos" do |centos|
system('tar --overwrite --transform=s/libevent/libevent-centos/ -xf .vagrant/libevent.tar -C .vagrant/')
centos.vm.synced_folder ".vagrant/libevent-centos", "/vagrant",
type: "rsync", group: "wheel"
centos.vm.box = "centos/7"
if ENV['NO_PKG'] != "true"
centos.vm.provision "shell", inline: <<-SHELL
echo "[russianfedora]" > /etc/yum.repos.d/russianfedora.repo
echo name=russianfedora >> /etc/yum.repos.d/russianfedora.repo
echo baseurl=http://mirror.yandex.ru/fedora/russianfedora/russianfedora/free/el/releases/7/Everything/x86_64/os/ >> /etc/yum.repos.d/russianfedora.repo
echo enabled=1 >> /etc/yum.repos.d/russianfedora.repo
echo gpgcheck=0 >> /etc/yum.repos.d/russianfedora.repo
SHELL
centos.vm.provision "shell", inline: <<-SHELL
yum -y install zlib-devel openssl-devel python
yum -y install gcc cmake ninja-build
yum -y install autoconf automake libtool
SHELL
end
if ENV['NO_CMAKE'] != "true"
centos.vm.provision "shell", privileged: false, inline: <<-SHELL
cd /vagrant
rm -fr .cmake-vagrant
mkdir -p .cmake-vagrant
cd .cmake-vagrant
cmake -G Ninja ..
export CTEST_TEST_TIMEOUT=1800
export CTEST_OUTPUT_ON_FAILURE=1
export CTEST_PARALLEL_LEVEL=20
cmake --build . --target verify
SHELL
end
if ENV['NO_AUTOTOOLS'] != "true"
centos.vm.provision "shell", privileged: false, inline: <<-SHELL
cd /vagrant
./autogen.sh
./configure
make -j20 verify
SHELL
end
end
# known failures:
# - issues with timers (not enough allowed error)
config.vm.define "win" do |win|
system('tar --overwrite --transform=s/libevent/libevent-win/ -xf .vagrant/libevent.tar -C .vagrant/')
# 512MB not enough after libtool install, huh
win.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
# windows does not have rsync builtin, let's use virtualbox for now
win.vm.synced_folder ".vagrant/libevent-win", "/vagrant",
type: "virtualbox"
win.vm.box = "senglin/win-10-enterprise-vs2015community"
if ENV['NO_PKG'] != "true"
# box with vs2015 does not have C++ support, so let's install it manually
# plus chocolatey that includes in this box, can't handle sha1 checksum for
# cmake.install, so let's update it<
win.vm.provision "shell", inline: <<-SHELL
choco upgrade -y chocolatey -pre -f
choco install -y VisualStudioCommunity2013
choco install -y openssl.light
choco install -y cygwin cyg-get
choco install -y cmake
choco install -y cmake.install
choco install -y python2
SHELL
# chocolatey openssl.light package does not contains headers
win.vm.provision "shell", inline: <<-SHELL
(new-object System.Net.WebClient).DownloadFile('http://strcpy.net/packages/Win32OpenSSL-1_0_2a.exe', '/openssl.exe')
/openssl.exe /silent /verysilent /sp- /suppressmsgboxes
SHELL
# XXX:
# - cyg-get depends from cygwinsetup.exe
# https://github.com/chocolatey/chocolatey-coreteampackages/issues/200
# - cyg-get only downloads, do not installs them, ugh. so let's do not use
# it
win.vm.provision "shell", privileged: false, inline: <<-SHELL
(new-object System.Net.WebClient).DownloadFile('https://cygwin.com/setup-x86_64.exe', '/tools/cygwin/cygwinsetup.exe')
$env:PATH="/tools/cygwin/bin;$($env:PATH);/tools/cygwin"
cygwinsetup --root c:/tools/cygwin/ --local-package-dir c:/tools/cygwin/packages/ --no-desktop --no-startmenu --verbose --quiet-mode --download --packages automake,autoconf,gcc-core,libtool,make,python,openssl-devel
cygwinsetup --root c:/tools/cygwin/ --local-package-dir c:/tools/cygwin/packages/ --no-desktop --no-startmenu --verbose --quiet-mode --local-install --packages automake,autoconf,gcc-core,libtool,make,python,openssl-devel
SHELL
end
if ENV['NO_CMAKE'] != "true"
win.vm.provision "shell", privileged: false, inline: <<-SHELL
$env:PATH="/Program Files/CMake/bin;/tools/python2;$($env:PATH)"
cd /vagrant
Remove-Item -Recurse -Force .cmake-vagrant
mkdir -p .cmake-vagrant
cd .cmake-vagrant
cmake -G "Visual Studio 12" ..
$env:CTEST_TEST_TIMEOUT = "1800"
$env:CTEST_OUTPUT_ON_FAILURE = "1"
$env:CTEST_PARALLEL_LEVEL = "10"
cmake --build . --target verify
SHELL
end
if ENV['NO_AUTOTOOLS'] != "true"
win.vm.provision "shell", privileged: false, inline: <<-SHELL
$env:PATH="/tools/cygwin/bin;$($env:PATH)"
bash -lc "echo 'C:/tools/mingw64 /mingw ntfs binary 0 0' > /etc/fstab"
bash -lc "echo 'C:/OpenSSL-Win32 /ssl ntfs binary 0 0' >> /etc/fstab"
bash -lc "echo 'C:/vagrant /vagrant ntfs binary 0 0' >> /etc/fstab"
bash -lc "exec 0</dev/null; exec 2>&1; cd /vagrant; bash -x ./autogen.sh && ./configure LDFLAGS='-L/ssl -L/ssl/lib -L/ssl/lib/MinGW' CFLAGS=-I/ssl/include && make -j20 verify"
SHELL
end
end
end