summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b2eace2d9447ec2b9d485c364137d086283e9c7f (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Maintainer: David Hummel <hummeltech@sherpaguru.com>

pkgbase=extension-bitwarden-git
pkgname=('brave-extension-bitwarden-git'
         'chrome-extension-bitwarden-git'
         'chromium-extension-bitwarden-git'
         'firefox-extension-bitwarden-git'
         'librewolf-extension-bitwarden-git'
         'opera-extension-bitwarden-git')
pkgver=2024.11.1.r16705.g34e20b7
pkgrel=1
pkgdesc='Bitwarden browser extensions'
arch=('any')
url='https://github.com/bitwarden/clients'
license=('GPL-3.0-or-later')
makedepends=('git' 'nodejs' 'npm' 'p7zip')
source=('git+https://github.com/bitwarden/clients.git')
sha256sums=('SKIP')

pkgver() {
  cd clients || exit
  _version=$(git tag --sort committerdate --list 'browser-*' | tail -n1 | cut -d- -f2 | cut -dv -f2)
  printf "%s.r%s.g%s" "${_version}" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

prepare() {
  cd clients || exit
  npm ci
}

build() {
  cd clients/apps/browser || exit
  rm --force --recursive dist
  mkdir --parents dist

  npm run build:prod:chrome
  mv build dist/chrome
  npm run build:prod:firefox
  mv build dist/firefox
  7z a -tzip dist/dist-firefox.zip "${PWD}"/dist/firefox/*
  npm run build:prod:opera
  mv build dist/opera
}

check() {
  cd clients/apps/browser || exit
  npm run test
}

package_brave-extension-bitwarden-git() {
  conflicts=('brave-extension-bitwarden')
  optdepends=('brave')
  install="${pkgname}.install"
  pkgdesc='Bitwarden browser extension for Brave'
  provides=('brave-extension-bitwarden')

  install -dm755 "${pkgdir}/usr/share"
  cp -av clients/apps/browser/dist/chrome "${pkgdir}/usr/share/${pkgname}"
}

package_chrome-extension-bitwarden-git() {
  conflicts=('chrome-extension-bitwarden')
  optdepends=('google-chrome')
  install="${pkgname}.install"
  pkgdesc='Bitwarden browser extension for Chrome'
  provides=('chrome-extension-bitwarden')

  install -dm755 "${pkgdir}/usr/share"
  cp -av clients/apps/browser/dist/chrome "${pkgdir}/usr/share/${pkgname}"
}

package_chromium-extension-bitwarden-git() {
  conflicts=('chromium-extension-bitwarden')
  optdepends=('chromium')
  install="${pkgname}.install"
  pkgdesc='Bitwarden browser extension for Chromium'
  provides=('chromium-extension-bitwarden')

  install -dm755 "${pkgdir}/usr/share"
  cp -av clients/apps/browser/dist/chrome "${pkgdir}/usr/share/${pkgname}"
}

package_firefox-extension-bitwarden-git() {
  conflicts=('firefox-extension-bitwarden')
  optdepends=('firefox')
  groups=('firefox-addons')
  pkgdesc='Bitwarden browser extension for Firefox'
  provides=('firefox-extension-bitwarden')

  install -Dm644 clients/apps/browser/dist/dist-firefox.zip "${pkgdir}/usr/lib/firefox/browser/extensions/{446900e4-71c2-419f-a6a7-df9c091e268b}.xpi"
}

package_librewolf-extension-bitwarden-git() {
  conflicts=('librewolf-extension-bitwarden')
  optdepends=('librewolf')
  pkgdesc='Bitwarden browser extension for LibreWolf'
  provides=('librewolf-extension-bitwarden')

  install -Dm644 clients/apps/browser/dist/dist-firefox.zip "${pkgdir}/usr/lib/librewolf/browser/extensions/{446900e4-71c2-419f-a6a7-df9c091e268b}.xpi"
}

package_opera-extension-bitwarden-git() {
  conflicts=('opera-extension-bitwarden')
  optdepends=('opera')
  install="${pkgname}.install"
  pkgdesc='Bitwarden browser extension for Opera'
  provides=('opera-extension-bitwarden')

  install -dm755 "${pkgdir}/usr/share"
  cp -av clients/apps/browser/dist/opera "${pkgdir}/usr/share/${pkgname}"
}