Vagrantfile 3.35 KB
Newer Older
Peter Barker's avatar
Peter Barker committed
1 2 3
# -*- mode: ruby -*-
# vi: set ft=ruby :

Peter Barker's avatar
Peter Barker committed
4 5
# if you update this file, please consider updating .travis.yml too

Peter Barker's avatar
Peter Barker committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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

  # the "dev configuration puts the build products and a suitable
  # environment into the /vagrant directory.  This allows you to run
  # qgroundcontrol on the host machine with:
22
  # "cd shadow-build/release; ./qgroundcontrol-start.sh"
Peter Barker's avatar
Peter Barker committed
23 24 25 26 27

  $config_shell = <<-'SHELL'
     sudo apt-get update -y
     sudo apt-get dist-upgrade -y
     sudo apt-get install -y git build-essential
28
     sudo apt-get install -y espeak libespeak-dev libudev-dev libsdl2-dev
Peter Barker's avatar
Peter Barker committed
29
     sudo apt-get install -y doxygen
Peter Barker's avatar
Peter Barker committed
30 31 32
     sudo apt-get install -y gstreamer1.0* libgstreamer1.0*

     # taken from travis.yml
Peter Barker's avatar
Peter Barker committed
33 34 35 36 37
     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}'
Peter Barker's avatar
Peter Barker committed
38 39
     su - vagrant -c 'rm -rf %{qt_deps_unpack_dir}'
     su - vagrant -c 'mkdir -p %{qt_deps_unpack_parent_dir}'
Peter Barker's avatar
Peter Barker committed
40
     su - vagrant -c 'cd %{project_root_dir}; tar jxf "%{qt_deps_tarball}" -C  %{qt_deps_unpack_parent_dir}'
Peter Barker's avatar
Peter Barker committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
     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'],

Peter Barker's avatar
Peter Barker committed
61
    :project_root_dir => yaml_config['project_root_dir'],
Peter Barker's avatar
Peter Barker committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
    :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