summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 30fd85f949528dfabf1c15d424001a7e1aa2f2aa (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
# Maintainer: Rafael Maldonado <remdph@gmail.com>
pkgname=nodepdf-bin
pkgver=0.4.2
pkgrel=1
pkgdesc="Lightweight, fast desktop PDF viewer built with Electron and React"
arch=('x86_64')
url="https://github.com/remdph/node-pdf"
license=('MIT')
provides=('nodepdf')
conflicts=('nodepdf')
# Runtime deps Electron needs at startup. Most Arch desktops already
# pull these in; listed explicitly so a headless install still works.
depends=(
  'alsa-lib'
  'gtk3'
  'libnotify'
  'libxss'
  'libxtst'
  'mesa'
  'nspr'
  'nss'
  'xdg-utils'
)
optdepends=(
  'libappindicator-gtk3: tray icon support'
)
options=('!strip' '!debug')
source=(
  "${pkgname}-${pkgver}.deb::https://github.com/remdph/node-pdf/releases/download/v${pkgver}/node-pdf_${pkgver}_amd64.deb"
)
sha256sums=('624cefea3338582d119115a1cf66a95bbab837162407b49a14cc2dc4c8b8a5a7')

prepare() {
  cd "$srcdir"
  # .deb is just an ar archive — pull out data.tar.* and unpack it.
  bsdtar -xf "${pkgname}-${pkgver}.deb"
  mkdir -p data
  bsdtar -xf data.tar.* -C data
}

package() {
  cd "$srcdir/data"

  # The .deb already lays out files under usr/{bin,lib,share} following the
  # FHS — copy the whole tree verbatim. `/usr/bin/node-pdf` is the launcher
  # script and `/usr/lib/node-pdf/` holds the Electron runtime + binary.
  cp -a usr "$pkgdir/"

  # Surface the bundled LICENSE under the conventional Arch location so
  # pacman -Qi shows it and tools like vrms can find it. The .deb names
  # the file `copyright` (Debian convention) — symlink either name we find.
  install -dm755 "$pkgdir/usr/share/licenses/$pkgname"
  for src in LICENSE copyright; do
    if [[ -f "$pkgdir/usr/share/doc/node-pdf/$src" ]]; then
      ln -sf "/usr/share/doc/node-pdf/$src" \
        "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
      break
    fi
  done
}