#!/usr/bin/make -f

export PWD=$(shell pwd)

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

LDFLAGS+=-Wl,-z,defs -Wl,--as-needed
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

override_dh_auto_configure:
	dh_auto_configure -- --with-vendor-info=Xubuntu --with-x \
		--with-browser=midori --libexecdir=\$${prefix}/lib
	

override_dh_install:
	rm -f `pwd`/debian/xfce4-utils/usr/lib/xfce4/mcs-plugins/*.la
	rm -f `pwd`/debian/xfce4-utils/usr/lib/xfce4/mcs-plugins/*.a

	# we do not need the migration any more
	rm -f `pwd`/debian/xfce4-utils/usr/lib/xfce4/xfconf-migration/*.pl `pwd`/debian/xfce4-utils/etc/xdg/autostart/*migration*.desktop
	rmdir `pwd`/debian/xfce4-utils/usr/lib/xfce4/xfconf-migration `pwd`/debian/xfce4-utils/etc/xdg/autostart

	install -m 644 `pwd`/debian/Xubuntu \
		`pwd`/debian/xfce4-utils/usr/share/xfce4/

	chrpath -d -k `pwd`/debian/xfce4-utils/usr/bin/xfrun4 \
		`pwd`/debian/xfce4-utils/usr/bin/xfce4-about
	chmod +x `pwd`/debian/xfce4-utils/etc/xdg/xfce4/xinitrc

%:
	dh $@
