From 8f133f72b11e866968d5bdbbe69d4260a0fae137 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sun, 22 Jan 2023 17:20:58 +0000 Subject: [PATCH] [VM] use env variables in Vagrantfile This allows configuring the build without having to edit the Vagrantfile [actions skip] --- CHANGES.md | 1 + VirtualBox/vagrant/README.md | 13 +++++++++++++ VirtualBox/vagrant/Vagrantfile | 15 ++++++++++----- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 008f5e84..d74c18ed 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ - CMake: 3.21.3 - fixes documentation - use the VMSVGA graphics controller + - use environment variables in Vagrantfile for easier building - updated versions: - SIRF: v3.4.0 - CIL: a6062410028c9872c5b355be40b96ed1497fed2a > 22.1.0 diff --git a/VirtualBox/vagrant/README.md b/VirtualBox/vagrant/README.md index d8ecca7a..fae0ab15 100644 --- a/VirtualBox/vagrant/README.md +++ b/VirtualBox/vagrant/README.md @@ -14,6 +14,19 @@ vagrant plugin install vagrant-vbguest Make sure there is no other SIRF VM running (as it will mean vagrant aborts due to a port forwarding conflict) +### Set environment variables used in the Vagrantfile +We currently have the following: +- `VB_CPUS` (defaults to 4): number of virtual CPUs used by the VM +- `VB_RAM` (defaults to 6096): system RAM to be used by the VM +- `VB_NAME` (defaults to "SIRF 3.4.0") +- `UPDATE_ARGS` (defaults to "-j `nproc`"): any arguments to be passed to the `UPDATE.sh` script. + +For example in Windows Powershell: +```ps +$Env:UPDATE_ARGS="-t origin/master -j 4" +``` +will make sure we use current `master` (as opposed to the latest release), with a parallel build of max 4 processes. + ### Start the machine ``` diff --git a/VirtualBox/vagrant/Vagrantfile b/VirtualBox/vagrant/Vagrantfile index 4e943eb4..7a3e4c6f 100644 --- a/VirtualBox/vagrant/Vagrantfile +++ b/VirtualBox/vagrant/Vagrantfile @@ -61,9 +61,9 @@ Vagrant.configure("2") do |config| # Display the VirtualBox GUI when booting the machine vb.gui = true - # Customize the amount of memory on the VM: - vb.cpus = "2" - vb.memory = "6096" + # Customize number of processors (default: 4) and the amount of memory on the VM: + vb.cpus = ENV["VB_CPUS"] || "4" + vb.memory = ENV["VB_RAM"] || "6096" vb.customize "pre-boot", [ "storageattach", :id, @@ -74,7 +74,7 @@ Vagrant.configure("2") do |config| "--medium", "emptydrive" ] - vb.name = "SIRF 3.4.0" + vb.name = ENV["VB_NAME"] || "SIRF 3.4.0" vb.customize ["modifyvm", :id, "--clipboard", "bidirectional", '--graphicscontroller', 'vmsvga', @@ -97,6 +97,11 @@ Vagrant.configure("2") do |config| # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. - config.vm.provision "shell", path: "../scripts/bootstrap_ubuntu.sh" + # install packages and build SIRF-SuperBuild + # default is using the latest tag and all processors for the parallel build + config.vm.provision "shell" do |s| + s.path = "../scripts/bootstrap_ubuntu.sh" + s.args = ENV["UPDATE_ARGS"] || "-j `nproc`" + end end