-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
/
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.10.0/gdal-3.10.0.tar.gz"
sha256 "946ef444489bedbc1b04bd4c115d67ae8d3f3e4a5798d5a2f1cb2a11014105b2"
license "MIT"
revision 1
livecheck do
url "https://download.osgeo.org/gdal/CURRENT/"
regex(/href=.*?gdal[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_sequoia: "54aea694c1e1ba1c96ac4fd949d41387610e027144b521e126ee939ff71a5168"
sha256 arm64_sonoma: "56bd79100e84c0edc8db1a0fadaafb3952b8128d2655f8273ee05de09e9c5933"
sha256 arm64_ventura: "1b67abc3493575365ae867cc4884c15be2b457999260e378d0766db4840a9db8"
sha256 sonoma: "8a86f6e489a1989a881809d230ed32359310eaa7c84282feb36fec00877b5896"
sha256 ventura: "a207082e25441b7b434e494dd7fcd7d8a2a2be2f962c5815d1e100865aee86a1"
sha256 x86_64_linux: "f9c0d060c170745d0a0c0af44b8ce0ef1d45ff0abc72076a31f3d7384f01add5"
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