Vagrantfile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. ### Inspired by https://github.com/OSGeo/gdal/blob/master/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'] || 1
  10. config.vm.box = "bionic64"
  11. config.vm.hostname = "grass-gis-vagrant"
  12. config.vm.box_url = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64-vagrant.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. "libwxgtk3.0-gtk3-dev",
  54. "libxmu-dev",
  55. "python3",
  56. "python3-wxgtk4.0",
  57. "python3-dateutil",
  58. "python3-dev",
  59. "python3-numpy",
  60. "python3-ply",
  61. "python3-pil",
  62. "python3-six",
  63. "libnetcdf-dev",
  64. "netcdf-bin",
  65. "libblas-dev",
  66. "liblapack-dev",
  67. "unixodbc-dev",
  68. "zlib1g-dev",
  69. "liblas-c-dev"
  70. ]
  71. unless File.exists?(".no_apt_cache")
  72. cache_dir = "apt-cache/#{config.vm.box}"
  73. FileUtils.mkdir_p(cache_dir) unless Dir.exists?(cache_dir)
  74. host.vm.synced_folder cache_dir, "/var/cache/apt/archives"
  75. end
  76. if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/grass-gis-vagrant/*/id").empty?
  77. pkg_cmd = "sed -i 's#deb http://archive.ubuntu.com/ubuntu#deb mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list; "
  78. pkg_cmd << "apt-get update -qq; apt-get install -q -y python-software-properties; "
  79. if ppaRepos.length > 0
  80. ppaRepos.each { |repo| pkg_cmd << "add-apt-repository -y " << repo << " ; " }
  81. pkg_cmd << "apt-get update -qq; "
  82. end
  83. # install packages we need we need
  84. pkg_cmd << "apt-get install -q -y " + packageList.join(" ") << " ; "
  85. host.vm.provision :shell, :inline => pkg_cmd
  86. scripts = [
  87. "clean.sh",
  88. ];
  89. scripts.each { |script| host.vm.provision :shell, :privileged => false, :path => "utils/vagrant/" << script }
  90. end
  91. scripts = [
  92. "compile.sh",
  93. ];
  94. scripts.each { |script| host.vm.provision :shell, :privileged => false, :path => "utils/vagrant/" << script }
  95. end
  96. end