#!/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-arch:
	dh_install -a
	# 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
	[ ! -d $(DESTDIR)-data ] || find $(DESTDIR)-data/ -type d -empty -delete

override_dh_install-indep:
	dh_install -i
	install -d $(DESTDIR)/usr/share/pixmaps
	convert resources/images/fritzing_icon.png -resize 32x32 \
		$(DESTDIR)/usr/share/pixmaps/fritzing_icon.xpm

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
