void-packages/srcpkgs/element-desktop/template

107 lines
3.6 KiB
Bash

# Template file for 'element-desktop'
pkgname=element-desktop
version=1.11.3
revision=1
create_wrksrc=yes
conf_files="/etc/${pkgname}/config.json"
hostmakedepends="git yarn nodejs rust cargo python3 curl
sqlcipher-devel libappindicator-devel libnotify-devel pkg-config
app-builder jq moreutils"
makedepends="libsecret-devel"
depends="c-ares ffmpeg gtk+3 http-parser libevent
libxslt minizip nss re2 snappy sqlcipher electron19"
short_desc="Glossy Matrix collaboration client, desktop version"
maintainer="Jan Christian Grünhage <jan.christian@gruenhage.xyz>"
license="Apache-2.0"
homepage="https://element.io"
changelog="https://raw.githubusercontent.com/vector-im/element-desktop/develop/CHANGELOG.md"
distfiles="https://github.com/vector-im/element-desktop/archive/v${version}.tar.gz>element-desktop.tar.gz
https://github.com/vector-im/element-web/archive/v${version}.tar.gz>element-web.tar.gz"
checksum="36205847fa61e17fc2a2ab40c066ea08f901987e16541a9f0817ad8314bd2a72
f75f431295091ff5c43e21d0c58d504f37c45ef57550926ecbeefe7a01c83c48"
export USE_SYSTEM_APP_BUILDER=true
post_extract() {
mv ${pkgname}-${version} ${pkgname}
mv ${pkgname/desktop/web}-${version} ${pkgname/desktop/web}
}
pre_patch() {
for patch in ${pkgname}_*.patch; do
ln -s ../${patch} ${pkgname}
done
for patch in ${pkgname/desktop/web}_*.patch; do
ln -s ../${patch} ${pkgname/desktop/web}
done
}
pre_build() {
# since element 1.8.x it's necessary to force the npm arch
# to x86, otherwise it will fail in electron js stuff on
# platforms officially unsupported by electron (ppc64le...)
local carch=x64
case "$XBPS_TARGET_MACHINE" in
i686*) carch=ia32 ;;
esac
cd ${pkgname/desktop/web}
# Disable auto-updating
jq '.update_base_url = ""' element.io/app/config.json | sponge element.io/app/config.json
# Build dependencies for element-web
npm_config_arch=$carch yarn install
# Build dependencies and alterations for element-desktop
cd ../${pkgname}
vsed -i 's/"target": "deb"/"target": "dir"/g' package.json
npm_config_arch=$carch yarn install
}
do_build() {
cd ${pkgname/desktop/web}
yarn build
cd ../${pkgname}
if [ "$CROSS_BUILD" ]; then
yarn run build:native --target ${XBPS_CROSS_RUST_TARGET}
else
yarn run build:native
fi
# normally just "yarn run build" would be okay, but at least on ppc64
# we need to force x86_64 arch as electron-builder does not support
# ppc64 and fails on arch detection; ARM is supported so just use build
case "$XBPS_TARGET_MACHINE" in
x86_64*|ppc64*) yarn run build:64 ;;
i686*) yarn run build:32 ;;
*) yarn run build ;;
esac
}
do_install() {
cd ${pkgname/desktop/web}
vmkdir usr/lib/element-desktop
vmkdir etc/element-desktop
case "$XBPS_TARGET_MACHINE" in
i686*) vcopy ../element-desktop/dist/linux-ia32-unpacked/resources /usr/lib/element-desktop/resources;;
*) vcopy ../element-desktop/dist/linux-unpacked/resources /usr/lib/element-desktop/resources
esac
vinstall config.sample.json 644 /etc/element-desktop/ config.json
vcopy webapp /usr/lib/element-desktop/resources
ln -s /etc/element-desktop/config.json $DESTDIR/usr/lib/element-desktop/resources/webapp/config.json
vbin ${FILESDIR}/element-desktop
ln -s element-desktop $DESTDIR/usr/bin/riot-desktop
vinstall ${FILESDIR}/element-desktop.desktop 644 /usr/share/applications/ element-desktop.desktop
vinstall webapp/themes/element/img/logos/element-logo.svg 644 /usr/share/icons/hicolor/scalable/apps/ element.svg
for i in 16 24 48 64 96 128 256 512; do
vinstall ../element-desktop/build/icons/${i}x${i}.png 644 /usr/share/icons/hicolor/${i}x${i}/apps/ element.png
done
}
riot-desktop_package() {
depends="element-desktop"
short_desc+=" (transitional dummy package)"
build_style=meta
}