# Contributor: lauren n. liberda maintainer="lauren n. liberda " pkgname=element-desktop pkgver=1.11.89 pkgrel=0 pkgdesc="Secure and independent communication, connected via Matrix" url="https://element.io/" arch="aarch64 x86_64" # same as electron license="GPL-3.0-only" depends=" electron font-inconsolata font-inter font-nunito font-opensans font-twemoji " makedepends=" cargo electron-dev electron-tasje jq libsecret-dev nodejs npm python3 py3-setuptools sqlcipher-dev swc yarn " source=" https://github.com/vector-im/element-desktop/archive/refs/tags/v$pkgver/element-desktop-$pkgver.tar.gz https://github.com/vector-im/element-web/archive/refs/tags/v$pkgver/element-web-$pkgver.tar.gz add-alpine-targets.patch use-system-headers.patch tasje-one-hak.patch tasje-no-fuses.patch no-source-maps.patch.web use-system-fonts.patch.web element-desktop " options="net !check" # broken # secfixes: # 1.11.30-r0: # - CVE-2023-30609 # 1.11.26-r0: # - CVE-2023-28103 # - CVE-2023-28427 # 1.11.7-r0: # - CVE-2022-39249 # - CVE-2022-39250 # - CVE-2022-39251 # - CVE-2022-39236 # 1.11.4-r0: # - CVE-2022-36059 # - CVE-2022-36060 # used by buildscripts (at least web's webpack) export VERSION=$pkgver export CARGO_PROFILE_RELEASE_OPT_LEVEL=2 export CARGO_PROFILE_RELEASE_STRIP="symbols" export NODE_OPTIONS="--openssl-legacy-provider" prepare() { default_prepare msg "Applying more patches" for x in $source; do case "$x" in *.patch.web) msg "$x" patch -p1 -i "$srcdir"/$x -d "$srcdir"/element-web-$pkgver ;; esac done rm -rf res/fonts ( cd "$srcdir"/element-web-$pkgver msg "Fetch element-web dependencies" yarn install --frozen-lockfile --ignore-scripts --ignore-engines jq '.show_labs_settings = true' < config.sample.json > config.json ) ln -s "$srcdir"/element-web-$pkgver/webapp webapp msg "Fetch element-desktop dependencies" yarn install --frozen-lockfile --ignore-scripts } build() { ( cd "$srcdir"/element-web-$pkgver msg "Build element-web" NODE_ENV=production yarn build ) msg "Build element-desktop" yarn asar-webapp # add "optional" native dependencies # hak stands for hack yarn run hak --target "$(uname -m)-alpine-linux-musl" # stripping in build because it gets into asar strip node_modules/keytar/build/Release/keytar.node yarn build:ts yarn build:res # we need it as js to be of any use for tasje. # fails with `yarn tsc`. https://github.com/electron-userland/electron-builder/issues/7961 swc compile electron-builder.ts --out-file electron-builder.mjs yarn install --frozen-lockfile --ignore-scripts --production tasje -c electron-builder.mjs pack } check() { ( cd "$srcdir"/element-web-$pkgver yarn test ) } package() { local resources="dist/resources" install -Dm644 $resources/app.asar "$pkgdir"/usr/lib/element-desktop/app.asar install -Dm644 webapp.asar "$pkgdir"/usr/lib/element-desktop/webapp.asar cp -r $resources/app.asar.unpacked "$pkgdir"/usr/lib/element-desktop/app.asar.unpacked install -Dm644 $resources/img/element.png "$pkgdir"/usr/lib/element-desktop/img/element.png install -Dm755 "$srcdir"/$pkgname "$pkgdir"/usr/bin/$pkgname install -Dm644 dist/$pkgname.desktop "$pkgdir"/usr/share/applications/$pkgname.desktop while read -r size; do install -Dm644 dist/icons/$size.png "$pkgdir"/usr/share/icons/hicolor/$size/apps/$pkgname.png done < dist/icons/size-list } sha512sums=" 3b382492694a036ab8e05e904f23e49d7126bf5842ab4b86183bb71e3ca3503bbe997a4e26c5ee2298740f0894e5f26d6dc31deb5f18caf9d4f78d30e1a591c8 element-desktop-1.11.89.tar.gz 55e4abf74bd19a06071d16a1e5d1130fc06c8937626e880bf54263598b7ad06311b164e3aa21dc2494b932e9e299f261030226744d746927b44b93b7831fd08b element-web-1.11.89.tar.gz 4747893ed3e43d3074e9afe1cdd668a6be0de073d439205fe8c38c5e0f4091cc76e3cd15d98818bea5139add29501d8d07e83c58e9da230a4ce5bb538d388f80 add-alpine-targets.patch 755b17f7b828eb6920c06a6950ad4e14c32c99d22e9c05fcef7a081b5d2034adb03db3958aa5209c99fb7201f4d888c2383fc9864c5e743dd33f8b5c4925acd7 use-system-headers.patch 92e69817fdc71f60c5c7dcbd3c7b13428cc18141cf5f27720326390f6817bec85fb1c60f8016b3a8fa275f601b16f646cda12b5e379a349368eef2f801b4de7a tasje-one-hak.patch 876d40639305d5258089069a01e218a2f14c32efccc3130f06398e8b4cd63bc740909162954a58ee11b909dc5b3e87c3383d73727aa13aa2d7093c9c63f04057 tasje-no-fuses.patch ec635fde026f7fce8e8cc57960b5b9dcec4418416d4867ed47711422d48f068bb58a3c9ceb7715efc9c177beca3788da6b0babc9b689ea8c0724a0395f2b85f8 no-source-maps.patch.web aaf46476bac403aa5204aa265fcf0654fad4c149fd74d0ec4273c051a5549943384cae3cdd62c5b78fdedfed55c11ecceb898b886e44165cbe7e30953a095cf9 use-system-fonts.patch.web afc588311dc3b566a754e3e7fe6b37b99a06d47b8bbce0ed9acca8ef308fdab0bd1d41b406199e5cbdd86bdce695ff847cd8668857a235cbdc292ad8b899c063 element-desktop "