Files

50 lines
1.9 KiB
Ruby

class Webp < Formula
bottle do
root_url "https://homebrew.hyprnet/bottles"
sha256 cellar: :any, arm64_sequoia: "ad74e4538a799bc21e85fb2899c2267f7b6c8761212d195ec3cb3583062ad19e"
sha256 cellar: :any, arm64_tahoe: "11a19ac5db13a8485d4d6f712d65d48531f99e8d7237407ab42718777eefacb3"
sha256 cellar: :any_skip_relocation, x86_64_linux: "5520d52bce6d837491accd768420cb44e9c64b6bcd4063817668fd5245fc9cfc"
end
desc "Image format providing lossless and lossy compression for web images"
homepage "https://developers.google.com/speed/webp/"
url "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.6.0.tar.gz"
sha256 "e4ab7009bf0629fd11982d4c2aa83964cf244cffba7347ecd39019a9e38c4564"
license "BSD-3-Clause"
compatibility_version 1
head "https://chromium.googlesource.com/webm/libwebp.git", branch: "main"
livecheck do
url "https://developers.google.com/speed/webp/docs/compiling"
regex(/libwebp[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
depends_on "cmake" => :build
depends_on "giflib"
depends_on "jpeg-turbo"
depends_on "libpng"
def install
args = %W[
-DCMAKE_INSTALL_RPATH=#{rpath}
-DCMAKE_DISABLE_FIND_PACKAGE_TIFF=ON
]
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, "-DBUILD_SHARED_LIBS=ON", *args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
system "cmake", "-S", ".", "-B", "static", *std_cmake_args, "-DBUILD_SHARED_LIBS=OFF", *args
system "cmake", "--build", "static"
lib.install buildpath.glob("static/*.a")
# Avoid rebuilding dependents that hard-code the prefix.
inreplace (lib/"pkgconfig").glob("*.pc"), prefix, opt_prefix
end
test do
system bin/"cwebp", test_fixtures("test.png"), "-o", "webp_test.png"
system bin/"dwebp", "webp_test.png", "-o", "webp_test.webp"
assert_path_exists testpath/"webp_test.webp"
end
end