diff --git a/Formula/eccodes.rb b/Formula/eccodes.rb new file mode 100644 index 0000000000..38f64521c0 --- /dev/null +++ b/Formula/eccodes.rb @@ -0,0 +1,29 @@ +class Eccodes < Formula + desc "Decode and encode messages in the GRIB 1/2 and BUFR 3/4 formats" + homepage "https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home" + url "https://software.ecmwf.int/wiki/download/attachments/45757960/eccodes-2.7.3-Source.tar.gz" + sha256 "6fab143dbb34604bb2e04d10143855c0906b00411c1713fd7ff5c35519b871db" + + depends_on "cmake" => :build + depends_on "gcc" # for gfortran + depends_on "jasper" + depends_on "libpng" + depends_on "numpy" + + conflicts_with "grib-api", :because => "both install /usr/local/include/grib_api.h" + + def install + inreplace "CMakeLists.txt", "find_package( OpenJPEG )", "" + + mkdir "build" do + system "cmake", "..", "-DENABLE_NETCDF=OFF", "-DENABLE_PNG=ON", *std_cmake_args + system "make", "install" + end + 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