# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=thunar
pkgver=4.18.11
pkgrel=0
pkgdesc="File manager for Xfce"
url="https://docs.xfce.org/xfce/thunar/start"
arch="all"
license="GPL-2.0-or-later LGPL-2.0-only"
depends="desktop-file-utils hicolor-icon-theme shared-mime-info"
depends_dev="exo-dev"
makedepends="
	$depends_dev
	dbus-glib-dev
	glib-dev
	gobject-introspection-dev
	gtk+3.0-dev
	intltool
	libexif-dev
	libgudev-dev
	libnotify-dev
	libxfce4ui-dev
	pcre2-dev
	startup-notification-dev
	xfce4-panel-dev
	"
install="$pkgname.post-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="https://archive.xfce.org/src/xfce/thunar/${pkgver%.*}/thunar-$pkgver.tar.bz2
	thunar-sendto-audacious-playlist.desktop
	thunar-sendto-bluetooth.desktop
	"

prepare() {
	# fix icon in thunar-sendto-email.desktop
	sed -i 's!internet-mail!mail-message-new!' \
		plugins/thunar-sendto-email/thunar-sendto-email.desktop.in.in
	default_prepare
}

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--libexecdir=/usr/lib \
		--localstatedir=/var \
		--disable-static \
		--enable-exif \
		--enable-pcre \
		--enable-gio-unix \
		--enable-gudev
	make
}

check() {
	make check
}

package() {
	local f
	make DESTDIR="$pkgdir" install
	for f in $source; do
		case $f in
		thunar-sendto*.desktop)
			install -m644 "$srcdir"/$f \
				"$pkgdir"/usr/share/Thunar/sendto/
			;;
		esac
	done
	rm -rf "$pkgdir"/usr/lib/systemd
}

sha512sums="
1ed9dbcbf5f87fcbf61d89e023d89fef9ba436bbb698639367c94f5761e1f9f919c48599f19cd159044be8190a5cda5bfaf9da7701730b095c8d20243e4a7b3a  thunar-4.18.11.tar.bz2
dce525f22abf8e723111673b8fdad48079d5379cef49cc013383bb0944274cdd0de1dda6e8894dd8c9efb54cc9eea2baf8f4c76265665b84f3f58aeb01c72390  thunar-sendto-audacious-playlist.desktop
b4e8024e093b8e3f9bf5d460335fd9d19c1e394383bd58a7ac05c720103612dea9dde8a02f090f0af09d89e6644b292236ef257dd1790eccd627efce0577828e  thunar-sendto-bluetooth.desktop
"
