archrelease: copy trunk to extra-x86_64
[arch-packages.git] / libcamera / repos / extra-x86_64 / PKGBUILD
blob549cff6b90ab0102b5abadfe51a3733054b1f494
1 # Maintainer: David Runge <dvzrv@archlinux.org>
3 pkgbase=libcamera
4 pkgname=(
5   libcamera
6   libcamera-docs
7   libcamera-ipa
8   libcamera-tools
9   gst-plugin-libcamera
11 pkgver=0.0.5
12 _commit=5fa37d7623053ef5a693b276986a44d010d057e5  # refs/tags/v0.0.5
13 pkgrel=1
14 pkgdesc="A complex camera support library for Linux, Android, and ChromeOS"
15 arch=(x86_64)
16 url="https://libcamera.org/"
17 license=(
18   LGPL2.1
19   GPL2
21 depends=(glibc)
22 makedepends=(
23   doxygen
24   git
25   glib2
26   graphviz
27   gst-plugins-base
28   gtest
29   libdrm
30   libjpeg-turbo
31   libtiff
32   libyaml
33   meson
34   python-jinja
35   python-ply
36   python-sphinx
37   python-pyyaml
38   qt5-base
39   qt5-tools
40   sdl2
41   systemd
42   texlive-core
44 source=(
45   git+https://git.libcamera.org/$pkgbase/$pkgbase.git#tag=$_commit
46   $pkgbase-0.0.5-sphinx.patch
48 sha512sums=('SKIP'
49             '52abec885c0a38c042622bc1bb106f7cefc19e3d8d0b6dcba7c4fadae3ad9303d5ae74447a72abe710598bc2162d57900be54bfe0de18d4c0842160c1c65b35a')
50 b2sums=('SKIP'
51         'e43847222ad644a23761f7f601891971f499552156d8dfd5922732d134e5a09202c6c4fa3880e13c1ae950d34c5a3617ada12fabc06368e3201110ac5455af7f')
53 _pick() {
54   local p="$1" f d; shift
55   for f; do
56     d="$srcdir/$p/${f#$pkgdir/}"
57     mkdir -p "$(dirname "$d")"
58     mv "$f" "$d"
59     rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
60   done
63 prepare() {
64   cd $pkgbase
66   # add version, so that utils/gen-version.sh may rely on it
67   printf "%s\n" "$pkgver" > .tarball-version
69   # fix use of python-sphinx
70   # https://github.com/sphinx-doc/sphinx/pull/11381
71   git apply -v ../$pkgbase-0.0.5-sphinx.patch
74 build() {
75   local meson_options=(
76     -D v4l2=true
77     -D tracing=disabled
78     -D test=true
79   )
81   arch-meson $pkgbase build "${meson_options[@]}"
82   meson compile -C build
85 check() {
86   meson test -C build || echo "Tests require CLONE_NEWUSER/ CLONE_NEWNET."
89 package_libcamera() {
90   depends=(
91     gcc-libs
92     glibc
93     gnutls
94     libcamera-ipa
95     libelf
96     libunwind
97     libyaml
98     sh
99     systemd-libs libudev.so
100   )
101   optdepends=(
102     'gst-plugin-libcamera: GStreamer plugin'
103     'libcamera-docs: for documentation'
104     'libcamera-tools: for applications'
105   )
106   provides=(libcamera.so libcamera-base.so)
108   meson install -C build --destdir "$pkgdir"
110   (
111     cd "$pkgdir"
112     _pick $pkgbase-docs usr/share/doc
113     _pick $pkgbase-ipa usr/lib/libcamera/
114     _pick $pkgbase-tools usr/bin/{cam,qcam,lc-compliance}
115     _pick gst-plugin-$pkgbase usr/lib/gstreamer-*
116   )
119 package_libcamera-docs() {
120   pkgdesc+=" - documentation"
122   mv -v $pkgname/* "$pkgdir"
123   mv -v "$pkgdir/usr/share/doc/$pkgbase-$pkgver/" "$pkgdir/usr/share/doc/$pkgbase/"
124   rm -frv "$pkgdir/usr/share/doc/$pkgbase/html/.buildinfo"
127 package_libcamera-ipa() {
128   pkgdesc+=" - signed IPA"
129   depends=(
130     gcc-libs
131     glibc
132     libcamera libcamera.so libcamera-base.so
133   )
134   # stripping requires re-signing of IPA libs, so we do it manually
135   options=(!strip)
137   strip $pkgname/usr/lib/libcamera/*{.so,proxy}
138   for _lib in $pkgname/usr/lib/libcamera/*.so; do
139     $pkgbase/src/ipa/ipa-sign.sh "$(find build -type f -iname "*ipa-priv-key.pem")" "$_lib" "$_lib.sign"
140   done
141   mv -v $pkgname/* "$pkgdir"
144 package_libcamera-tools() {
145   pkgdesc+=" - tools"
146   depends=(
147     gcc-libs
148     glibc
149     gtest
150     libcamera libcamera.so libcamera-base.so
151     libdrm
152     libevent libevent-2.1.so libevent_pthreads-2.1.so
153     libjpeg-turbo libjpeg.so
154     libtiff libtiff.so
155     libyaml
156     qt5-base
157     sdl2
158   )
159   conflicts=("$pkgbase-tests<0.0.1-2")
160   replaces=("$pkgbase-tests<0.0.1-2")
162   mv -v $pkgname/* "$pkgdir"
165 package_gst-plugin-libcamera() {
166   pkgdesc="Multimedia graph framework - libcamera plugin"
167   depends=(
168     gcc-libs
169     glibc
170     glib2 libg{lib,object}-2.0.so
171     gstreamer
172     gst-plugins-base-libs
173     libcamera libcamera.so libcamera-base.so
174   )
176   mv -v $pkgname/* "$pkgdir"