Skip to content

Commit

Permalink
Update libmediapipe
Browse files Browse the repository at this point in the history
  • Loading branch information
Froxcey committed Dec 30, 2024
1 parent 1b76c4c commit 3868df9
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions Formula/libmediapipe.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3868df9

Please sign in to comment.