# Template file for 'libfm'
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/libfm-extra"
#
pkgname=libfm
version=1.4.0
revision=2
build_style=gnu-configure
configure_args="--enable-udisks --disable-static --with-gtk=3"
hostmakedepends="automake gettext-devel glib-devel intltool libtool
 pkg-config vala-devel gtk-doc"
makedepends="dbus-glib-devel gtk+3-devel libexif-devel menu-cache-devel"
depends="libfm-extra>=${version}"
short_desc="Core library of PCManFM file manager"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://github.com/lxde/libfm"
distfiles="https://github.com/lxde/libfm/archive/refs/tags/${version}.tar.gz"
checksum=7d7b616411992389a4b7f35796109d605f30bc2ceab84d4081d1665254ebbf82
conf_files="/etc/xdg/libfm/libfm.conf"

pre_configure() {
	autoreconf -fi
}

post_install() {
	# remove files that belong to libfm-extra
	rm -f ${DESTDIR}/usr/lib/libfm-extra.so*
	rm -f ${DESTDIR}/usr/lib/pkgconfig/libfm-extra.pc
	rm -f ${DESTDIR}/usr/include/libfm/fm-{extra,version,xml-file}.h
	# move locales to /usr/share/locale (needed for musl libc)
	if [ -d ${DESTDIR}/usr/lib/locale ]; then
		mv ${DESTDIR}/usr/lib/locale ${DESTDIR}/usr/share
	fi
}

libfm-devel_package() {
	depends="glib-devel menu-cache-devel ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig/libfm.pc
		vmove usr/lib/libfm.so
	}
}

libfm-gtk+3_package() {
	short_desc+=" - GTK+3 library"
	replaces="libfm-gtk>=0"
	pkg_install() {
		vmove usr/bin
		vmove usr/lib/libfm-gtk3.so.*
		vmove usr/lib/libfm/modules/gtk-*.so
		vmove usr/share/applications
		vmove usr/share/libfm/images
		vmove usr/share/libfm/ui
		vmove usr/share/man
	}
}

libfm-gtk+3-devel_package() {
	depends="gtk+3-devel
	 libfm-devel>=${version}_${revision} libfm-gtk+3>=${version}_${revision}"
	short_desc+=" - GTK+3 library (development files)"
	replaces="libfm-gtk-devel>=0"
	pkg_install() {
		vmove usr/lib/libfm-gtk3.so
		vmove usr/lib/pkgconfig/libfm-gtk3.pc
	}
}
