-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
/
gdal.rb
143 lines (126 loc) · 4.47 KB
/
gdal.rb
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
class Gdal < Formula
desc "Geospatial Data Abstraction Library"
homepage "https://www.gdal.org/"
url "https://github.com/OSGeo/gdal/releases/download/v3.9.3/gdal-3.9.3.tar.gz"
sha256 "f293d8ccc6b98f617db88f8593eae37f7e4b32d49a615b2cba5ced12c7bebdae"
license "MIT"
revision 2
livecheck do
url "https://download.osgeo.org/gdal/CURRENT/"
regex(/href=.*?gdal[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_sequoia: "db062a81a7e5fa66542c736c367e2927cac61d6cea7685c90bcc1bf81519967a"
sha256 arm64_sonoma: "becc1789cea42bffe90a3d08aceefd02d9b22ea8bb36e9fb33990c0ee0fe7808"
sha256 arm64_ventura: "c518fb86e5bf1a6450be3792078ed24a38a4bd328beeb5600a9050bdab59a77e"
sha256 sonoma: "8c635849a913a8e58f8396d905423d490d9eb106ffbe030df11e4e2a2ca85fa8"
sha256 ventura: "b1e34c2c7b5bfbd954e0321a19a784cce01532b035b89e6232411f515c9ad86f"
sha256 x86_64_linux: "e15e54f2a12aaf8d1301dbcb11cbb1fa625b314fd77db1cb035f354a1cc49995"
end
head do
url "https://github.com/OSGeo/gdal.git", branch: "master"
depends_on "doxygen" => :build
end
depends_on "boost" => :build # for `libkml`
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "python-setuptools" => :build
depends_on "swig" => :build
depends_on "apache-arrow"
depends_on "cfitsio"
depends_on "epsilon"
depends_on "expat"
depends_on "freexl"
depends_on "geos"
depends_on "giflib"
depends_on "hdf5"
depends_on "imath"
depends_on "jpeg-turbo"
depends_on "jpeg-xl"
depends_on "json-c"
depends_on "libaec"
depends_on "libarchive"
depends_on "libdeflate"
depends_on "libgeotiff"
depends_on "libheif"
depends_on "libkml"
depends_on "liblerc"
depends_on "libpng"
depends_on "libpq"
depends_on "libspatialite"
depends_on "libtiff"
depends_on "libxml2"
depends_on "lz4"
depends_on "netcdf"
depends_on "numpy"
depends_on "openexr"
depends_on "openjpeg"
depends_on "openssl@3"
depends_on "pcre2"
depends_on "poppler"
depends_on "proj"
depends_on "python@3.12"
depends_on "qhull"
depends_on "sqlite"
depends_on "unixodbc"
depends_on "webp"
depends_on "xerces-c"
depends_on "xz"
depends_on "zstd"
uses_from_macos "curl"
uses_from_macos "zlib"
on_macos do
depends_on "minizip"
depends_on "uriparser"
end
on_linux do
depends_on "util-linux"
end
conflicts_with "avce00", because: "both install a cpl_conv.h header"
conflicts_with "cpl", because: "both install cpl_error.h"
fails_with gcc: "5"
def python3
"python3.12"
end
def install
# Work around an Xcode 15 linker issue which causes linkage against LLVM's
# libunwind due to it being present in a library search path.
if DevelopmentTools.clang_build_version >= 1500
recursive_dependencies
.select { |d| d.name.match?(/^llvm(@\d+)?$/) }
.map { |llvm_dep| llvm_dep.to_formula.opt_lib }
.each { |llvm_lib| ENV.remove "HOMEBREW_LIBRARY_PATHS", llvm_lib }
end
site_packages = prefix/Language::Python.site_packages(python3)
# Work around Homebrew's "prefix scheme" patch which causes non-pip installs
# to incorrectly try to write into HOMEBREW_PREFIX/lib since Python 3.10.
inreplace "swig/python/CMakeLists.txt",
'set(INSTALL_ARGS "--single-version-externally-managed --record=record.txt',
"\\0 --install-lib=#{site_packages} --install-scripts=#{bin}"
osgeo_ext = site_packages/"osgeo"
rpaths = [rpath, rpath(source: osgeo_ext)]
ENV.append "LDFLAGS", "-Wl,#{rpaths.map { |rp| "-rpath,#{rp}" }.join(",")}"
# keep C++ standard in sync with `abseil.rb`
args = %W[
-DENABLE_PAM=ON
-DBUILD_PYTHON_BINDINGS=ON
-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}
-DPython_EXECUTABLE=#{which(python3)}
-DGDAL_PYTHON_INSTALL_LIB=#{site_packages}
-DCMAKE_CXX_STANDARD=17
]
# JavaVM.framework in SDK causing Java bindings to be built
args << "-DBUILD_JAVA_BINDINGS=OFF" if OS.mac? && MacOS.version <= :catalina
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
bash_completion.install (share/"bash-completion/completions").children
end
test do
# basic tests to see if third-party dylibs are loading OK
system bin/"gdalinfo", "--formats"
system bin/"ogrinfo", "--formats"
# Changed Python package name from "gdal" to "osgeo.gdal" in 3.2.0.
system python3, "-c", "import osgeo.gdal"
end
end