summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b130486fd8aed0d2302289a04940d299f5ac1371 (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
# Maintainer: Alec Mev <alec@mev.earth>
# Contributor: Mark Wagie <mark dot wagie at proton dot me>

pkgname=gmail-desktop
_ver=3.0.0-alpha.37
pkgver="${_ver//-/_}"
pkgrel=1
pkgdesc='Nifty Gmail desktop app'
arch=('x86_64')
url='https://github.com/timche/gmail-desktop/tree/develop'
license=('MIT')
_electronv=21 # https://github.com/timche/gmail-desktop/issues/385#issuecomment-1634102694
depends=("electron${_electronv}")
makedepends=(
  'gendesk'
  'npm'
)
optdepends=(
  'libnotify: Desktop notifications'
  'libappindicator-gtk3: Tray icon'
)
_dir="${pkgname}-${_ver}"
source=("${_dir}.tar.gz::https://github.com/timche/gmail-desktop/archive/refs/tags/v${_ver}.tar.gz")
sha256sums=('f6edd6bc221ca57a98bb5a551266f040b3158b1a6aac4ab17111c78edcf2a24c')

prepare() {
  cd "${_dir}"
  sed -i '/husky/d' package.json
  cat > "${pkgname}" <<EOF
#!/usr/bin/env bash
exec electron${_electronv} /usr/share/${pkgname}/app.asar "\$@"
EOF
  gendesk \
    --pkgname "${pkgname}" \
    --pkgdesc "${pkgdesc}" \
    --name 'Gmail Desktop' \
    --categories 'Network;Office;Email' \
    -n \
    -f
}

build() {
  cd "${_dir}"
  npm i
  npm run build
  npx electron-builder \
    --linux \
    --dir \
    -c.electronDist="/usr/lib/electron${_electronv}" \
    -c.electronVersion="$(cat "/usr/lib/electron${_electronv}/version")"
}

package() {
  cd "${_dir}"
  mkdir -p "${pkgdir}/usr/share"
  cp -r dist/linux-unpacked/resources "${pkgdir}/usr/share/${pkgname}"
  install -Dm755 -t "${pkgdir}/usr/bin/" "${pkgname}"
  install -Dm644 -t "${pkgdir}/usr/share/applications/" "${pkgname}.desktop"
  install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
  install -Dm644 -t "${pkgdir}/usr/share/pixmaps/" build/icon.png
}