template

2.2 KB · 84 lines
GITHUB
# Template file for 'zed'
pkgname=zed
version=1.25.2
revision=1
archs="x86_64 aarch64"
create_wrksrc=yes
hostmakedepends="tar"
depends="
 alsa-lib
 curl
 fontconfig
 libgcc
 glibc
 libxcb
 libxkbcommon
 libxkbcommon-x11
 openssl
 sqlite
 vulkan-loader
 wayland
 zlib
 zstd
"
short_desc="A high-performance, multiplayer code editor from the creators of Atom and Tree-sitter"
maintainer="AmarBego <[email protected]>"
license="GPL-3.0-or-later OR AGPL-3.0-or-later OR Apache-2.0"
homepage="https://zed.dev"
nopie=yes
nostrip=yes
noshlibprovides=yes

case "${XBPS_TARGET_MACHINE}" in
	x86_64)
		distfiles="https://github.com/zed-industries/zed/releases/download/v${version}/zed-linux-x86_64.tar.gz"
		checksum="b405ebea810c82ff84854631e7b2853ae1f22dd1b7e306cb57726471c6617508"
		;;
	aarch64)
		distfiles="https://github.com/zed-industries/zed/releases/download/v${version}/zed-linux-aarch64.tar.gz"
		checksum="5cc192ea154b273efd9a090b76ec5fe482647cbc9aea27a41fb9b42d8c95d63c"
		;;
esac

_app_dir="zed.app"

do_install() {
	# Install to /opt/zed
	vmkdir opt/zed
	vcopy "${_app_dir}/*" opt/zed

	# Desktop file - modify to use absolute paths and add StartupWMClass
	_desktop_file="dev.zed.Zed.desktop"
	cp "${_app_dir}/share/applications/${_desktop_file}" "${_desktop_file}"
	vsed -i "${_desktop_file}" \
		-e "s#^Exec=zed#Exec=/usr/bin/zed#g" \
		-e "s#^TryExec=zed#TryExec=/usr/bin/zed#g" \
		-e "/^StartupNotify=true/a StartupWMClass=dev.zed.Zed"
	vinstall "${_desktop_file}" 644 usr/share/applications

	# Icons
	vcopy "${_app_dir}/share/icons" usr/share
	vinstall "${_app_dir}/share/icons/hicolor/512x512/apps/zed.png" 644 usr/share/pixmaps zed.png

	# Helper script with flags config support
	cat > zed.sh <<EOF
#!/bin/bash
XDG_CONFIG_HOME=\${XDG_CONFIG_HOME:-~/.config}

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

# Launch
exec /opt/zed/libexec/zed-editor "\$@" \$ZED_USER_FLAGS
EOF
	vbin zed.sh zed

	# Also create symlink for 'zeditor' command (common alternative name)
	ln -sf zed ${DESTDIR}/usr/bin/zeditor

	# License
	vlicense "${_app_dir}/licenses.md"
}

Part of zed