Skip to content

Commit

Permalink
Vagrant: add vagrant file
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker authored and billbonney committed Jul 2, 2017
1 parent 8e9956c commit fe24a25
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .vagrantconfig.yml
@@ -0,0 +1,23 @@
configs:
dev:
'qt_deps_tarball': 'Qt5.5.1-linux-min.tar.bz2'
'qt_deps_unpack_parent_dir': '/tmp'

'qt_deps_unpack_dir': '/tmp/Qt'
'qt_deps_bin_unpack_dir': '/tmp/Qt/5.5/gcc_64/bin'
'qt_deps_lib_unpack_dir': '/tmp/Qt/5.5/gcc_64/lib'
'qt_deps_plugins_unpack_dir': '/tmp/Qt/5.5/gcc_64/plugins'
'qt_deps_qml_unpack_dir': '/tmp/Qt/5.5/gcc_64/qml'

'project_root_dir': '/vagrant'

'qt_deps_dir': '/vagrant/shadow-build/release/Qt'
'qt_deps_bin_dir': '/vagrant/shadow-build/release/Qt/bin'
'qt_deps_lib_dir': '/vagrant/shadow-build/release/Qt/libs'
'qt_deps_plugins_dir': '/vagrant/shadow-build/release/Qt/plugins'
'qt_deps_qml_dir': '/vagrant/shadow-build/release/Qt/qml'

'spec': 'linux-g++-64'
'shadow_build_dir': '/vagrant/shadow-build'
'pro': '/vagrant/apm_planner.pro'
'deps_url': 'http://firmware.ardupilot.org/Tools/APMPlanner/support_files/Qt5.5.1-linux-min.tar.bz2'
71 changes: 71 additions & 0 deletions Vagrantfile
@@ -0,0 +1,71 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# if you update this file, please consider updating .travis.yml too

require 'yaml'

current_dir = File.dirname(File.expand_path(__FILE__))
configfile = YAML.load_file("#{current_dir}/.vagrantconfig.yml")
yaml_config = configfile['configs']['dev']

Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.customize ["modifyvm", :id, "--cpus", "1"]
end

$config_shell = <<-'SHELL'
sudo apt-get update -y
sudo apt-get dist-upgrade -y
sudo apt-get install -y ccache wget git build-essential
sudo apt-get install -y flite1-dev libsdl2-dev libsdl1.2-dev libsndfile-dev libssl-dev libudev-dev
# taken from travis.yml
echo 'Initialising submodules'
su - vagrant -c 'cd %{project_root_dir}; git submodule init && git submodule update'
echo 'Saving %{qt_deps_tarball} from %{deps_url} to %{project_root_dir}'
su - vagrant -c 'wget --continue -q %{deps_url} -P %{project_root_dir}'
su - vagrant -c 'rm -rf %{qt_deps_unpack_dir}'
su - vagrant -c 'mkdir -p %{qt_deps_unpack_parent_dir}'
su - vagrant -c 'cd %{project_root_dir}; tar jxf "%{qt_deps_tarball}" -C %{qt_deps_unpack_parent_dir}'
su - vagrant -c 'rm -rf %{shadow_build_dir}'
su - vagrant -c 'mkdir -p %{shadow_build_dir}'
su - vagrant -c "cd %{shadow_build_dir}; LD_LIBRARY_PATH=%{qt_deps_lib_unpack_dir} PATH=%{qt_deps_bin_unpack_dir}:\$PATH qmake -r %{pro} -spec %{spec}"
su - vagrant -c "cd %{shadow_build_dir}; LD_LIBRARY_PATH=%{qt_deps_lib_unpack_dir} PATH=%{qt_deps_bin_unpack_dir}:\$PATH make -j4"
su - vagrant -c 'mkdir -p %{qt_deps_dir}'
su - vagrant -c 'cp -a %{qt_deps_bin_unpack_dir} %{qt_deps_bin_dir}'
su - vagrant -c 'cp -a %{qt_deps_lib_unpack_dir} %{qt_deps_lib_dir}'
su - vagrant -c 'cp -a %{qt_deps_plugins_unpack_dir} %{qt_deps_plugins_dir}'
su - vagrant -c 'cp -a %{qt_deps_qml_unpack_dir} %{qt_deps_qml_dir}'
SHELL

config.vm.provision "dev", type: "shell", inline: $config_shell % {
:shadow_build_dir => yaml_config['shadow_build_dir'],
:qt_deps_tarball => yaml_config['qt_deps_tarball'],
:pro => yaml_config['pro'],
:spec => yaml_config['spec'],
:deps_url => yaml_config['deps_url'],

:project_root_dir => yaml_config['project_root_dir'],
:qt_deps_unpack_parent_dir => yaml_config['qt_deps_unpack_parent_dir'],
:qt_deps_unpack_dir => yaml_config['qt_deps_unpack_dir'],
:qt_deps_bin_unpack_dir => yaml_config['qt_deps_bin_unpack_dir'],
:qt_deps_lib_unpack_dir => yaml_config['qt_deps_lib_unpack_dir'],
:qt_deps_plugins_unpack_dir => yaml_config['qt_deps_plugins_unpack_dir'],
:qt_deps_qml_unpack_dir => yaml_config['qt_deps_qml_unpack_dir'],

:qt_deps_dir => yaml_config['qt_deps_dir'],
:qt_deps_bin_dir => yaml_config['qt_deps_bin_dir'],
:qt_deps_lib_dir => yaml_config['qt_deps_lib_dir'],
:qt_deps_plugins_dir => yaml_config['qt_deps_plugins_dir'],
:qt_deps_qml_dir => yaml_config['qt_deps_qml_dir'],
}


end

0 comments on commit fe24a25

Please sign in to comment.