# Template file for 'libfm'
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/libfm-extra"
#
pkgname=libfm
version=1.3.0.2
revision=1
build_style=gnu-configure
configure_args="--enable-udisks --disable-static"
hostmakedepends="automake gettext-devel glib-devel gtk-doc intltool libtool
 pkg-config vala-devel"
makedepends="dbus-glib-devel gtk+-devel libexif-devel menu-cache-devel"
depends="libfm-extra>=${version}"
short_desc="Core library of PCManFM file manager"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2.0-or-later"
homepage="http://pcmanfm.sourceforge.net/"
distfiles="${SOURCEFORGE_SITE}/pcmanfm/${pkgname}-${version}.tar.xz"
checksum=18d06f7996ce1cf8947df6e106bc0338c6ae0c4138c316f2501f6f6f435c7c72
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_package() {
	short_desc+=" - GTK+ library"
	pkg_install() {
		vmove usr/bin
		vmove usr/lib/libfm-gtk.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-devel_package() {
	depends="gtk+-devel
	 libfm-devel>=${version}_${revision} libfm-gtk>=${version}_${revision}"
	short_desc+=" - GTK+ library (development files)"
	pkg_install() {
		vmove usr/lib/libfm-gtk.so
		vmove usr/lib/pkgconfig/libfm-gtk.pc
	}
}
