Skip to content

Commit

Permalink
[VM] use env variables in Vagrantfile
Browse files Browse the repository at this point in the history
This allows configuring the build without having to edit the Vagrantfile

[actions skip]
  • Loading branch information
KrisThielemans committed Jan 22, 2023
1 parent 7eecf8f commit 8f133f7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions VirtualBox/vagrant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down
15 changes: 10 additions & 5 deletions VirtualBox/vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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',
Expand All @@ -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

0 comments on commit 8f133f7

Please sign in to comment.