196 lines
6.2 KiB
Ruby
196 lines
6.2 KiB
Ruby
class Gdal < Formula
|
|
desc "Geospatial Data Abstraction Library"
|
|
homepage "https://www.gdal.org/"
|
|
url "https://download.osgeo.org/gdal/3.1.2/gdal-3.1.2.tar.xz"
|
|
sha256 "767c8d0dfa20ba3283de05d23a1d1c03a7e805d0ce2936beaff0bb7d11450641"
|
|
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 "dfd3110ca155a7201308c9b40b2d398c79b42343912851150e5a75f77e5d039b" => :catalina
|
|
sha256 "4fee4dc5dd479157b13f22d10920d76499ba0eb090a002f83fa2201faf321bed" => :mojave
|
|
sha256 "bdd41511474301e6eeb8b820668973d4eaab96b08d0f72a959dd4066d80904aa" => :high_sierra
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/OSGeo/gdal.git"
|
|
depends_on "doxygen" => :build
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "cfitsio"
|
|
depends_on "epsilon"
|
|
depends_on "expat"
|
|
depends_on "freexl"
|
|
depends_on "geos"
|
|
depends_on "giflib"
|
|
depends_on "hdf5"
|
|
depends_on "jasper"
|
|
depends_on "jpeg"
|
|
depends_on "json-c"
|
|
depends_on "libdap"
|
|
depends_on "libgeotiff"
|
|
depends_on "libpng"
|
|
depends_on "libpq"
|
|
depends_on "libspatialite"
|
|
depends_on "libtiff"
|
|
depends_on "libxml2"
|
|
depends_on "netcdf"
|
|
depends_on "numpy"
|
|
depends_on "pcre"
|
|
depends_on "poppler"
|
|
depends_on "proj"
|
|
depends_on "python@3.8"
|
|
depends_on "sqlite" # To ensure compatibility with SpatiaLite
|
|
depends_on "unixodbc" # macOS version is not complete enough
|
|
depends_on "webp"
|
|
depends_on "xerces-c"
|
|
depends_on "xz" # get liblzma compression algorithm library from XZutils
|
|
depends_on "zstd"
|
|
|
|
on_linux do
|
|
depends_on "bash-completion"
|
|
end
|
|
|
|
conflicts_with "cpl", because: "both install cpl_error.h"
|
|
|
|
# Fix detection of Poppler version.
|
|
# Remove on next release.
|
|
# https://github.com/OSGeo/gdal/pull/2825
|
|
patch :p2 do
|
|
url "https://github.com/OSGeo/gdal/commit/2b863dbabdc2a7d724f9fdf3e6ff20a142b619f6.patch?full_index=1"
|
|
sha256 "f07af74558040e5a6c84139fdd384df039fbd8f15121d203db39e3bd98b3e433"
|
|
end
|
|
|
|
# Fix build with Jasper.
|
|
# Remove on next release.
|
|
# https://github.com/OSGeo/gdal/issues/2844
|
|
patch :p2 do
|
|
url "https://github.com/OSGeo/gdal/commit/ab72c4893e6d14d488dfed25745d79f11bee45b9.patch?full_index=1"
|
|
sha256 "54e10575646666f31fb2a87b7fc5b2831282fe2fa08642231e94fdee1fee8374"
|
|
end
|
|
|
|
patch :p2 do
|
|
url "https://github.com/OSGeo/gdal/commit/e236eeaed1be45a4af457565085e3db1f2fc489f.patch?full_index=1"
|
|
sha256 "5b582258a556d96712761932bf94dbd3343a7a0ac61bb53c6c83a7ba4c962fe5"
|
|
end
|
|
|
|
def install
|
|
args = [
|
|
# Base configuration
|
|
"--prefix=#{prefix}",
|
|
"--mandir=#{man}",
|
|
"--disable-debug",
|
|
"--with-libtool",
|
|
"--with-local=#{prefix}",
|
|
"--with-opencl",
|
|
"--with-threads",
|
|
|
|
# GDAL native backends
|
|
"--with-bsb",
|
|
"--with-grib",
|
|
"--with-pam",
|
|
"--with-pcidsk=internal",
|
|
"--with-pcraster=internal",
|
|
|
|
# Homebrew backends
|
|
"--with-curl=/usr/bin/curl-config",
|
|
"--with-expat=#{Formula["expat"].prefix}",
|
|
"--with-freexl=#{Formula["freexl"].opt_prefix}",
|
|
"--with-geos=#{Formula["geos"].opt_prefix}/bin/geos-config",
|
|
"--with-geotiff=#{Formula["libgeotiff"].opt_prefix}",
|
|
"--with-gif=#{Formula["giflib"].opt_prefix}",
|
|
"--with-jpeg=#{Formula["jpeg"].opt_prefix}",
|
|
"--with-libjson-c=#{Formula["json-c"].opt_prefix}",
|
|
"--with-libtiff=#{Formula["libtiff"].opt_prefix}",
|
|
"--with-pg=yes",
|
|
"--with-png=#{Formula["libpng"].opt_prefix}",
|
|
"--with-spatialite=#{Formula["libspatialite"].opt_prefix}",
|
|
"--with-sqlite3=#{Formula["sqlite"].opt_prefix}",
|
|
"--with-proj=#{Formula["proj"].opt_prefix}",
|
|
"--with-zstd=#{Formula["zstd"].opt_prefix}",
|
|
"--with-liblzma=yes",
|
|
"--with-cfitsio=#{Formula["cfitsio"].opt_prefix}",
|
|
"--with-hdf5=#{Formula["hdf5"].opt_prefix}",
|
|
"--with-netcdf=#{Formula["netcdf"].opt_prefix}",
|
|
"--with-jasper=#{Formula["jasper"].opt_prefix}",
|
|
"--with-xerces=#{Formula["xerces-c"].opt_prefix}",
|
|
"--with-odbc=#{Formula["unixodbc"].opt_prefix}",
|
|
"--with-dods-root=#{Formula["libdap"].opt_prefix}",
|
|
"--with-epsilon=#{Formula["epsilon"].opt_prefix}",
|
|
"--with-webp=#{Formula["webp"].opt_prefix}",
|
|
"--with-poppler=#{Formula["poppler"].opt_prefix}",
|
|
|
|
# Explicitly disable some features
|
|
"--with-armadillo=no",
|
|
"--with-qhull=no",
|
|
"--without-grass",
|
|
"--without-jpeg12",
|
|
"--without-libgrass",
|
|
"--without-mysql",
|
|
"--without-perl",
|
|
"--without-python",
|
|
|
|
# Unsupported backends are either proprietary or have no compatible version
|
|
# in Homebrew. Podofo is disabled because Poppler provides the same
|
|
# functionality and then some.
|
|
"--without-gta",
|
|
"--without-ogdi",
|
|
"--without-fme",
|
|
"--without-hdf4",
|
|
"--without-openjpeg",
|
|
"--without-fgdb",
|
|
"--without-ecw",
|
|
"--without-kakadu",
|
|
"--without-mrsid",
|
|
"--without-jp2mrsid",
|
|
"--without-mrsid_lidar",
|
|
"--without-msg",
|
|
"--without-oci",
|
|
"--without-ingres",
|
|
"--without-idb",
|
|
"--without-sde",
|
|
"--without-podofo",
|
|
"--without-rasdaman",
|
|
"--without-sosi",
|
|
]
|
|
|
|
# Work around "error: no member named 'signbit' in the global namespace"
|
|
# Remove once support for macOS 10.12 Sierra is dropped
|
|
if DevelopmentTools.clang_build_version >= 900
|
|
ENV.delete "SDKROOT"
|
|
ENV.delete "HOMEBREW_SDKROOT"
|
|
end
|
|
|
|
system "./configure", *args
|
|
system "make"
|
|
system "make", "install"
|
|
|
|
# Build Python bindings
|
|
cd "swig/python" do
|
|
system Formula["python@3.8"].opt_bin/"python3", *Language::Python.setup_install_args(prefix)
|
|
end
|
|
bin.install Dir["swig/python/scripts/*.py"]
|
|
|
|
system "make", "man" if build.head?
|
|
# Force man installation dir: https://trac.osgeo.org/gdal/ticket/5092
|
|
system "make", "install-man", "INST_MAN=#{man}"
|
|
# Clean up any stray doxygen files
|
|
Dir.glob("#{bin}/*.dox") { |p| rm p }
|
|
end
|
|
|
|
test do
|
|
# basic tests to see if third-party dylibs are loading OK
|
|
system "#{bin}/gdalinfo", "--formats"
|
|
system "#{bin}/ogrinfo", "--formats"
|
|
|
|
system Formula["python@3.8"].opt_bin/"python3", "-c", "import gdal"
|
|
end
|
|
end
|