#!/usr/bin/make -f

#include /usr/share/quilt/quilt.make


LDFLAGS+=-Wl,-z,defs -Wl,--as-needed

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

override_dh_install:
	perl -i -pe 's/Exec=Terminal/Exec=exo-open --launch TerminalEmulator/' $(CURDIR)/debian/tmp/etc/xdg/xfce4/panel/launcher*
	rm -f $(CURDIR)/debian/tmp/etc/xdg/xfce4/panel/launcher-8.rc
	sed -i '/<item name=\"launcher\" id=\"8\"\/>/d' $(CURDIR)/debian/tmp/etc/xdg/xfce4/panel/panels.xml

	rm -f $(CURDIR)/debian/tmp/usr/lib/xfce4/panel-plugins/*.la
	rm -f $(CURDIR)/debian/tmp/usr/lib/xfce4/panel-plugins/*.a
	rm -f $(CURDIR)/debian/tmp/usr/lib/xfce4/mcs-plugins/*.la
	rm -f $(CURDIR)/debian/tmp/usr/lib/xfce4/mcs-plugins/*.a
	rm -f $(CURDIR)/debian/tmp/usr/lib/libxfce4panel.la

	chrpath -d -k $(CURDIR)/debian/tmp/usr/bin/xfce4-panel \
		$(CURDIR)/debian/tmp/usr/bin/xfce4-popup-windowlist \
		$(CURDIR)/debian/tmp/usr/lib/xfce4/*/* \
		$(CURDIR)/debian/tmp/usr/lib/libxfce4panel.so.*1

	dh_install --fail-missing --sourcedir=debian/tmp

override_dh_strip:
	dh_strip --dbg-package=xfce4-panel-dbg

%:
	dh $@
