class Openjpeg < Formula desc "Library for JPEG-2000 image manipulation" homepage "https://www.openjpeg.org/" url "https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.3.tar.gz" sha256 "368fe0468228e767433c9ebdea82ad9d801a3ad1e4234421f352c8b06e7aa707" license "BSD-2-Clause" head "https://github.com/uclouvain/openjpeg.git", branch: "master" depends_on "cmake" => :build depends_on "doxygen" => :build depends_on "libpng" depends_on "libtiff" depends_on "little-cms2" def install system "cmake", "-S", ".", "-B", "build", *std_cmake_args, "-DCMAKE_INSTALL_RPATH=#{rpath}", "-DBUILD_DOC=ON" system "cmake", "--build", "build" system "cmake", "--install", "build" end test do (testpath/"test.c").write <<~C #include int main () { opj_image_cmptparm_t cmptparm; const OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_GRAY; opj_image_t *image; image = opj_image_create(1, &cmptparm, color_space); opj_image_destroy(image); return 0; } C system ENV.cc, "-I#{include.children.first}", testpath/"test.c", "-L#{lib}", "-lopenjp2", "-o", "test" system "./test" end end