From 3868df990730e6f10523a65b916c380ca6864638 Mon Sep 17 00:00:00 2001 From: froxcey Date: Mon, 30 Dec 2024 21:48:20 +0800 Subject: [PATCH] Update libmediapipe --- Formula/libmediapipe.rb | 45 +++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/Formula/libmediapipe.rb b/Formula/libmediapipe.rb index da64bb2..6ae1c51 100644 --- a/Formula/libmediapipe.rb +++ b/Formula/libmediapipe.rb @@ -1,27 +1,42 @@ class Libmediapipe < Formula desc "C API for Google's MediaPipe framework" - homepage "https://github.com/Froxcey/libmediapipe" - url "https://github.com/Froxcey/libmediapipe/archive/49186c74c9ba0c3d9a850ede3def811572a005b0.zip" - sha256 "a9ad3d76503422f83d3b82cfb06d94e935de2a0a3e80243586a18189ca811cab" + homepage "https://codeberg.org/Chiissu/libmediapipe" license "GPL-3.0" - version "0.10.15" + version "0.10.20" - $arch = "x86_64" - if Hardware::CPU.arm? || Hardware::CPU.in_rosetta2? - $arch = "aarch64" + if OS.mac? + if Hardware::CPU.arm? || Hardware::CPU.in_rosetta2? + url "https://codeberg.org/Chiissu/libmediapipe/releases/download/v#{version}/libmediapipe-macos-aarch64-#{version}.tar.gz" + sha256 "5570d22079074ecc8b5e46bfd3b9a4080c8ffa623a6fb942b827c991f8e65bf8" + elsif Hardware::CPU.avx2? + url "https://codeberg.org/Chiissu/libmediapipe/releases/download/v#{version}/libmediapipe-macos-x86_64-#{version}.tar.gz" + sha256 "2ca26a2a39802c624897b9c80bb1dc870ed44fbdd6cae69d25be6534937b9ee1" + else + odie "Unsupported MacOS architecture." + end + elsif OS.linux? + if Hardware::CPU.avx2? + url "https://codeberg.org/Chiissu/libmediapipe/releases/download/v#{version}/libmediapipe-linux-x86_64-#{version}.tar.gz" + sha256 "531a1e2b7090044a0dbc31a18b55a69ded60ea7bb95de4f6f78c98180399f688" + else + odie "Unsupported Linux architecture." + end + else + odie "Unsupported platform." end - depends_on "python" => :build - depends_on "bazelisk" => :build depends_on "opencv" def install - system "./build-#{$arch}-macos.sh --config release --opencv_dir #{Formula["opencv"].opt_prefix} --version v#{version}" - system "sh", "./gen-pkgconfig.sh", "#{opt_prefix}", "#{version}" - include.install "output/libmediapipe/include/mediapipe.h" - lib.install "output/libmediapipe/lib/libmediapipe.dylib" - lib.install "output/libmediapipe/lib/pkgconfig" - lib.install "output/data" + system "sh", "./pkgconfig/gen-pkgconfig.sh", "#{opt_prefix}", "#{version}" + include.install "libmediapipe/include/mediapipe.h" + if OS.mac? + lib.install "libmediapipe/lib/libmediapipe.dylib" + else + lib.install "libmediapipe/lib/libmediapipe.so" + end + lib.install "libmediapipe/pkgconfig" + lib.install "data" end test do