homebrew-core/Formula/grib-api.rb
2018-01-06 03:33:07 -08:00

47 lines
1.7 KiB
Ruby

class GribApi < Formula
desc "Encode and decode grib messages (editions 1 and 2)"
homepage "https://software.ecmwf.int/wiki/display/GRIB/Home"
url "https://mirrors.ocf.berkeley.edu/debian/pool/main/g/grib-api/grib-api_1.25.0.orig.tar.xz"
mirror "https://mirrorservice.org/sites/ftp.debian.org/debian/pool/main/g/grib-api/grib-api_1.25.0.orig.tar.xz"
sha256 "da405e35f90e441326835f1f7fa788b365604bb925919c90ce21f4618b86e78f"
bottle do
sha256 "bf8b35820e6db50ca17785a07d5a9ffc0a555dc43e0f81b553312a9e9c5a2b3c" => :high_sierra
sha256 "63d5fbee47c4d0407aaed221feed1ad3401fce53e95a4f31ddd0ef8b667ebf38" => :sierra
sha256 "32dc30952cbc7ab991b214c6d06280cacfffa1bd63f70004ea56cc79123749e9" => :el_capitan
end
option "with-static", "Build static instead of shared library."
depends_on "cmake" => :build
depends_on "gcc" # for gfortran
depends_on "numpy"
depends_on "jasper" => :recommended
depends_on "libpng" => :optional
def install
# Fix "no member named 'inmem_' in 'jas_image_t'"
inreplace "src/grib_jasper_encoding.c", "image.inmem_ = 1;", ""
inreplace "CMakeLists.txt", "find_package( OpenJPEG )", ""
mkdir "build" do
args = std_cmake_args
args << "-DBUILD_SHARED_LIBS=OFF" if build.with? "static"
if build.with? "libpng"
args << "-DPNG_PNG_INCLUDE_DIR=#{Formula["libpng"].opt_include}"
args << "-DENABLE_PNG=ON"
end
system "cmake", "..", "-DENABLE_NETCDF=OFF", *args
system "make", "install"
end
end
test do
grib_samples_path = shell_output("#{bin}/grib_info -t").strip
system bin/"grib_ls", "#{grib_samples_path}/GRIB1.tmpl"
system bin/"grib_ls", "#{grib_samples_path}/GRIB2.tmpl"
end
end