homebrew-core/Formula/eccodes.rb

50 lines
2.0 KiB
Ruby

class Eccodes < Formula
desc "Decode and encode messages in the GRIB 1/2 and BUFR 3/4 formats"
homepage "https://confluence.ecmwf.int/display/ECC"
url "https://software.ecmwf.int/wiki/download/attachments/45757960/eccodes-2.19.0-Source.tar.gz"
sha256 "a1d080aed1b17a9d4e3aecccc5a328c057830cd4d54f451f5498b80b24c46404"
license "Apache-2.0"
livecheck do
url "https://software.ecmwf.int/wiki/display/ECC/Releases"
regex(/href=.*?eccodes[._-]v?(\d+(?:\.\d+)+)-Source\.t/i)
end
bottle do
sha256 "c0c829bba23f63746d90bf272bc6d76a00bea9242ae51a11c7c30c000125a0c1" => :catalina
sha256 "5bbb366ed000e7a66bf97a17f94037c20bdd89b6b4a9927860a940abf6b5852a" => :mojave
sha256 "5e16d1a7cc800bdefa75767c57a67f6056b528033ee6c74ee1dbf016f58dcadf" => :high_sierra
end
depends_on "cmake" => :build
depends_on "gcc" # for gfortran
depends_on "jasper"
depends_on "libpng"
depends_on "netcdf"
def install
# Fix for GCC 10, remove with next version
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=957159
ENV.prepend "FFLAGS", "-fallow-argument-mismatch"
inreplace "CMakeLists.txt", "find_package( OpenJPEG )", ""
mkdir "build" do
system "cmake", "..", "-DENABLE_NETCDF=ON", "-DENABLE_PNG=ON",
"-DENABLE_PYTHON=OFF", *std_cmake_args
system "make", "install"
end
# Avoid references to Homebrew shims directory
inreplace include/"eccodes_ecbuild_config.h", HOMEBREW_LIBRARY/"Homebrew/shims/mac/super/clang", "/usr/bin/clang"
inreplace lib/"pkgconfig/eccodes.pc", HOMEBREW_LIBRARY/"Homebrew/shims/mac/super/clang", "/usr/bin/clang"
inreplace lib/"pkgconfig/eccodes_f90.pc", HOMEBREW_LIBRARY/"Homebrew/shims/mac/super/clang", "/usr/bin/clang"
end
test do
grib_samples_path = shell_output("#{bin}/codes_info -s").strip
assert_match "packingType", shell_output("#{bin}/grib_ls #{grib_samples_path}/GRIB1.tmpl")
assert_match "gridType", shell_output("#{bin}/grib_ls #{grib_samples_path}/GRIB2.tmpl")
end
end