Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mruegenberg/8401862a9cf4a8a45dea8e9307ab0dfc to your computer and use it in GitHub Desktop.
Save mruegenberg/8401862a9cf4a8a45dea8e9307ab0dfc to your computer and use it in GitHub Desktop.
rawtoaces Vagrant build for CentOS 7
# -*- mode: ruby -*-
# vi: set ft=ruby :
# note you might sometimes have to do `vagrant provision` multiple times for everything to work.
Vagrant.configure("2") do |config|
# config.vm.box = "bento/centos-7" # also try
config.vm.box = "boxomatic/centos-7"
# set box name
config.vm.define "rawtoacesbuilder"
# need loads of space since its a complex build and building in shared folder doesn't work
config.vm.disk :disk, size: "100GB", primary: true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Note the shared folder might not work reliably. Usually a manual `vagrant plugin install vagrant-vbguest` followed by `vagrant reload` fixes things
config.vagrant.plugins = ["vagrant-vbguest","vagrant-disksize"]
config.vm.synced_folder "./", "/vagrant", type: "virtualbox", disabled: false
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true # needed for Qt to work
vb.memory = "8192"
vb.cpus = 16
end
config.vm.provision "shell",
privileged: true, # run as root
inline: <<-SHELL
yum update -y
yum install --setopt=tsflags=nodocs -y \
blas-devel \
lapack-devel \
eigen3-devel \
gflags-devel \
glog-devel \
suitesparse-devel \
&& ln -s /usr/include/eigen3/Eigen /usr/include/Eigen
# build deps
yum install -y autoconf automake libtool
# Git
sudo yum -y install \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum-config-manager --enable ius-release
sudo yum -y install git236
# Boost
yum -y install boost169 boost169-devel
# Dev tools
yum install -y centos-release-scl scl-utils dnf epel-release
yum-config-manager --enable rhel-server-rhscl-7-rpms
yum install -y devtoolset-11
# Before building deps, we need to enable devtoolset:
scl enable devtoolset-11 $SHELL
# Also just enable by default
echo "source /opt/rh/devtoolset-11/enable" >> /etc/bashrc
# CMake
# note: do not try a parallel build (-j 8) as it tends to just break in the middle
wget https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz
tar xzvf cmake-3.25.1.tar.gz
cd cmake-3.25.1
./bootstrap # or ./configure
make
sudo make install
cd /tmp
rm -r aces_container
git clone https://github.com/ampas/aces_container.git \
&& mkdir aces_container/build && cd aces_container/build \
&& cmake .. && make -j 4 && make install
# ceres-solver
# Compiling "ceres-solver" requires a significant amount of memory, well over
# the 2Go that Docker allocates by default, thus you will need to increase the
# memory in Docker preferences: Preferences --> Resources --> Advanced, 8Go
# should be enough.
cd /tmp
rm -r ceres-solver-1.14.0
curl -O http://ceres-solver.org/ceres-solver-1.14.0.tar.gz \
&& tar zxf ceres-solver-1.14.0.tar.gz \
&& mkdir ceres-solver-1.14.0/build && cd ceres-solver-1.14.0/build \
&& cmake .. && make -j 4 && make install
git config --global advice.detachedHead false
# libraw
cd /tmp
rm -r cd LibRaw
git clone https://github.com/LibRaw/LibRaw.git \
&& cd LibRaw && git checkout 0.21.1 \
&& autoreconf --install \
&& ./configure && make -j 4 && make install
# imath
cd /tmp
wget https://github.com/AcademySoftwareFoundation/Imath/releases/download/v3.1.11/Imath-3.1.11.tar.gz
tar xzvf Imath-*.tar.gz
cd Imath-3.1.11
mkdir -p build
cd build
cmake ..
cmake --build . --target install --config Release
SHELL
config.vm.provision "shell",
privileged: true, # run as root
run: 'always',
inline: <<-SHELL
rm -r /home/aswf/rawtoaces
mkdir -p /home/aswf
cd /home/aswf
git clone https://github.com/AcademySoftwareFoundation/rawtoaces
cd /home/aswf/rawtoaces
mkdir -p build && cd build \
&& cmake -DBoost_INCLUDE_DIR=/usr/include/boost169 -DBoost_LIBRARY_DIR=/usr/lib64/boost169 .. && make -j 8
# && make install
# TODO: set a common CMAKE_INSTALL_PREFIX and put libraw, imath, ceres and aces-container into a single location so that you can move the build and installation out of this
# alternatively check if there's a way to create a static build/single big binary without dependencies
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment