blob: 3bcc46a96d7d612cb60d8309365d1aa37a0a6d19 [file] [log] [blame]
Roger Meier14ff9c82013-05-30 14:11:45 +02001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
Carl Yeksigian1ed79912013-06-03 18:29:31 -04004#
5# Licensed to the Apache Software Foundation (ASF) under one
6# or more contributor license agreements. See the NOTICE file
7# distributed with this work for additional information
8# regarding copyright ownership. The ASF licenses this file
9# to you under the Apache License, Version 2.0 (the
10# "License"); you may not use this file except in compliance
11# with the License. You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing,
16# software distributed under the License is distributed on an
17# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18# KIND, either express or implied. See the License for the
19# specific language governing permissions and limitations
20# under the License.
21#
22
jfarrell9dbea362013-08-17 18:35:13 -040023$build_and_test = <<SCRIPT
24echo "Provisioning system to compile and test Apache Thrift."
jfarrell3e41ece2014-07-09 23:35:54 -040025
26# Create swap space
27sudo fallocate -l 2G /swapfile
28sudo chmod 600 /swapfile
29sudo mkswap /swapfile
30sudo swapon /swapfile
31sudo swapon -s
32
33# Update the system
34sudo DEBIAN_FRONTEND=noninteractive apt-get update -qq -y
35sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -qq -y
jfarrell9dbea362013-08-17 18:35:13 -040036
37# Install Dependencies
38# ---
39# General dependencies
jfarrell2c7eb9e2014-10-08 23:15:20 -040040sudo apt-get install -qq automake libtool flex bison pkg-config g++ libssl-dev make libqt4-dev git debhelper
41
42# C++ dependencies
43sudo apt-get install -qq libboost-dev libboost-test-dev libboost-program-options-dev libboost-filesystem-dev libboost-system-dev libevent-dev
jfarrell9dbea362013-08-17 18:35:13 -040044
45# Java dependencies
jfarrell2c7eb9e2014-10-08 23:15:20 -040046sudo apt-get install -qq ant openjdk-7-jdk maven
jfarrell9dbea362013-08-17 18:35:13 -040047
48# Python dependencies
Nobuaki Sukegawaa185d7e2015-11-06 21:24:24 +090049sudo apt-get install -qq python-all python-all-dev python-all-dbg python-setuptools python-support python-six python3-six
jfarrell9dbea362013-08-17 18:35:13 -040050
51# Ruby dependencies
jfarrell3e41ece2014-07-09 23:35:54 -040052sudo apt-get install -qq ruby ruby-dev
jfarrell9dbea362013-08-17 18:35:13 -040053sudo gem install bundler rake
54
55# Perl dependencies
Roger Meieraae8acb2014-01-15 13:55:09 +010056sudo apt-get install -qq libbit-vector-perl libclass-accessor-class-perl
jfarrell9dbea362013-08-17 18:35:13 -040057
58# Php dependencies
jfarrell3e41ece2014-07-09 23:35:54 -040059sudo apt-get install -qq php5 php5-dev php5-cli php-pear re2c
jfarrell9dbea362013-08-17 18:35:13 -040060
61# GlibC dependencies
Roger Meier14ff9c82013-05-30 14:11:45 +020062sudo apt-get install -qq libglib2.0-dev
jfarrell9dbea362013-08-17 18:35:13 -040063
64# Erlang dependencies
alisdair sullivana559f8d2014-11-17 20:28:35 -080065sudo apt-get install -qq erlang-base erlang-eunit erlang-dev erlang-tools
jfarrell9dbea362013-08-17 18:35:13 -040066
67# GO dependencies
68echo "golang-go golang-go/dashboard boolean false" | debconf-set-selections
69sudo apt-get -y install -qq golang golang-go
70
71# Haskell dependencies
jfarrell3e41ece2014-07-09 23:35:54 -040072sudo apt-get install -qq ghc cabal-install libghc-binary-dev libghc-network-dev libghc-http-dev libghc-hashable-dev libghc-unordered-containers-dev libghc-vector-dev
jfarrell30a472e2014-07-10 18:42:30 -040073sudo cabal update
jfarrell3e41ece2014-07-09 23:35:54 -040074
75# Lua dependencies
76sudo apt-get install -qq lua5.2 lua5.2-dev
jfarrell9dbea362013-08-17 18:35:13 -040077
78# Node.js dependencies
jfarrell2c7eb9e2014-10-08 23:15:20 -040079sudo apt-get install -qq nodejs nodejs-dev nodejs-legacy npm
jfarrell9dbea362013-08-17 18:35:13 -040080
81# CSharp
jfarrellb5fd8162014-10-29 23:19:23 -040082sudo apt-get install -qq mono-gmcs mono-devel mono-xbuild mono-complete libmono-system-web2.0-cil
Roger Meier87202602014-08-15 22:16:02 +020083sudo apt-get install -qq mingw32 mingw32-binutils mingw32-runtime nsis
jfarrell9753cde2013-06-21 14:53:39 -050084
jfarrell2c7eb9e2014-10-08 23:15:20 -040085# D dependencies
86sudo wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list
87sudo apt-get update && sudo apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring && sudo apt-get update
88sudo apt-get install -qq xdg-utils dmd-bin
89
jfarrell9dbea362013-08-17 18:35:13 -040090# Customize the system
91# ---
92# Default java to latest 1.7 version
93update-java-alternatives -s java-1.7.0-openjdk-amd64
94
jfarrell9753cde2013-06-21 14:53:39 -050095# PHPUnit package broken in ubuntu. see https://bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544
96sudo apt-get upgrade pear
97sudo pear channel-discover pear.phpunit.de
98sudo pear channel-discover pear.symfony.com
99sudo pear channel-discover components.ez.no
100sudo pear update-channels
101sudo pear upgrade-all
102sudo pear install --alldeps phpunit/PHPUnit
103
jfarrell9dbea362013-08-17 18:35:13 -0400104date > /etc/vagrant.provisioned
105
106# Start the source build
107# ---
108echo "Starting Apache Thrift build..."
Carl Yeksigian1ed79912013-06-03 18:29:31 -0400109cd /thrift
Roger Meier14ff9c82013-05-30 14:11:45 +0200110sh bootstrap.sh
Jens Geyer6d15c302014-10-02 10:03:09 +0200111sh configure
Roger Meier14ff9c82013-05-30 14:11:45 +0200112make
Roger Meier14ff9c82013-05-30 14:11:45 +0200113make check
jfarrell9dbea362013-08-17 18:35:13 -0400114echo "Finished building Apache Thrift."
115
Roger Meier14ff9c82013-05-30 14:11:45 +0200116SCRIPT
117
118Vagrant.configure("2") do |config|
jfarrell3e41ece2014-07-09 23:35:54 -0400119 # Ubuntu 14.04 LTS (Trusty Tahr)
120 config.vm.box = "trusty64"
121 config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
Roger Meier14ff9c82013-05-30 14:11:45 +0200122
Carl Yeksigian1ed79912013-06-03 18:29:31 -0400123 config.vm.synced_folder "../", "/thrift"
124
jfarrellb6f23e82013-06-21 13:36:18 -0500125 config.vm.provider :virtualbox do |vbox|
126 vbox.customize ["modifyvm", :id, "--memory", "1024"]
127 vbox.customize ["modifyvm", :id, "--cpus", "2"]
jfarrell2c7eb9e2014-10-08 23:15:20 -0400128 vbox.customize ["modifyvm", :id, "--rtcuseutc", "on"]
jfarrellb6f23e82013-06-21 13:36:18 -0500129 end
130
jfarrell2c7eb9e2014-10-08 23:15:20 -0400131 # Run the build script to configure the system
jfarrell9dbea362013-08-17 18:35:13 -0400132 config.vm.provision :shell, :inline => $build_and_test
Roger Meier14ff9c82013-05-30 14:11:45 +0200133end