summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eaaeade609dc13cdbf35aeaca37339b9adfb8342 (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: Benjamin Denhartog <ben@sudoforge.com>
# Contributor: Raphaƫl Doursenaud <rdoursenaud@free.fr>
# Contributor: crasm <crasm@firebase-tools.aur.yooz4sio.vczf.io>

# For ISSUES, REQUESTS, and QUESTIONS:
# https://github.com/sudoforge/pkgbuilds

pkgname=firebase-tools
pkgver=11.12.0
pkgrel=1
pkgdesc="The Firebase Command Line Tools"
arch=('any')
url="https://github.com/firebase/firebase-tools"
license=('MIT')
depends=('nodejs')
makedepends=(
  'npm'
  'jq'
)
source=("https://registry.npmjs.org/${pkgname}/-/${pkgname}-${pkgver}.tgz")
noextract=("${pkgname}-${pkgver}.tgz")
sha256sums=('fbdfd10d72a0500fd3fd4a3eda6afec8128d5efe68ce54cd855155d9a703b70f')

package() {
  # We throw away output here to keep the build quieter; if issues are
  # encountered, be sure to remove the output redirection in order to debug.
  npm install \
    --global \
    --prefix "${pkgdir}/usr" \
    "${srcdir}/${pkgname}-${pkgver}.tgz" &> /dev/null
  
  # 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 {} +

  # Remove references to the package directory
  find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'

  # Remove references to the package directory from package.json
  find "$pkgdir" \
    -type f \
    -name 'package.json' \
    -execdir sh -c "jq '. | delpaths([paths|select(.[0] | test(\"_.*\"))])' {} > {}.new" \; \
    -exec mv {}.new {} \;

  # sshpk contains build references in the `man` attribute...
  find "${pkgdir}/usr/lib/node_modules/${pkgname}/node_modules/sshpk/package.json" \
    -execdir sh -c "jq '.man = [[\
      \"man/man1/sshpk-conv.1\", \
      \"man/man1/sshpk-sign.1\", \
      \"man/man1/sshpk-verify.1\" \
    ]]' {} > {}.new" \; \
    -exec mv {}.new {} \;
  
  # Install a symlink for the LICENSE file
  install -d "${pkgdir}/usr/share/licenses/${pkgname}"
  ln -s \
    "/usr/lib/node_modules/${pkgname}/LICENSE" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}