-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Expand file tree
/
Copy pathgdal.rb
More file actions
150 lines (133 loc) 路 4.81 KB
/
Copy pathgdal.rb
File metadata and controls
150 lines (133 loc) 路 4.81 KB
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
class Gdal < Formula
desc "Geospatial Data Abstraction Library"
homepage "https://gdal.org/en/stable/"
url "https://github.com/OSGeo/gdal/releases/download/v3.13.2/gdal-3.13.2.tar.gz"
sha256 "1051c33db1d9e6a05907ac07cd06f5ce8ac0658f317c3229774cc2198a6c1252"
license "MIT"
revision 1
compatibility_version 2
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 arm64_tahoe: "b781e6e07de0a91fbd91cf57023033fc49d894bc039228c1f5866545b82532df"
sha256 arm64_sequoia: "3b19ba5a32026777843e8f6ad3a2808a7e9bc252d1affccef10fa923d72228ca"
sha256 arm64_sonoma: "42faa76611abcf60ff00e177047af79fab3e4b49151157363a636b14c547940e"
sha256 sonoma: "5a92892108bed6cb69da6ea6967a1e94082442029d225d9864ca1332ed265709"
sha256 arm64_linux: "5d09eb255b3c4d8556f770c8d07468baaf7ab9c93104650b937da2461d22044b"
sha256 x86_64_linux: "e9f94c6780a1ebd78c52cc1d03e123bb535c43ca1f7e108f929355b0fba0197f"
end
head do
url "https://github.com/OSGeo/gdal.git", branch: "master"
depends_on "doxygen" => :build
end
depends_on "ant" => :build
depends_on "boost" => :build
depends_on "cmake" => :build
depends_on "pkgconf" => :build
depends_on "python-setuptools" => :build
depends_on "swig" => :build
depends_on "apache-arrow"
depends_on "c-blosc"
depends_on "cfitsio"
depends_on "epsilon"
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.14"
depends_on "qhull"
depends_on "sfcgal"
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 "expat"
on_macos do
depends_on "minizip"
depends_on "uriparser"
end
on_linux do
depends_on "util-linux"
depends_on "zlib-ng-compat"
end
conflicts_with "avce00", because: "both install a cpl_conv.h header"
conflicts_with "cpl", because: "both install cpl_error.h"
def python3
"python3.14"
end
# Work around superenv to avoid mixing `expat` usage in libraries across dependency tree.
# Brew `expat` usage in Python has low impact as it isn't loaded unless pyexpat is used.
# TODO: Consider adding a DSL for this or change how we handle Python's `expat` dependency
def remove_brew_expat
env_vars = %w[CMAKE_PREFIX_PATH HOMEBREW_INCLUDE_PATHS HOMEBREW_LIBRARY_PATHS PATH PKG_CONFIG_PATH]
ENV.remove env_vars, /(^|:)#{Regexp.escape(formula_opt_prefix("expat"))}[^:]*/
ENV.remove "HOMEBREW_DEPENDENCIES", "expat"
end
def install
remove_brew_expat if OS.mac? && MacOS.version < :sequoia
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
-DGDAL_USE_OPENMP=OFF
]
# 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"
# test for zarr blosc compressor
assert_match "BLOSC_COMPRESSORS", shell_output("#{bin}/gdalinfo --format Zarr")
end
end