summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4b6f3abe8f6c3d0f4ca85575626d6e91d411eeeb (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
# Maintainer: Guus van Meerveld <contact@guusvanmeerveld.dev>
pkgname='dust-mail-client-git'

arch=('x86_64')

pkgver=r39.3a52112
pkgver() {
  cd "$pkgname"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}
pkgrel=1
epoch=1

makedepends=('pnpm-bin=8.6.0' 'nvm' 'cargo' 'git' 'appstream' 'wget' 'webkit2gtk' 'appmenu-gtk-module' 'gtk3' 'libappindicator-gtk3' 'librsvg' 'libvips')

pkgdesc='A simple and fast mail client (Git version)'

conflicts=('dust-mail-client')
provides=('dust-mail-client')

url='https://github.com/Dust-Mail/desktop'

license=('MIT')

source=("$pkgname::git+https://github.com/Dust-Mail/desktop.git")

md5sums=('SKIP')
sha256sums=('SKIP')

_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() {
  _ensure_local_nvm
  nvm install 16

  cd "$srcdir/$pkgname/src-tauri"

  cargo fetch --target "$CARCH-unknown-linux-gnu"

  pnpm fetch
}

build() {
  _ensure_local_nvm

  cd "$pkgname"

  pnpm install --offline

  unset SOURCE_DATE_EPOCH

  export RUSTUP_TOOLCHAIN=1.65

  export VITE_UNSTABLE=true

  pnpm run tauri build --verbose
}

package() {
  install -Dm644 "$srcdir/$pkgname/dust-mail.desktop" "$pkgdir/usr/share/applications/dust-mail-client.desktop"
  install -Dm644 "$srcdir/$pkgname/icons/logo-512x512.png" "$pkgdir/usr/share/dust-mail.png"
  install -Dm755 "$srcdir/$pkgname/src-tauri/target/release/dust-mail" "$pkgdir/usr/bin/dust-mail"
}