ayaports/backports/element-desktop/APKBUILD

167 lines
4.8 KiB
Text

# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
maintainer="lauren n. liberda <lauren@selfisekai.rocks>"
pkgname=element-desktop
pkgver=1.11.93
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"
_electronver=33
depends="
electron~$_electronver
font-inconsolata
font-inter
font-nunito
font-opensans
font-twemoji
"
makedepends="
cargo
electron-dev~$_electronver
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="
cf9c32bce22ecde504beed6532a59faa6133a362c8379fd615ecb1e3b6ad7fdf51b6a77e8a044a2a9b9f25946ec70245006137b2954c2a941ea172832637f337 element-desktop-1.11.93.tar.gz
1b058ee70d7a7858d40b0b24311e90fb0f51d4ff82f6efb2566ba57c33864c852898ace2223ccaf6eb60de12c469fe5facfe0588617134f430b9361e815689ef element-web-1.11.93.tar.gz
4747893ed3e43d3074e9afe1cdd668a6be0de073d439205fe8c38c5e0f4091cc76e3cd15d98818bea5139add29501d8d07e83c58e9da230a4ce5bb538d388f80 add-alpine-targets.patch
755b17f7b828eb6920c06a6950ad4e14c32c99d22e9c05fcef7a081b5d2034adb03db3958aa5209c99fb7201f4d888c2383fc9864c5e743dd33f8b5c4925acd7 use-system-headers.patch
92e69817fdc71f60c5c7dcbd3c7b13428cc18141cf5f27720326390f6817bec85fb1c60f8016b3a8fa275f601b16f646cda12b5e379a349368eef2f801b4de7a tasje-one-hak.patch
a1399662bdbe5e7256d31f7bdc05070e7009d70113699856b025a1d5ab1d9b8bf1020072a08255d4eddab0874044131dec296f98a91ba5c12ca61948b1d18dbe tasje-no-fuses.patch
ec635fde026f7fce8e8cc57960b5b9dcec4418416d4867ed47711422d48f068bb58a3c9ceb7715efc9c177beca3788da6b0babc9b689ea8c0724a0395f2b85f8 no-source-maps.patch.web
aaf46476bac403aa5204aa265fcf0654fad4c149fd74d0ec4273c051a5549943384cae3cdd62c5b78fdedfed55c11ecceb898b886e44165cbe7e30953a095cf9 use-system-fonts.patch.web
afc588311dc3b566a754e3e7fe6b37b99a06d47b8bbce0ed9acca8ef308fdab0bd1d41b406199e5cbdd86bdce695ff847cd8668857a235cbdc292ad8b899c063 element-desktop
"