summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 380cd23efb3560819f2802895eebccbc22ad0530 (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
# Maintainer: Mahdi Sarikhani <mahdisarikhani@outlook.com>
# Contributor: CodeXYZ <jesusbalbastro@gmail.com>
# Contributor: Mateusz Gozdek <mgozdekof@gmail.com>
# Contributor: Rein Fernhout <me@levitati.ng>
# Contributor: James An <james@jamesan.ca>

pkgbase=droidcam
pkgname=(droidcam v4l2loopback-dc-dkms)
_name=droidcam-linux-client
pkgver=2.1.3
pkgrel=2
epoch=1
pkgdesc="A tool to turn your phone/tablet into a wireless/usb webcam"
arch=('x86_64')
url="https://github.com/dev47apps/droidcam-linux-client"
license=('GPL-2.0-or-later')
makedepends=('alsa-lib' 'ffmpeg' 'gtk3' 'libappindicator-gtk3' 'libjpeg-turbo' 'libusbmuxd' 'speex')
optdepends=('android-tools: for Android USB connection'
            'usbmuxd: for iOS USB connection')
source=("${pkgbase}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz"
        "dkms.conf"
        "${pkgbase}.conf")
sha256sums=('86d18029364d8ecd8b1a8fcae4cc37122f43683326fe49922b2ce2c8cf01e49d'
            '20de9d14877732f2f75c21bdd4c335c71dcaeccab4ce348c6c0a210f622ceed2'
            '1d4b3ff98b4af9de77a24d1b6fad6e004deadf1f157eb800aa878ba1e7693dac')

prepare() {
  # Generate the module loading configuration files
  echo "options v4l2loopback_dc width=640 height=480" >| "${pkgbase}.modprobe.conf"

  sed "s/@PKGVER@/${pkgver}/" -i dkms.conf

  cd "${_name}-${pkgver}"
  sed 's|/opt/droidcam-icon.png|/usr/share/pixmaps/droidcam.png|' -i src/droidcam.c
  sed -e 's|/usr/local/bin/||' -e 's|/opt/droidcam-icon.png|droidcam|' -i droidcam.desktop
}

build() {
  cd "${_name}-${pkgver}"

  # All JPEG* parameters are needed to use shared version of libturbojpeg instead of
  # static one.
  #
  # Also libusbmuxd requires an override while linking.
  make JPEG_DIR='/usr/lib' JPEG_INCLUDE='/usr/include' USBMUXD='-lusbmuxd-2.0'
}

package_droidcam() {
  depends=('alsa-lib' 'ffmpeg' 'glib2' 'glibc' 'gtk3' 'libappindicator-gtk3' 'libjpeg-turbo' 'libusbmuxd' 'libx11' 'pango' 'speex' 'V4L2LOOPBACK-MODULE')

  cd "${_name}-${pkgver}"
  # Install droidcam program files
  install -Dm755 "${pkgname}" "${pkgname}-cli" -t "${pkgdir}/usr/bin"
  install -Dm644 icon2.png "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
  install -Dm644 "${pkgname}.desktop" -t "${pkgdir}/usr/share/applications"
  install -Dm644 "${srcdir}/${pkgname}.conf" -t "${pkgdir}/etc/modules-load.d"
}

package_v4l2loopback-dc-dkms() {
  pkgdesc='v4l2-loopback kernel module - DroidCam version'
  arch=('any')
  depends=('dkms')
  provides=('V4L2LOOPBACK-MODULE')
  backup=("etc/modprobe.d/${pkgbase}.conf")

  _pkgname='v4l2loopback-dc'

  # Install module loading configuration
  install -Dm644 "${pkgbase}.modprobe.conf" "${pkgdir}/etc/modprobe.d/${pkgbase}.conf"

  # Install module source
  cd "${_name}-${pkgver}/v4l2loopback"
  install -Dm644 Makefile test.c v4l2loopback-dc.c "${srcdir}/dkms.conf" -t "${pkgdir}/usr/src/${_pkgname}-${pkgver}"
}