void-packages/srcpkgs/Signal-Desktop/template

74 lines
2.5 KiB
Bash

# Template file for 'Signal-Desktop'
pkgname=Signal-Desktop
version=7.32.0
revision=1
# Signal officially only supports x86_64
# x86_64-musl could potentially work based on the Alpine port:
# https://git.alpinelinux.org/aports/tree/testing/signal-desktop
# ARM: https://github.com/signalapp/Signal-Desktop/issues/3410
archs="x86_64"
hostmakedepends="git git-lfs nodejs-lts python3 python3-distutils-extra tar"
depends="cairo gtk+3 libvips pango"
short_desc="Signal Private Messenger for Linux"
maintainer="Orphaned <orphan@voidlinux.org>"
license="AGPL-3.0-only"
homepage="https://github.com/signalapp/Signal-Desktop"
distfiles="https://github.com/signalapp/Signal-Desktop/archive/v${version}.tar.gz"
checksum=e6d51ff1b90bd39090057cdee56476e074e8708e021294cd5ed6b865cb5e3c4a
nostrip_files="signal-desktop"
post_extract() {
# git-lfs hook needs to be installed for one of the dependencies
git lfs install
vsed 's/"node": ".*"/"node": ">=20.0.0"/' -i package.json
# patch node fs with graceful-fs to avoid using too many file descriptors
npm add -D graceful-fs@4.2.11
echo "require('graceful-fs').gracefulify(require('fs'));" > ${wrksrc}/use-graceful-fs.js
export NODE_OPTIONS="--require ${wrksrc}/use-graceful-fs.js"
# Install dependencies for sticker-creator
npm --prefix ./sticker-creator/ install
# Install dependencies for signal-desktop
npm install --ignore-engines
}
do_build() {
# Build the sticker creator
npm --prefix ./sticker-creator/ run build
# Build signal-desktop
npm run build
# Extract the generated .desktop file
bsdtar xOf release/signal-desktop_*.deb data.tar.xz | \
bsdtar xO ./usr/share/applications/signal-desktop.desktop > signal-desktop.desktop
vsed -i -e 's/\/opt\/Signal\///' signal-desktop.desktop
}
do_install() {
vmkdir usr/lib/signal-desktop
# Remove prebuilt binaries for foreign architectures (to not confuse strip)
for prebin in darwin-x64 linux-arm64 win32-ia32 win32-x64; do
rm -rf release/linux-unpacked/resources/app.asar.unpacked/node_modules/{ffi-napi,ref-napi}/prebuilds/$prebin
rm -rf release/linux-unpacked/resources/app.asar.unpacked/node_modules/ffi-napi/node_modules/ref-napi/prebuilds/$prebin
done
vcopy release/linux-unpacked/* usr/lib/signal-desktop
vmkdir usr/bin
ln -s /usr/lib/signal-desktop/signal-desktop ${DESTDIR}/usr/bin/
vinstall signal-desktop.desktop 644 usr/share/applications
vmkdir usr/share/icons/hicolor
for size in 16 32 256; do
vinstall images/icon_${size}.png 644 usr/share/icons/hicolor/${size}x${size}/apps/ signal-desktop.png
done
vlicense LICENSE
}