template

2.8 KB · 119 lines
GITHUB
# Template file for 'ferdium'
pkgname=ferdium
version=7.2.3
revision=2
archs="x86_64 aarch64"
create_wrksrc=yes
depends="
 alsa-lib
 at-spi2-core
 cairo
 cups
 dbus
 expat
 glib
 gtk+3
 libevent
 libsecret
 libX11
 libXcomposite
 libXdamage
 libXext
 libXfixes
 libXrandr
 libXScrnSaver
 libdrm
 libxcb
 libxkbcommon
 libxkbfile
 libxshmfence
 libxslt
 mesa
 minizip
 nspr
 nss
 pango
 re2
 snappy
 xdg-utils
"
short_desc="All your services in one place, built by the community"
maintainer="AmarBego <[email protected]>"
license="Apache-2.0"
homepage="https://ferdium.org/"
# Binary repackage
restricted=no
nopie=yes
nostrip=yes
noshlibprovides=yes

_baseurl="https://github.com/ferdium/ferdium-app/releases/download/v${version}"

case "$XBPS_TARGET_MACHINE" in
	x86_64)
		distfiles="${_baseurl}/Ferdium-linux-${version}-amd64.deb"
		checksum=f8a3f5d3b6bc4e6af6a91f291fe807b97a84aa20b91313c65e860ea95d54adba
		;;
	aarch64)
		distfiles="${_baseurl}/Ferdium-linux-${version}-arm64.deb"
		checksum=e979ee4aa1ce2710144531967e2e10501bf889cb4b9a3789028cab3e0fa8f818
		;;
esac

hostmakedepends="file tar"

do_install() {
	# Extract and copy contents (deb is already extracted to $wrksrc by xbps-src)
	# Structure in deb: usr/ opt/
	
	# Move /opt/Ferdium to destination
	vmkdir opt
	vcopy opt/Ferdium opt

	if [ "$XBPS_TARGET_MACHINE" = aarch64 ]; then
		local _modules="${DESTDIR}/opt/Ferdium/resources/app.asar.unpacked/node_modules"
		# The upstream ARM64 deb also bundles an unused x86-64 SQLite binding.
		rm -rf "${_modules}/sqlite3/lib/binding/napi-v6-linux-glibc-x64"

		# v7.2.3 ships an x86-64-only software-passkey addon in its ARM64 deb.
		# Its loader already treats missing/unloadable addons as unavailable.
		# Remove the unusable binary, but preserve a future native ARM64 build.
		local _webauthn="${_modules}/electron-webauthn-linux/dist/native/webauthn-native.node"
		if [ -f "$_webauthn" ]; then
			case "$(LC_ALL=C file -b "$_webauthn")" in
				*"x86-64"*) rm -f "$_webauthn" ;;
			esac
		fi
	fi
	
	# Install desktop file and icons provided in the deb
	# Verify where they are in the deb extracted structure
	if [ -d usr/share ]; then
		vcopy usr/share usr
	fi
	
	# Create wrapper script with Wayland support and user flags config
	cat > ferdium.sh <<EOF
#!/bin/bash
XDG_CONFIG_HOME=\${XDG_CONFIG_HOME:-~/.config}

# Allow users to override command-line options
if [[ -f \$XDG_CONFIG_HOME/ferdium-flags.conf ]]; then
   FERDIUM_USER_FLAGS="\$(sed 's/#.*//' \$XDG_CONFIG_HOME/ferdium-flags.conf | tr '\n' ' ')"
fi

# Wayland native support
if [[ \$XDG_SESSION_TYPE == "wayland" ]]; then
   WAYLAND_FLAGS="--ozone-platform=wayland --enable-features=WaylandWindowDecorations"
fi

exec /opt/Ferdium/ferdium "\$@" \$WAYLAND_FLAGS \$FERDIUM_USER_FLAGS
EOF
	vbin ferdium.sh ferdium
	
	# License
	if [ -f opt/Ferdium/LICENSE.electron.txt ]; then
		vlicense opt/Ferdium/LICENSE.electron.txt LICENSE
	fi
}

Part of ferdium