jobextra/libcamera/PKGBUILD

164 lines
4.3 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=libcamera
pkgname=(libcamera libcamera-ipa libcamera-tools gst-plugin-libcamera) # libcamera-docs
pkgver=0.1.0
_commit=9e3a83c03bab65b745eea2482be78077b409a2b5 # refs/tags/v0.1.0
pkgrel=02
pkgdesc="A complex camera support library for Linux, Android, and ChromeOS w/o systemd"
url="https://libcamera.org/"
depends=(glibc)
makedepends=(doxygen git glib2 graphviz gst-plugins-base gtest libdrm
libjpeg-turbo libtiff libyaml meson python-jinja python-ply python-sphinx
python-pyyaml qt5-base qt5-tools sdl2 texlive-core)
source=(git+https://git.libcamera.org/$pkgname/$pkgname.git#tag=$_commit
$pkgbase-0.0.5-sphinx.patch)
_pick() {
local p="$1" f d; shift
for f; do
d="$srcdir/$p/${f#$pkgdir/}"
mkdir -p "$(dirname "$d")"
mv "$f" "$d"
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
done
}
prepare() {
cd $pkgbase
# add version, so that utils/gen-version.sh may rely on it
printf "%s\n" "$pkgver" > .tarball-version
# # Fix exponential callback explosion
# git cherry-pick -n a146e05125fdac75b8ffb6a818e00a446cec65dd
# fix use of python-sphinx
# https://github.com/sphinx-doc/sphinx/pull/11381
git apply -v ../$pkgbase-0.0.5-sphinx.patch
}
build() {
local meson_options=(
-D v4l2=true
-D tracing=disabled
-D test=true
)
arch-meson $pkgbase build "${meson_options[@]}"
meson compile -C build
}
check() {
meson test -C build || echo "Tests require CLONE_NEWUSER/ CLONE_NEWNET."
}
package_libcamera() {
depends=(
gcc-libs
glibc
gnutls
libcamera-ipa
libelf
libunwind
libyaml
libudev.so
sh
)
optdepends=(
'gst-plugin-libcamera: GStreamer plugin'
'libcamera-docs: for documentation'
'libcamera-tools: for applications'
)
provides=(libcamera.so libcamera-base.so)
meson install -C build --destdir "$pkgdir"
(
cd "$pkgdir"
# _pick $pkgbase-docs usr/share/doc
_pick $pkgbase-ipa usr/lib/libcamera/
_pick $pkgbase-tools usr/bin/{cam,qcam,lc-compliance}
_pick gst-plugin-$pkgbase usr/lib/gstreamer-*
)
}
#package_libcamera-docs() {
# pkgdesc+=" - documentation"
#
# mv -v $pkgname/* "$pkgdir"
# mv -v "$pkgdir/usr/share/doc/$pkgbase-$pkgver/" "$pkgdir/usr/share/doc/$pkgbase/"
# rm -frv "$pkgdir/usr/share/doc/$pkgbase/html/.buildinfo"
#}
package_libcamera-ipa() {
pkgdesc+=" - signed IPA"
depends=(
gcc-libs
glibc
libcamera libcamera.so libcamera-base.so
)
# stripping requires re-signing of IPA libs, so we do it manually
options=(!strip)
strip $pkgname/usr/lib/libcamera/*{.so,proxy}
for _lib in $pkgname/usr/lib/libcamera/*.so; do
$pkgbase/src/ipa/ipa-sign.sh "$(find build -type f -iname "*ipa-priv-key.pem")" "$_lib" "$_lib.sign"
done
mv -v $pkgname/* "$pkgdir"
}
package_libcamera-tools() {
pkgdesc+=" - tools"
depends=(
gcc-libs
glibc
gtest
libcamera libcamera.so libcamera-base.so
libdrm
libevent libevent-2.1.so libevent_pthreads-2.1.so
libjpeg-turbo libjpeg.so
libtiff libtiff.so
libyaml
qt5-base
sdl2
)
conflicts=("$pkgbase-tests<0.0.1-2")
replaces=("$pkgbase-tests<0.0.1-2")
mv -v $pkgname/* "$pkgdir"
}
package_gst-plugin-libcamera() {
pkgdesc="Multimedia graph framework - libcamera plugin"
depends=(
gcc-libs
glibc
glib2 libg{lib,object}-2.0.so
gstreamer
gst-plugins-base-libs
libcamera libcamera.so libcamera-base.so
)
mv -v $pkgname/* "$pkgdir"
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=(LGPL2.1 GPL2)
sha256sums=(SKIP
618bc981ad18ee3d7609a36c30d7cd9dc213d49dac4ba6be39d143a5881a7684) # libcamera-0.0.5-sphinx.patch
## f60e1b8a89982138f02b2f4951156429edb0f92bf51144f100ea4e458d68ea7b gst-plugin-libcamera-0.1.0-02-x86_64.pkg.tar.lz
## 7f9deda8e4299acf10d43400961d517f27ec4120d2c5b68baeac9002ad690316 libcamera-0.1.0-02-x86_64.pkg.tar.lz
## 479ce0047d13db757e20fd870e4206e5596dba03b1d397ae371afb2a0676e00f libcamera-ipa-0.1.0-02-x86_64.pkg.tar.lz
## 7b98843ee10f3a1035800aba78839eb80070a394486d0b97c72afa0ee7c6ffcc libcamera-tools-0.1.0-02-x86_64.pkg.tar.lz