forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
207 lines (189 loc) · 5.88 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# -*- mode: ruby -*-
# vi: set ft=ruby :
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|
# specify memory size in MiB
vm_ram = ENV['VAGRANT_VM_RAM'] || 4096
vm_cpu = ENV['VAGRANT_VM_CPU'] || 2
vm_ram_bytes = vm_ram * 1024 * 1024
config.vm.hostname = "gdal-vagrant"
config.vm.host_name = "gdal-vagrant"
# proxy configurations.
# these options are also specified by environment variables;
# VAGRANT_HTTP_PROXY, VAGRANT_HTTPS_PROXY, VAGRANT_FTP_PROXY
# VAGRANT_NO_PROXY, VAGRANT_SVN_PROXY, VAGRANT_GIT_PROXY
# if you want to set these on Vagrantfile, edit the following:
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.enabled = false # true|false
#config.proxy.http = "http://192.168.0.2:3128"
#config.proxy.ftp = "http://192.168.0.2:3128"
#config.proxy.https = "DIRECT"
#config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
#config.svn_proxy.http = ""
#config.git_proxy.http = ""
end
config.vm.network :forwarded_port, guest: 80, host: 8080
# See https://bugs.launchpad.net/cloud-images/+bug/1969664
# Ubuntu 22.04 no longer accepts RSA keys, which causes issues with older Vagrant
# The below location has a jammy64 image that accepts RSA keys
config.vm.box_url = "https://people.canonical.com/~jchittum/vagrant-testing/ubuntu-jammy-vagrant-TESTING-20220419.box"
config.vm.box = "ubuntu/jammy64"
config.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 = "gdal-vagrant"
end
#config.vm.provider :lxc do |lxc,ovrd|
# ovrd.vm.box = "cultuurnet/ubuntu-14.04-64-puppet"
# lxc.backingstore = 'dir'
# lxc.customize 'cgroup.memory.limit_in_bytes', vm_ram_bytes
# # LXC 3 or later deprecated old parameter
# lxc.customize 'apparmor.allow_incomplete', 1
# # for LXC 2.1 or before
# #lxc.customize 'aa_allow_incomplete', 1
# lxc.container_name = "gdal-vagrant"
# # allow android adb connection from guest
# #ovrd.vm.synced_folder('/dev/bus', '/dev/bus')
# # allow runnng wine inside lxc
# ovrd.vm.synced_folder('/tmp/.X11-unix/', '/tmp/.X11-unix/')
#end
#config.vm.provider :hyperv do |hyperv,ovrd|
# ovrd.vm.box = "withinboredom/Trusty64"
# ovrd.ssh.username = "vagrant"
# hyperv.cpus = vm_cpu
# hyperv.memory = vm_ram
# # If you want to avoid copying an entire image with
# # differencing disk feature, uncomment a following line.
# # hyperv.differencing_disk = true
# hyperv.vmname = "gdal-vagrant"
#end
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
config.cache.enable :generic, {
"wget" => { cache_dir: "/var/cache/wget" },
}
end
# Unless explicitly declined, use the VM host's file system to cache
# .deb files to avoid repeated downloads on each vagrant up
unless File.exists?("../.no_apt_cache")
cache_dir = "../apt-cache/#{config.vm.box}"
FileUtils.mkdir_p(cache_dir) unless Dir.exists?(cache_dir)
puts "Using local apt cache, #{cache_dir}"
config.vm.synced_folder cache_dir, "/var/cache/apt/archives"
end
ppaRepos = [
]
packageList = [
"build-essential",
"ca-certificates",
"git",
"make",
"ninja-build",
"cmake",
"ccache",
"gdb",
"g++",
"mold",
"bison",
"flex",
"wget",
"curl",
"unzip",
"libtool",
"autoconf",
"automake",
"zlib1g-dev",
"libsqlite3-dev",
"pkg-config",
"sqlite3",
"bash-completion",
"swig",
"ant",
"openjdk-11-jdk",
"mono-mcs",
"mono-runtime",
"libmono-system-drawing4.0-cil",
"python3-dev",
"python3-numpy",
"python3-setuptools",
"python3-pip",
"postgis",
"postgresql",
"postgresql-postgis",
"gpsbabel",
"doxygen",
"libproj-dev",
"proj-data",
"libarchive-dev",
"libcurl4-gnutls-dev",
"libtiff5-dev",
"libopenjp2-7-dev",
"libcairo2-dev",
"libpng-dev",
"libjpeg-dev",
"libgif-dev",
"liblzma-dev",
"libgeos-dev",
"libxml2-dev",
"libexpat-dev",
"libxerces-c-dev",
"libnetcdf-dev",
"libpoppler-dev",
"libpoppler-private-dev",
"libspatialite-dev",
"librasterlite2-dev",
"libhdf4-alt-dev",
"libhdf5-serial-dev",
"libfreexl-dev",
"unixodbc-dev",
"mdbtools-dev",
"libwebp-dev",
"liblcms2-2",
"libpcre3-dev",
"libcrypto++-dev",
"libfyba-dev",
"libkml-dev",
"libmysqlclient-dev",
"libogdi-dev",
"libcfitsio-dev",
"libzstd-dev",
"libpq-dev",
"libssl-dev",
"libboost-dev",
"libarmadillo-dev",
"libopenexr-dev",
"libheif-dev",
"libdeflate-dev",
"libblosc-dev",
"liblz4-dev",
"libbz2-dev",
"libbrotli-dev",
"libqhull-dev",
"libjson-c-dev",
"libtiff5-dev",
];
config.ssh.forward_agent = true
config.ssh.forward_x11 = true
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
pkg_cmd = ""
if ppaRepos.length > 0
ppaRepos.each { |repo| pkg_cmd << "add-apt-repository -y " << repo << " ; " }
end
# install packages we need
pkg_cmd << "apt-get update -qq; "
pkg_cmd << "apt-get --no-install-recommends install -q -y " + packageList.join(" ") << " ; "
# setup environment when we log in
pkg_cmd << "echo 'CCACHE_DIR=/vagrant/ccache_vagrant' >> /etc/environment; "
pkg_cmd << "echo 'cd /vagrant/build_vagrant; source /vagrant/scripts/setdevenv.sh' >> /home/vagrant/.bashrc; "
config.vm.provision :shell, :inline => pkg_cmd
scripts = [
"arrow-parquet.sh",
"postgis.sh",
"gdal.sh",
];
scripts.each { |script| config.vm.provision :shell, :privileged => false, :path => "scripts/vagrant/" << script }
end
end