~mser/pkg.mser.at

ref: f3857863cc940544d9571dc7ecd6cfe112a8c5a6 pkg.mser.at/packages/element-desktop-fork/PKGBUILD -rw-r--r-- 2.7 KiB
f3857863Michael Serajnik Update package element-desktop-fork 2 months ago
                                                                                
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
# Maintainer: Michael Serajnik <m at mser dot at>
pkgver=1.7.34.fork1
pkgrel=1
pkgname=element-desktop-fork
_pkgname=element-web-fork
pkgdesc="A glossy Matrix collaboration client for the desktop with added custom emote support"
arch=('x86_64')
url="https://element.io"
license=('Apache')
depends=('electron' 'sqlcipher')
makedepends=('git' 'nodejs' 'yarn' 'npm' 'python' 'rust' 'electron' 'moreutils')
conflicts=('element-desktop' 'element-desktop-git' 'element-web' 'riot-desktop-fork-git' 'element-desktop-fork-git')
provides=('element-desktop')
backup=("etc/element/config.json")
source=('element-web-fork::git+https://git.sr.ht/~mser/element-web'
        'element-desktop::git://github.com/vector-im/element-desktop.git#tag=v1.7.34')
sha256sums=('SKIP'
            'SKIP')

prepare() {
  export HOME=$(mktemp -d) # Workaround to avoid conflicts when using `yarn link`

  rustup --version && rustup default stable \
    || echo "rustup not installed, no need to install a toolchain"

  cd "$srcdir/element-desktop"

  sed -i 's/"target": "deb"/"target": "dir"/g' package.json

  rm element.io/release/config.json
  cp "$srcdir/${_pkgname}/desktop.config.json" element.io/release/config.json
}

build() {
  cd "$srcdir/${_pkgname}"
  yarn install --cache-folder "${srcdir}/yarn-cache"
  yarn build

  cd "$srcdir/element-desktop"
  yarn install --cache-folder "${srcdir}/yarn-cache"
  yarn build:native
  yarn build
}

package() {
  cd "$srcdir/${_pkgname}"

  install -d "${pkgdir}"/{usr/share/webapps,etc/webapps}/element

  cp -r webapp/* "${pkgdir}"/usr/share/webapps/element/
  install -Dm644 config.sample.json -t "${pkgdir}"/etc/webapps/element/
  ln -s /etc/webapps/element/config.json "${pkgdir}"/usr/share/webapps/element/
  echo "${pkgver}" > "${pkgdir}"/usr/share/webapps/element/version

  cd "$srcdir/element-desktop"

  install -d "${pkgdir}"{/usr/lib/element,/etc/webapps/element}

  cp -r dist/linux-unpacked/resources/* "${pkgdir}"/usr/lib/element/
  ln -s /usr/share/webapps/element "${pkgdir}"/usr/lib/element/webapp

  ln -s /etc/element/config.json "${pkgdir}"/etc/webapps/element/config.json
  install -Dm644 element.io/release/config.json -t "${pkgdir}"/etc/element/

  install -Dm644 "${srcdir}/${_pkgname}"/element-desktop.desktop "${pkgdir}"/usr/share/applications/element-desktop.desktop
  install -Dm755 "${srcdir}/${_pkgname}"/element-desktop.sh "${pkgdir}"/usr/bin/element-desktop

  install -Dm644 "$srcdir/${_pkgname}"/res/themes/element/img/logos/element-logo.svg "${pkgdir}"/usr/share/icons/hicolor/scalable/apps/element.svg

  for i in 16 24 48 64 96 128 256 512; do
    install -Dm644 build/icons/${i}x${i}.png "${pkgdir}"/usr/share/icons/hicolor/${i}x${i}/apps/element.png
  done
}