[GRASS-SVN] r67765 - in grass/trunk: . tools tools/vagrant

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 7 12:46:11 PST 2016


Author: martinl
Date: 2016-02-07 12:46:11 -0800 (Sun, 07 Feb 2016)
New Revision: 67765

Added:
   grass/trunk/Vagrantfile
   grass/trunk/tools/vagrant/
   grass/trunk/tools/vagrant/grass.sh
Modified:
   grass/trunk/
Log:
add experimental Vagrantfile, see https://grasswiki.osgeo.org/wiki/Vagrant


Property changes on: grass/trunk
___________________________________________________________________
Modified: svn:ignore
   - autom4te.cache
dist.*
bin.*
config.log
Makefile-grass_trunk.mk
error.log
grass.pc
config.status*
latex
html
TAGS
doxygen_sqlite3.db

   + autom4te.cache
dist.*
bin.*
config.log
Makefile-grass_trunk.mk
error.log
grass.pc
config.status*
latex
html
TAGS
doxygen_sqlite3.db
.vagrant
apt-cache


Added: grass/trunk/Vagrantfile
===================================================================
--- grass/trunk/Vagrantfile	                        (rev 0)
+++ grass/trunk/Vagrantfile	2016-02-07 20:46:11 UTC (rev 67765)
@@ -0,0 +1,106 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+### Inspired by https://svn.osgeo.org/gdal/trunk/gdal/Vagrantfile
+
+require 'socket'
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  
+  vm_ram = ENV['VAGRANT_VM_RAM'] || 1024
+  vm_cpu = ENV['VAGRANT_VM_CPU'] || 2
+  
+  config.vm.box = "precise64"
+  
+  config.vm.hostname = "grass-gis-vagrant"
+  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
+  config.vm.define "grass-gis-vagrant" do |host|
+    
+    config.vm.network :forwarded_port, guest: 80, host: 8080
+    
+    host.vm.provider :virtualbox do |vb|
+      vb.customize ["modifyvm", :id, "--memory", vm_ram]
+      vb.customize ["modifyvm", :id, "--cpus", vm_cpu]
+      vb.customize ["modifyvm", :id, "--ioapic", "on"]
+      vb.name = "grass-gis-vagrant"
+    end  
+
+    config.ssh.forward_agent = true
+    config.ssh.forward_x11 = true
+    
+    ppaRepos = [
+      "ppa:ubuntugis/ubuntugis-unstable"
+    ]
+    
+    packageList = [
+      "autoconf2.13",
+      "autotools-dev",
+      "make",
+      "g++",
+      "gettext",
+      "flex",
+      "bison",
+      "lesstif2-dev",
+      "libcairo2-dev",
+      "libfftw3-dev",
+      "libfreetype6-dev",
+      "libgdal-dev",
+      "libgeos-dev",
+      "libglu1-mesa-dev",
+      "libjpeg-dev",
+      "libpng-dev",
+      "libtiff-dev",
+      "libmysqlclient-dev",
+      "libncurses5-dev",
+      "libpq-dev",
+      "libproj-dev",
+      "proj-bin",
+      "libreadline-dev",
+      "libsqlite3-dev",
+      "libwxgtk2.8-dev",
+      "libxmu-dev",
+      "python",
+      "python-wxgtk2.8",
+      "python-dev",
+      "python-numpy",
+      "python-ply",
+      #    "python-pil",
+      "libnetcdf-dev",
+      "netcdf-bin",
+      "libblas-dev",
+      "liblapack-dev",
+      "unixodbc-dev",
+      "zlib1g-dev"
+      #    "liblas",
+      #    "liblas-c-dev"
+    ]
+    
+    unless File.exists?(".no_apt_cache")
+      cache_dir = "apt-cache/#{config.vm.box}"
+      FileUtils.mkdir_p(cache_dir) unless Dir.exists?(cache_dir)
+      host.vm.synced_folder cache_dir, "/var/cache/apt/archives"
+    end
+    
+    if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/grass-gis-vagrant/*/id").empty?
+      pkg_cmd = "sed -i 's#deb http://us.archive.ubuntu.com/ubuntu/#deb mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list; "
+      
+      pkg_cmd << "apt-get update -qq; apt-get install -q -y python-software-properties; "
+      
+      if ppaRepos.length > 0
+	ppaRepos.each { |repo| pkg_cmd << "add-apt-repository -y " << repo << " ; " }
+	pkg_cmd << "apt-get update -qq; "
+      end
+      
+      # install packages we need we need
+      pkg_cmd << "apt-get install -q -y " + packageList.join(" ") << " ; "
+      host.vm.provision :shell, :inline => pkg_cmd
+      scripts = [
+        "grass.sh",
+      ];
+      scripts.each { |script| host.vm.provision :shell, :privileged => false, :path => "tools/vagrant/" << script }
+    end
+  end
+end


Property changes on: grass/trunk/Vagrantfile
___________________________________________________________________
Added: svn:mime-type
   + text/x-ruby
Added: svn:eol-style
   + native

Added: grass/trunk/tools/vagrant/grass.sh
===================================================================
--- grass/trunk/tools/vagrant/grass.sh	                        (rev 0)
+++ grass/trunk/tools/vagrant/grass.sh	2016-02-07 20:46:11 UTC (rev 67765)
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+### inspired by https://svn.osgeo.org/gdal/trunk/gdal/scripts/vagrant/gdal.sh
+
+# abort install if any errors occur and enable tracing
+set -o errexit
+set -o xtrace
+
+NUMTHREADS=2
+if [[ -f /sys/devices/system/cpu/online ]]; then
+	# Calculates 1.5 times physical threads
+	NUMTHREADS=$(( ( $(cut -f 2 -d '-' /sys/devices/system/cpu/online) + 1 ) * 15 / 10  ))
+fi
+#NUMTHREADS=1 # disable MP
+export NUMTHREADS
+
+cd /vagrant
+
+if [ -f "include/Make/Platform.make" ] ; then
+    make cleandistdirs
+    make distclean
+fi
+./configure \
+    --bindir=/usr/bin \
+    --srcdir=/vagrant \
+    --prefix=/usr/lib \
+    --enable-socket \
+    --enable-shared \
+    --with-postgres \
+    --with-mysql \
+    --with-cxx \
+    --with-x \
+    --with-gdal \
+    --with-geos \
+    --with-freetype \
+    --with-motif \
+    --with-readline \
+    --with-nls \
+    --with-odbc \
+    --with-netcdf \
+    --with-blas \
+    --with-lapack \
+    --with-sqlite \
+    --enable-largefile \
+    --with-freetype-includes=/usr/include/freetype2 \
+    --with-postgres-includes=`pg_config --includedir` \
+    --with-mysql-includes=`mysql_config --include | sed -e 's/-I//'` \
+    --with-proj-share=/usr/share/proj \
+    --with-wxwidgets=/usr/bin/wx-config \
+    --with-python \
+    --with-cairo
+# --with-liblas=/usr/bin/liblas-config \
+
+make -j $NUMTHREADS
+
+sudo make install
+sudo ldconfig


Property changes on: grass/trunk/tools/vagrant/grass.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/x-sh
Added: svn:eol-style
   + native



More information about the grass-commit mailing list