# Template file for 'apache-directory-studio-bin'
pkgname=apache-directory-studio-bin
_pkgname=ApacheDirectoryStudio
version=2.0.0.v20210717+M17
revision=1
_version="${version/+/-}"
archs="x86_64"
depends="virtual?java-runtime gtk+3 desktop-file-utils"
short_desc="LDAP browser and directory client"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://directory.apache.org/studio/"
distfiles="https://dlcdn.apache.org/directory/studio/${_version}/${_pkgname}-${_version}-linux.gtk.x86_64.tar.gz
 https://dlcdn.apache.org/directory/studio/${_version}/${_pkgname}-${_version}-src.zip"
checksum="24764eff94ad3a257a899d34f9933276af0d201fba9017d6737558b2ffd5eda7
 705d39148a0a3caf62c3f286726e2c289bdffc4b05671d7fe8a61ac41b5cc4f4"
python_version=3
nopie=yes
skip_extraction="${_pkgname}-${_version}-src.zip"

post_extract() {
	bsdtar --strip-components 3 -xf "${XBPS_SRCDISTDIR}/${pkgname}-${version}/${_pkgname}-${_version}-src.zip" \
		"org.apache.directory.studio.parent-${_version}/tools/Debian Package/package"
}

post_patch() {
	vsed -i -e "s/apachedirectorystudio/&bin/; /Exec/a Icon=${_pkgname,,}" \
		package/usr/share/applications/${_pkgname,,}.desktop
}

do_install() {
	vmkdir opt/${_pkgname}
	vcopy * opt/${_pkgname}
	vinstall package/usr/share/applications/${_pkgname,,}.desktop 644 usr/share/applications
	vinstall package/usr/share/pixmaps/${_pkgname,,}.xpm 644 usr/share/pixmaps
	vmkdir usr/bin
	ln -sf /opt/${_pkgname}/${_pkgname} ${DESTDIR}/usr/bin/${_pkgname}
	ln -sf /opt/${_pkgname}/${_pkgname} ${DESTDIR}/usr/bin/${pkgname//-/}
}

apache-directory-studio_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	build_style=meta
	short_desc+=" (transitional dummy package)"
}
