Files
omarchy-pkgs/pkgbuilds/python-mediapipe/PKGBUILD
T
Ryan Hughes 7dde80c9f7 python-mediapipe: leave the semantic retriever out of libmediapipe.so
MediaPipe 1.1.0 links its SQLite memory and vector stores from prebuilt
archives built with Google's internal toolchain. They have no archive symbol
table, and once indexed they still need Google's libc++ (std::__u) and
internal symbols (__alloc_token_*__Znwm, sqlite_helpers, sqlite3_vector_init),
so the link of libmediapipe.so fails. Drop the semantic retriever's C API from
the library; mediapipe and its other tasks import and work as before.
2026-10-09 19:03:02 -04:00

93 lines
3.2 KiB
Bash

# Maintainer: robertfoster
# Maintainer: Hu Butui <hot123tea123@gmail.com>
_pkgname=mediapipe
_bazel_version=7.4.1
pkgname=python-mediapipe
pkgver=1.1.0
pkgrel=1
pkgdesc="A cross-platform, customizable ML solutions for live and streaming media"
arch=('x86_64')
url="https://github.com/google-ai-edge/mediapipe"
license=("Apache-2.0")
depends=(
absl-py
gcc-libs
glibc
libglvnd
opencv
opengl-driver
python-attrs
python-flatbuffers
python-matplotlib
python-numpy
python-opencv
python-pillow
python-protobuf
python-scipy
python-six
python-sounddevice
python-tensorflow
)
makedepends=(
patchelf
python-build
python-installer
python-setuptools
python-wheel
)
source=("${_pkgname}-${pkgver}.tar.gz::https://github.com/google-ai-edge/mediapipe/archive/refs/tags/v${pkgver}.tar.gz"
"bazel-${_bazel_version}-linux-x86_64::https://github.com/bazelbuild/bazel/releases/download/${_bazel_version}/bazel-${_bazel_version}-linux-x86_64"
"0004-use-opencv-headers.patch"
"0005-set-hermetic-python-version-and-disable-odml-converter.patch"
"0006-opencv5-geometry-header.patch"
"0007-bump-rules-java.patch"
"0008-drop-semantic-retriever-from-libmediapipe.patch"
)
sha256sums=('ef260449409c942a35859ed017f13934f6bf6240ddccdd01a202225650dad73e'
'c97f02133adce63f0c28678ac1f21d65fa8255c80429b588aeeba8a1fac6202b'
'd18e88a217a00dc77cf2bfaa1d33b5fbc912deed5df686b0d2455fb0db75a677'
'62cbd43346e7a7705127656a74bec44852e5bbfc006c4723005fdd23af5258db'
'fb082d88d9cca47534ae01fca676a3afdb909bfc82d52c97cf0eaedf34571d5f'
'bdead49ac5370dc84d9facee962bf2def5d9055d7339a37b2ba3f3b4bb02f811'
'2b7ce1adcbfb39379f396a917bbc805a571f207ac2569ec6161348d88b3ccaf2')
prepare() {
# bazel in the ArchLinux is not working
mkdir -p ${srcdir}/bin
install -Dm755 "${srcdir}/bazel-${_bazel_version}-linux-x86_64" \
"${srcdir}/bin/bazel"
export PATH=${srcdir}/bin:${PATH}
cd "${srcdir}/${_pkgname}-${pkgver}"
patch -p1 -i "${srcdir}/0004-use-opencv-headers.patch"
patch -p1 -i "${srcdir}/0005-set-hermetic-python-version-and-disable-odml-converter.patch"
patch -p1 -i "${srcdir}/0006-opencv5-geometry-header.patch"
patch -p1 -i "${srcdir}/0007-bump-rules-java.patch"
# 1.1.0's semantic retriever links Google-toolchain prebuilts (libc++,
# internal symbols) that cannot link here; leave it out of libmediapipe.so
patch -p1 -i "${srcdir}/0008-drop-semantic-retriever-from-libmediapipe.patch"
# set __version__
sed -i "s/__version__ = 'dev'/__version__ = '$pkgver'/" setup.py
# set link_opencv to True
sed -i "s/self.link_opencv = False/self.link_opencv = True/g" setup.py
}
build() {
cd "${srcdir}/${_pkgname}-${pkgver}"
# enable building with GPU support, using opengl-driver
# opengl-driver is provided by mesa or nvidia-utils
MEDIAPIPE_DISABLE_GPU=0 \
python -m build --wheel --no-isolation
}
package() {
cd "${srcdir}/${_pkgname}-${pkgver}"
python -m installer --destdir="${pkgdir}" dist/*.whl
# remove rpath and fix permission
find ${pkgdir} -type f -name "*.so" -exec patchelf --remove-rpath {} \;
find ${pkgdir} -type f -name "*.so" -exec chmod 755 {} \;
}
# vim:set ts=2 sw=2 et: