summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d8dadac84882d2cc4fd776630b1dc0d20c922566 (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
# Maintainer: Premysl Srubar <premysl.srubar[├ĄT]gmail(.)com>
pkgbase=fake-background-webcam-git
_pkgname="${pkgbase%-git}"
        
pkgname=('fake-background-webcam-git' 'fake-background-bodypix-git')           
pkgver=r136.1b2aad1
pkgrel=1
pkgdesc="Virtual background-replacing camera"
#optdepends=('cuda: for GPU acceleration of the TensorFlow on NVidia cards')
arch=('x86_64')
url="https://github.com/fangfufu/Linux-Fake-Background-Webcam"
license=("GPL")
makedepends=('git' 'npm')

source=("${pkgname}::git+${url}.git" 
        'fake-background-bodypix.service' 
        'fake-background-webcam@.service'
        'readme.md'
        "$_pkgname.install")
        
sha256sums=('SKIP'
            '24827ce9ae57cc11472c26ef4dc8edfa3218250a4ff6bba424f24bfe0eed3cb2'
            '9e8b5fb7fece0b1d2809b5dcb880419e85035f80f8fcaefc9cf9fe56017bf4d9'
            'f6b37aff68926eb16c510db56df665ec2a3f8aa7348c0e8ddf247bcaa770a955'
            'b57c70f3b498d646d8834d770d806219b306251c908cc8591b0d711e3638916f')

install=$_pkgname.install            
            
pkgver() {
  cd "$srcdir/${pkgname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  #git show -s --format="%ci" HEAD | sed -e 's/-//g' -e 's/ .*//'
}

package_fake-background-webcam-git() {
  depends=('v4l2loopback-dkms' 'python' 'python-opencv' 'akvcam-dkms' 'opencv' 'python-numpy>=1.18.2' 'python-requests>=2.23.0' 'python-requests-unixsocket' 'python-aiohttp>=3.6.2' 'python-pyfakewebcam' 'fake-background-bodypix')
  provides=('fake-background-webcam')
  conflicts=('fake-background-webcam') 
  cd "$srcdir/${pkgbase}/fakecam"  
  install -d "$pkgdir/usr/lib/$_pkgname"
  install -Dm644 *.py "$pkgdir/usr/lib/$_pkgname"
  
  install -d "$pkgdir/var/lib/$_pkgname/default"
  install -Dm644 *.jpg *.png "$pkgdir/var/lib/$_pkgname/default"
  install -Dm644 "${srcdir}/fake-background-webcam@.service" "$pkgdir/usr/lib/systemd/system/$_pkgname@.service"
  
  install -v -m 644 -D "${srcdir}/readme.md" "${pkgdir}/usr/share/doc/${_pkgname}/readme.md"  
}


package_fake-background-bodypix-git() {  
  provides=('fake-background-bodypix')
  conflicts=('fake-background-bodypix') 
  
  install -Dm644 "${srcdir}/fake-background-bodypix.service" "$pkgdir/usr/lib/systemd/system/fake-background-bodypix.service"
  
  #./install.sh
  mkdir -p "${pkgdir}/usr/lib/node_modules"  
  
  cd "$srcdir/${pkgbase}/bodypix"    
  rm Dockerfile*
  npm pack .
  npm install --user root -g --cache "${srcdir}/npm-cache" --prefix "$pkgdir/usr" *.tgz
  rm bodypix-*.tgz
  
  # Non-deterministic race in npm gives 777 permissions to random directories.
  # See https://github.com/npm/npm/issues/9359 for details.
  find "${pkgdir}"/usr -type d -exec chmod 755 {} +

  # npm gives ownership of ALL FILES to build user
  # https://bugs.archlinux.org/task/63396
  chown -R root:root "$pkgdir"
    
  find "${pkgdir}" -name "package.json" -exec sed -e "s|${pkgdir}||" -i {} \;
  find "${pkgdir}" -name "package.json" -exec sed -e "s|${srcdir}||" -i {} \;
  
  
}