blob: 67e56225d420c64f0d86b9f2f9796b590e93905e [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
jfarrell2fa3df32013-08-18 11:20:53 -040040sudo apt-get install -qq libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev make libqt4-dev git debhelper
jfarrell9dbea362013-08-17 18:35:13 -040041
42# Java dependencies
Roger Meier3da1c902013-11-16 15:37:20 +010043sudo apt-get install -qq ant openjdk-7-jdk
jfarrell9dbea362013-08-17 18:35:13 -040044
45# Python dependencies
jfarrell3e41ece2014-07-09 23:35:54 -040046sudo apt-get install -qq python-all python-all-dev python-all-dbg python-setuptools python-support
jfarrell9dbea362013-08-17 18:35:13 -040047
48# Ruby dependencies
jfarrell3e41ece2014-07-09 23:35:54 -040049sudo apt-get install -qq ruby ruby-dev
jfarrell9dbea362013-08-17 18:35:13 -040050sudo gem install bundler rake
51
52# Perl dependencies
Roger Meieraae8acb2014-01-15 13:55:09 +010053sudo apt-get install -qq libbit-vector-perl libclass-accessor-class-perl
jfarrell9dbea362013-08-17 18:35:13 -040054
55# Php dependencies
jfarrell3e41ece2014-07-09 23:35:54 -040056sudo apt-get install -qq php5 php5-dev php5-cli php-pear re2c
jfarrell9dbea362013-08-17 18:35:13 -040057
58# GlibC dependencies
Roger Meier14ff9c82013-05-30 14:11:45 +020059sudo apt-get install -qq libglib2.0-dev
jfarrell9dbea362013-08-17 18:35:13 -040060
61# Erlang dependencies
62sudo apt-get install -qq erlang-base erlang-eunit erlang-dev
63
64# GO dependencies
65echo "golang-go golang-go/dashboard boolean false" | debconf-set-selections
66sudo apt-get -y install -qq golang golang-go
67
68# Haskell dependencies
jfarrell3e41ece2014-07-09 23:35:54 -040069sudo 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 -040070sudo cabal update
jfarrell3e41ece2014-07-09 23:35:54 -040071
72# Lua dependencies
73sudo apt-get install -qq lua5.2 lua5.2-dev
jfarrell9dbea362013-08-17 18:35:13 -040074
75# Node.js dependencies
jfarrell3e41ece2014-07-09 23:35:54 -040076sudo apt-get install -qq nodejs nodejs-dev npm
77sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
jfarrell9dbea362013-08-17 18:35:13 -040078
79# CSharp
Roger Meier14ff9c82013-05-30 14:11:45 +020080sudo apt-get install -qq mono-gmcs mono-devel libmono-system-web2.0-cil
Roger Meier87202602014-08-15 22:16:02 +020081sudo apt-get install -qq mingw32 mingw32-binutils mingw32-runtime nsis
jfarrell9753cde2013-06-21 14:53:39 -050082
jfarrell9dbea362013-08-17 18:35:13 -040083# Customize the system
84# ---
85# Default java to latest 1.7 version
86update-java-alternatives -s java-1.7.0-openjdk-amd64
87
jfarrell9753cde2013-06-21 14:53:39 -050088# PHPUnit package broken in ubuntu. see https://bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544
89sudo apt-get upgrade pear
90sudo pear channel-discover pear.phpunit.de
91sudo pear channel-discover pear.symfony.com
92sudo pear channel-discover components.ez.no
93sudo pear update-channels
94sudo pear upgrade-all
95sudo pear install --alldeps phpunit/PHPUnit
96
jfarrell9dbea362013-08-17 18:35:13 -040097date > /etc/vagrant.provisioned
98
99# Start the source build
100# ---
101echo "Starting Apache Thrift build..."
Carl Yeksigian1ed79912013-06-03 18:29:31 -0400102cd /thrift
Roger Meier14ff9c82013-05-30 14:11:45 +0200103sh bootstrap.sh
Jens Geyer6d15c302014-10-02 10:03:09 +0200104sh configure
Roger Meier14ff9c82013-05-30 14:11:45 +0200105make
Roger Meier14ff9c82013-05-30 14:11:45 +0200106make check
jfarrell9dbea362013-08-17 18:35:13 -0400107echo "Finished building Apache Thrift."
108
Roger Meier14ff9c82013-05-30 14:11:45 +0200109SCRIPT
110
111Vagrant.configure("2") do |config|
jfarrell3e41ece2014-07-09 23:35:54 -0400112 # Ubuntu 14.04 LTS (Trusty Tahr)
113 config.vm.box = "trusty64"
114 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 +0200115
Carl Yeksigian1ed79912013-06-03 18:29:31 -0400116 config.vm.synced_folder "../", "/thrift"
117
jfarrellb6f23e82013-06-21 13:36:18 -0500118 config.vm.provider :virtualbox do |vbox|
119 vbox.customize ["modifyvm", :id, "--memory", "1024"]
120 vbox.customize ["modifyvm", :id, "--cpus", "2"]
121 end
122
Roger Meier14ff9c82013-05-30 14:11:45 +0200123 # call the script
jfarrell9dbea362013-08-17 18:35:13 -0400124 config.vm.provision :shell, :inline => $build_and_test
125
Roger Meier14ff9c82013-05-30 14:11:45 +0200126end