#!/usr/bin/make -f
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

GS_CONFIGURE_FLAGS = --libdir=/usr/lib \
		--disable-silent-rules

# Install target dir
INSTALLDIR = $(CURDIR)/debian/tmp

%:
	dh $@ --with gnome,autoreconf

override_dh_auto_configure:
	dh_auto_configure -- $(GS_CONFIGURE_FLAGS)

override_dh_auto_build:
	cp debian/ubuntu-one.png src/plugins
	dh_auto_build

override_dh_auto_install:
	dh_auto_install --destdir=$(INSTALLDIR)
	rm -f $(INSTALLDIR)/usr/lib/gs-plugins-?/libgs_plugin_fedora*

override_dh_install:
	dh_install -X.a -X.la --list-missing
	# Change the name and icon for Unity sessions
	sed -i 's/Name=Software/Name=Ubuntu Software/' debian/ubuntu-software/usr/share/ubuntu/applications/org.gnome.Software.desktop
	sed -i 's/Icon=org.gnome.Software/Icon=ubuntusoftware/' debian/ubuntu-software/usr/share/ubuntu/applications/org.gnome.Software.desktop

# Hack to include some translations, we can drop that once we get a langpack update
# Includes the strings from the locales that have translations on launchpad but
# de/it/pt are not needed because their translation is the original english string
override_dh_translations:
	dh_translations
	echo "Name[es]=Software de Ubuntu" >> debian/ubuntu-software/usr/share/ubuntu/applications/org.gnome.Software.desktop
	echo "Name[fr]=Logiciels Ubuntu" >> debian/ubuntu-software/usr/share/ubuntu/applications/org.gnome.Software.desktop
	echo "Name[zh_CN]=Ubuntu 软件" >> debian/ubuntu-software/usr/share/ubuntu/applications/org.gnome.Software.desktop

override_dh_makeshlibs:
	dh_makeshlibs -Xlibgs_plugin

override_dh_auto_test:
