summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 201316c59c88d2bd9671861ee0d2bfb2d1a8ee9f (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
# Maintainer: duzda <duzda@disroot.org>

pkgname=deezer-enhanced-git
_pkgname=deezer-enhanced
# version.r0.g<gitcommit>
pkgver=v1.2.0.r0.gb50c6d4
pkgrel=1
pkgdesc='An unofficial application for Deezer with enhanced features, that is not just an electron wrapper.'
arch=('x86_64' 'armv7h' 'aarch64')
url="https://github.com/duzda/deezer-enhanced"
license=('MIT')
depends=('c-ares' 'ffmpeg' 'gtk3' 'http-parser' 'libevent' 'libvpx' 'libxslt' 'libxss' 'minizip' 'nss' 're2' 'snappy' 'libnotify' 'libappindicator-gtk3' 'libxcrypt-compat')
makedepends=('git' 'npm' 'nodejs')
provides=('deezer-enhanced')
conflicts=('deezer-enhanced')
options=('!debug')
source=(git+https://github.com/duzda/deezer-enhanced)
sha256sums=(SKIP)

pkgver() {
  cd "$srcdir/$_pkgname"
  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "$srcdir/$_pkgname"
  npm i && npx electron-forge make --targets pacman 
}

package() {
  cd $_pkgname/out/make

  # v0.1.0.r1.g47e2cc3 => 0.1.0
  realversion=`echo $pkgver | sed 's/v//g;s/\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\(r[0-9]\+\)\.\(g.*\)/\1.\2.\3/'`
  tar --extract -f $_pkgname-$realversion.pacman

  # Main program
  install -d "${pkgdir}/opt"
  cp -r opt "${pkgdir}"

  # Desktop icon + icons
  install -dm755 "${pkgdir}/usr/"
  cp -r usr "${pkgdir}"

  cd ../..
  # License
  install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"

  cd out/make
  # Post install
  install -d "$pkgdir/usr/bin"
  ln -sf "/opt/deezer-enhanced/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"

  # Hopefully temp fix
  chmod 755 "${pkgdir}/opt/deezer-enhanced"
  sed -i '2s/.*/Name=Deezer Enhanced/' "${pkgdir}/usr/share/applications/deezer-enhanced.desktop"
  sed -i '7s/.*/StartupWMClass=Deezer Enhanced/' "${pkgdir}/usr/share/applications/deezer-enhanced.desktop"
  sed -i '9s/.*/Categories=Audio;AudioVideo;/' "${pkgdir}/usr/share/applications/deezer-enhanced.desktop"

  # SUID chrome-sandbox for Electron 5+
  chmod 4755 "${pkgdir}/opt/deezer-enhanced/chrome-sandbox" || true
}