homebrew-core/Formula/libheif.rb

54 lines
1.9 KiB
Ruby

class Libheif < Formula
desc "ISO/IEC 23008-12:2017 HEIF file format decoder and encoder"
homepage "https://www.libde265.org/"
url "https://github.com/strukturag/libheif/releases/download/v1.11.0/libheif-1.11.0.tar.gz"
sha256 "c550938f56ff6dac83702251a143f87cb3a6c71a50d8723955290832d9960913"
license "LGPL-3.0-only"
revision 2
bottle do
sha256 cellar: :any, arm64_big_sur: "6fb1565de0cf3f02dacaf0c1ca8631132900ecd2fb6511d0e1286f854e7368f9"
sha256 cellar: :any, big_sur: "aa29ab6b7ac495382a53400b355cc421c221f8f4aaff2a48ba2ee3a8432278be"
sha256 cellar: :any, catalina: "04efc496cd625e79e884d7207f406bfdb06d60a5b5c347689d98b346e5bc896a"
sha256 cellar: :any, mojave: "46dcec99a6e08a2bf6bafafe61619074c2db05be724aade8f335e808b2c9b346"
end
depends_on "pkg-config" => :build
depends_on "aom"
depends_on "jpeg"
depends_on "libde265"
depends_on "libpng"
depends_on "shared-mime-info"
depends_on "x265"
def install
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
pkgshare.install "examples/example.heic"
pkgshare.install "examples/example.avif"
end
def post_install
system Formula["shared-mime-info"].opt_bin/"update-mime-database", "#{HOMEBREW_PREFIX}/share/mime"
end
test do
output = "File contains 2 images"
example = pkgshare/"example.heic"
exout = testpath/"exampleheic.jpg"
assert_match output, shell_output("#{bin}/heif-convert #{example} #{exout}")
assert_predicate testpath/"exampleheic-1.jpg", :exist?
assert_predicate testpath/"exampleheic-2.jpg", :exist?
output = "File contains 1 images"
example = pkgshare/"example.avif"
exout = testpath/"exampleavif.jpg"
assert_match output, shell_output("#{bin}/heif-convert #{example} #{exout}")
assert_predicate testpath/"exampleavif.jpg", :exist?
end
end