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.23.0.orig.tar.xz" mirror "https://mirrorservice.org/sites/ftp.debian.org/debian/pool/main/g/grib-api/grib-api_1.23.0.orig.tar.xz" sha256 "eeb908248f974daa8cc6224325c9938aca63f99b4e3c9366f4c34e3d179e2772" bottle do sha256 "b1c5055a8aef9ed5fd02b0b76c002764c467c5ceb93eaabef8f9006d3795e4da" => :sierra sha256 "1c9d5d4d2ac4d26cd79859b60ec02d4f5035274a7b6ca2b5532a403302557f88" => :el_capitan sha256 "721aa099efcf22f0c442b69a2c29dccf67c1a30497ddbeac10fa3af409c1d678" => :yosemite end option "with-static", "Build static instead of shared library." depends_on "cmake" => :build depends_on "numpy" depends_on "jasper" => :recommended depends_on "libpng" => :optional depends_on :fortran 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