archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / element.io / trunk / PKGBUILD
blobfb9296b7c0a2a2e7dd555c673b173c3ec4469d1d
1 # Maintainer: Bruno Pagani <archange@archlinux.org>
2 # Contributor: Steef Hegeman <mail@steefhegeman.com>
3 # Contributor: Luca Weiss <luca (at) z3ntu (dot) xyz>
4 # Contributor: Julian Schacher <jspp@posteo.net>
6 _electron=electron22
7 pkgbase=element.io
8 pkgname=(element-web element-desktop)
9 pkgver=1.11.31
10 pkgrel=2
11 pkgdesc="Glossy Matrix collaboration client — "
12 arch=(x86_64)
13 url="https://element.io"
14 license=(Apache)
15 makedepends=(npm git yarn python rust tcl ${_electron} nodejs-lts-gallium libxcrypt-compat sqlcipher)
16 _url="https://github.com/vector-im/element"
17 source=(element-web-${pkgver}.tar.gz::${_url}-web/archive/v${pkgver}.tar.gz
18         element-web-${pkgver}.tar.gz.asc::${_url}-web/releases/download/v${pkgver}/v${pkgver}-src.tar.gz.asc
19         element-desktop-${pkgver}.tar.gz::${_url}-desktop/archive/v${pkgver}.tar.gz
20         element-desktop-${pkgver}.tar.gz.asc::${_url}-desktop/releases/download/v${pkgver}/v${pkgver}-src.tar.gz.asc
21         autolaunch.patch
22         io.element.Element.desktop
23         element-desktop.sh)
24 sha256sums=('6597d59f12a0f878fa363d6253a506583f686284d81a50baceb2965a4e0cce18'
25             'SKIP'
26             '5152bcdab011deb7e5d7c713edd268bf4266dedde87ff735ad146e9eb12e205b'
27             'SKIP'
28             '268485f35103d00a89be7f5c84703e3d393350c71f4f90932f7bcb5ea2fd094f'
29             '0103f28a32fe31f698836516783c1c70a76a0117b5df7fd0af5c422c224220f9'
30             'c1bd9ace215e3ec9af14d7f28b163fc8c8b42e23a2cf04ce6f4ce2fcc465feba')
31 validpgpkeys=(712BFBEE92DCA45252DB17D7C7BE97EFA179B100) # Element Releases <releases@riot.im>
33 prepare() {
34   # Specify electron version in launcher
35   sed -i "s|@ELECTRON@|${_electron}|" element-desktop.sh
37   cd element-web-${pkgver}
38   yarn install --no-fund
40   cd ../element-desktop-${pkgver}
41   patch -p1 < ../autolaunch.patch
42   sed -i 's|"target": "deb"|"target": "dir"|' package.json
43   sed -i 's|"https://packages.element.io/desktop/update/"|null|' element.io/release/config.json
44   yarn install --no-fund
47 build() {
48   export NODE_OPTIONS=--openssl-legacy-provider
49   cd element-web-${pkgver}
50   VERSION=${pkgver} yarn build --offline
52   cd ../element-desktop-${pkgver}
53   export SQLCIPHER_STATIC=1
54   yarn run build:native
55   yarn run build
58 package_element-web() {
59   pkgdesc+="web version."
60   replaces=(riot-web vector-web)
62   cd element-web-${pkgver}
64   install -d "${pkgdir}"/{usr/share/webapps,etc/webapps}/element
66   cp -r webapp/* "${pkgdir}"/usr/share/webapps/element/
67   install -Dm644 config.sample.json -t "${pkgdir}"/etc/webapps/element/
68   ln -s /etc/webapps/element/config.json "${pkgdir}"/usr/share/webapps/element/
69   echo "${pkgver}" > "${pkgdir}"/usr/share/webapps/element/version
72 package_element-desktop() {
73   pkgdesc+="desktop version."
74   replaces=(riot-desktop)
75   depends=("element-web=${pkgver}" ${_electron} libsecret sqlcipher)
76   backup=('etc/element/config.json')
78   cd element-desktop-${pkgver}
80   install -d "${pkgdir}"{/usr/lib/element/,/etc/webapps/element}
82   # Install the app content, replace the webapp with a symlink to the system package
83   cp -r dist/linux-unpacked/resources/* "${pkgdir}"/usr/lib/element/
84   ln -s /usr/share/webapps/element "${pkgdir}"/usr/lib/element/webapp
86   # Config file
87   ln -s /etc/element/config.json "${pkgdir}"/etc/webapps/element/config.json
88   install -Dm644 element.io/release/config.json -t "${pkgdir}"/etc/element
90   # Required extras
91   install -Dm644 ../io.element.Element.desktop -t "${pkgdir}"/usr/share/applications/
92   install -Dm755 ../${pkgname}.sh "${pkgdir}"/usr/bin/${pkgname}
94   # Icons
95   install -Dm644 ../element-web-${pkgver}/res/themes/element/img/logos/element-logo.svg "${pkgdir}"/usr/share/icons/hicolor/scalable/apps/io.element.Element.svg
96   for i in 16 24 48 64 96 128 256 512; do
97     install -Dm644 build/icons/${i}x${i}.png "${pkgdir}"/usr/share/icons/hicolor/${i}x${i}/apps/io.element.Element.png
98   done