set -e
+PACKAGE="$(dpkg-parsechangelog | sed 's/^Source: //; t; d')"
+test -n "$PACKAGE"
+
# Get the main upstream tarball URL and version via uscan.
while read line; do
if [ "${line#http://}" != "$line" -a "${line#* }" = "$line" ]; then
# Unpack, combine and repack.
tar xzf $main_file
tar xzf $doc_file
-mv $main_dir ion3-$version.orig
-mv $doc_dir ion3-$version.orig/doc
-tar cf - ion3-$version.orig | gzip -c9 > ion3_$version.orig.tar.gz
+mv $main_dir $PACKAGE-$version.orig
+mv $doc_dir $PACKAGE-$version.orig/doc
+tar cf - $PACKAGE-$version.orig | gzip -c9 > $PACKAGE_$version.orig.tar.gz
# Clean up.
-rm -rf $main_file $doc_file ion3-$version.orig
+rm -rf $main_file $doc_file $PACKAGE-$version.orig
include /usr/share/quilt/quilt.make
-PACKAGE := ion3
+PACKAGE := $(shell dpkg-parsechangelog | sed -r 's/^Source: //; t; d')
PACKAGE_DEV := $(PACKAGE)-dev
PACKAGE_DOC := $(PACKAGE)-doc
INSTDIR := debian/$(PACKAGE)
# automatically keep track of api version
echo Ion:ApiVersion=$$((cat version.h; echo ION_API_VERSION) \
- | cpp -P | tail -1 | sed 's/"//g') >>debian/ion3-dev.substvars
+ | cpp -P | tail -1 | sed 's/"//g') >>debian/$(PACKAGE_DEV).substvars
dh_installchangelogs -i
dh_installdocs -i
# automatically keep track of api version
echo Ion:ApiVersion=$$((cat version.h; echo ION_API_VERSION) \
- | cpp -P | tail -1 | sed 's/"//g') >>debian/ion3.substvars
+ | cpp -P | tail -1 | sed 's/"//g') >>debian/$(PACKAGE).substvars
dh_installchangelogs -a
dh_installdocs -a
- rm -f $(INSTDIR)/usr/share/doc/ion3/LICENSE
- mv $(INSTDIR)/usr/share/doc/ion3/ChangeLog $(INSTDIR)/usr/share/doc/ion3/changelog
+ rm -f $(INSTDIR)/usr/share/doc/$(PACKAGE)/LICENSE
+ mv $(INSTDIR)/usr/share/doc/$(PACKAGE)/ChangeLog $(INSTDIR)/usr/share/doc/$(PACKAGE)/changelog
# dh_installexamples -a
# dh_install -a
dh_installmenu -a
- install -m644 debian/ion3.menu-method.i18n \
- $(INSTDIR)/etc/menu-methods/ion3-i18n
+ install -m644 debian/$(PACKAGE).menu-method.i18n \
+ $(INSTDIR)/etc/menu-methods/$(PACKAGE)-i18n
dh_installdebconf -a
# dh_installlogrotate -a
# dh_makeshlibs -a
dh_installdeb -a
sed -i 's/^DEBIAN_VERSION=/&$(DEBIAN_VERSION)/; s/^UPSTREAM_VERSION=/&$(UPSTREAM_VERSION)/' \
- debian/ion3/DEBIAN/postinst
+ $(INSTDIR)/DEBIAN/postinst
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a