summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 6a41309b9dafa185d9dc73292a745134c2d370fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Maintainer: David Runge <dvzrv@archlinux.org>

pkgbase=libcamera
pkgname=(libcamera libcamera-docs libcamera-tools gst-plugin-libcamera)
pkgver=0.0.4
_commit=6a57d964abdb3f24608c0fc2839d96e02eebddeb  # refs/tags/v0.0.4
pkgrel=2
pkgdesc="A complex camera support library for Linux, Android, and ChromeOS"
arch=(x86_64)
url="https://libcamera.org/"
license=(LGPL2.1 GPL2)
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
  systemd
  texlive-core
)
source=(git+https://git.libcamera.org/$pkgname/$pkgname.git#tag=$_commit)
sha256sums=('SKIP')

_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 $pkgname
  # add version, so that utils/gen-version.sh may rely on it
  printf "%s\n" "$pkgver" > .tarball-version
}

build() {
  local meson_options=(
    -D v4l2=true
    -D tracing=disabled
    -D test=true
  )

  arch-meson $pkgname 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
    libdrm
    libelf
    libunwind
    libyaml
    systemd-libs libudev.so
  )
  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"

  # remove unneeded signatures as they make the package unreproducible
  rm -frv "$pkgdir/usr/lib/$pkgname/"*.sign

  (
    cd "$pkgdir"
    _pick $pkgbase-docs usr/share/doc
    _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-tools() {
  pkgdesc+=" - tools"
  depends=(
    gcc-libs
    glibc
    gtest
    libcamera libcamera.so libcamera-base.so
    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"
}