summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1e11fe629d1613768dbfca44495be85efbe906a7 (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
# Maintainer: Mark Wagie <mark dot wagie at proton dot me>
pkgname=proton-mail
pkgver=1.6.0
pkgrel=2
_nodeversion=22
pkgdesc="Proton official desktop application for Proton Mail and Proton Calendar"
arch=('x86_64' 'aarch64')
url="https://proton.me"
license=('GPL-3.0-or-later')
depends=(
  'alsa-lib'
  'gtk3'
  'gvfs'
  'libdrm'
  'libnotify'
  'nss'
  'xdg-utils'
)
makedepends=(
  'git'
  'nvm'
  'yarn'
  'zip'
)
optdepends=(
  'kde-cli-tools: file deletion support (kioclient5)'
  'libgnome-keyring'
  'lsb-release'
  'trash-cli: file deletion support (trash-put)'
)
conflicts=('protonmail-desktop')
_commit=f44daaae9d941327c545b8cd32501e1213c0a0bd  # 1.6.0
source=("git+https://github.com/ProtonMail/WebClients.git#commit=${_commit}"
        "$pkgname.desktop"
        '0001-fix-webpack-config.patch')
sha256sums=('8139dea2a22a7a3f6724e9613314a9ad1b30647fcbcb624839326ef258b4d50b'
            '24cb263b7b61b5d64f49e4ead46d6f10c5d4a06599b0bb6334c3958721255fdb'
            '390856b2972a8b54953261ebfd0caf27f30fd91d44c0046acffe27aab41d55ba')

_ensure_local_nvm() {
  # let's be sure we are starting clean
  which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload
  export NVM_DIR="$srcdir/.nvm"

  # The init script returns 3 if version specified
  # in ./.nvrc is not (yet) installed in $NVM_DIR
  # but nvm itself still gets loaded ok
  source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
}

prepare() {
  cd WebClients

  # https://github.com/ProtonMail/WebClients/issues/418
  patch -Np1 -i ../0001-fix-webpack-config.patch

  _ensure_local_nvm
  nvm install "${_nodeversion}"
  
  export YARN_CACHE_FOLDER="$srcdir/yarn-cache"
  yarn install
}

build() {
  cd WebClients
  export YARN_CACHE_FOLDER="$srcdir/yarn-cache"
  _ensure_local_nvm
  yarn workspace proton-inbox-desktop make --targets="@electron-forge/maker-zip"
}

package() {
  cd WebClients
  install -d "$pkgdir/opt/$pkgname"
  cp -r applications/inbox-desktop/out/Proton\ Mail-linux-*/* "$pkgdir/opt/$pkgname"

  install -d "$pkgdir/usr/bin"
  ln -s "/opt/$pkgname/Proton Mail" "$pkgdir/usr/bin/$pkgname"

  install -Dm644 applications/inbox-desktop/assets/linux/icon.svg \
    "$pkgdir/usr/share/icons/hicolor/scalable/apps/$pkgname.svg"
  install -Dm644 applications/inbox-desktop/assets/icons/icon.png \
    "$pkgdir/usr/share/icons/hicolor/512x512/apps/$pkgname.png"
  install -Dm644 applications/inbox-desktop/assets/icons/icon@2x.png \
    "$pkgdir/usr/share/icons/hicolor/1024x1024@2x/apps/$pkgname.png"

  install -Dm644 "$srcdir/$pkgname.desktop" -t "$pkgdir/usr/share/applications/"
}