#!/usr/bin/make -f

DPKG_EXPORT_BUILDFLAGS = 1
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)

export QT_SELECT=qt5

DESTDIR=$(CURDIR)/debian/fritzing

%:
	dh $@

# Add here any variable or target overrides you need.

# Here is Helmut Grohne's patch (to close #886667)
$(DEB_BUILDDIR)/Makefile:
	dh_auto_configure --builddirectory=$(DEB_BUILDDIR)


override_dh_install:
	dh_install
	convert $(DESTDIR)/usr/share/pixmaps/fritzing_icon.png -resize 32x32 \
		$(DESTDIR)/usr/share/pixmaps/fritzing_icon.xpm
	# install a custom shell script to launch fritzing
	# to close bug  #847655
	mv $(DESTDIR)/usr/bin/Fritzing $(DESTDIR)/usr/bin/fritzing.real
	install -m 755 debian/Fritzing $(DESTDIR)/usr/bin/fritzing
	find $(DESTDIR)-data/ -type d -empty -delete

update-upstream-changelog:
	w3m -dump http://fritzing.org/download/history-changes/ \
	| sed '/^History of changes/,/First preview release/!d' > $(DEBDIR)/docs/changelog

get-packaged-orig-source:
	uscan --download-current-version
