Vagrantfile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. ### Inspired by https://svn.osgeo.org/gdal/trunk/gdal/Vagrantfile
  4. require 'socket'
  5. # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
  6. VAGRANTFILE_API_VERSION = "2"
  7. Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  8. vm_ram = ENV['VAGRANT_VM_RAM'] || 1024
  9. vm_cpu = ENV['VAGRANT_VM_CPU'] || 2
  10. config.vm.box = "trusty64"
  11. config.vm.hostname = "grass-gis-vagrant"
  12. config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
  13. config.vm.define "grass-gis-vagrant" do |host|
  14. config.vm.network :forwarded_port, guest: 80, host: 8080
  15. host.vm.provider :virtualbox do |vb|
  16. vb.customize ["modifyvm", :id, "--memory", vm_ram]
  17. vb.customize ["modifyvm", :id, "--cpus", vm_cpu]
  18. vb.customize ["modifyvm", :id, "--ioapic", "on"]
  19. vb.name = "grass-gis-vagrant"
  20. end
  21. config.ssh.forward_agent = true
  22. config.ssh.forward_x11 = true
  23. ### Define your GRASS data directory to be synce'd on virtual machine
  24. # grassdata_dir = "/opt/grassdata"
  25. # host.vm.synced_folder grassdata_dir, "/home/vagrant/grassdata"
  26. ppaRepos = [
  27. "ppa:ubuntugis/ubuntugis-unstable"
  28. ]
  29. packageList = [
  30. "autoconf2.13",
  31. "autotools-dev",
  32. "make",
  33. "g++",
  34. "gettext",
  35. "flex",
  36. "bison",
  37. "libcairo2-dev",
  38. "libfftw3-dev",
  39. "libfreetype6-dev",
  40. "libgdal-dev",
  41. "libgeos-dev",
  42. "libglu1-mesa-dev",
  43. "libjpeg-dev",
  44. "libpng-dev",
  45. "libtiff-dev",
  46. "libmysqlclient-dev",
  47. "libncurses5-dev",
  48. "libpq-dev",
  49. "libproj-dev",
  50. "proj-bin",
  51. "libreadline-dev",
  52. "libsqlite3-dev",
  53. "libwxgtk2.8-dev",
  54. "libxmu-dev",
  55. "python",
  56. "python-wxgtk2.8",
  57. "python-dev",
  58. "python-numpy",
  59. "python-ply",
  60. "python-pil",
  61. "libnetcdf-dev",
  62. "netcdf-bin",
  63. "libblas-dev",
  64. "liblapack-dev",
  65. "unixodbc-dev",
  66. "zlib1g-dev",
  67. "liblas-c-dev"
  68. ]
  69. unless File.exists?(".no_apt_cache")
  70. cache_dir = "apt-cache/#{config.vm.box}"
  71. FileUtils.mkdir_p(cache_dir) unless Dir.exists?(cache_dir)
  72. host.vm.synced_folder cache_dir, "/var/cache/apt/archives"
  73. end
  74. if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/grass-gis-vagrant/*/id").empty?
  75. pkg_cmd = "sed -i 's#deb http://us.archive.ubuntu.com/ubuntu/#deb mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list; "
  76. pkg_cmd << "apt-get update -qq; apt-get install -q -y python-software-properties; "
  77. if ppaRepos.length > 0
  78. ppaRepos.each { |repo| pkg_cmd << "add-apt-repository -y " << repo << " ; " }
  79. pkg_cmd << "apt-get update -qq; "
  80. end
  81. # install packages we need we need
  82. pkg_cmd << "apt-get install -q -y " + packageList.join(" ") << " ; "
  83. host.vm.provision :shell, :inline => pkg_cmd
  84. scripts = [
  85. "clean.sh",
  86. ];
  87. scripts.each { |script| host.vm.provision :shell, :privileged => false, :path => "tools/vagrant/" << script }
  88. end
  89. scripts = [
  90. "compile.sh",
  91. ];
  92. scripts.each { |script| host.vm.provision :shell, :privileged => false, :path => "tools/vagrant/" << script }
  93. end
  94. end