commit e3b07468234ce8cbe1e010b9a909d2594badb226
parent 543ff7469aed294f8e19b35964d68db9b93dedd7
Author: Michal Suchanek <hramrach@centrum.cz>
Date: Sun, 21 Mar 2010 23:28:56 +0100
Add rules for creating Debian package automatically
Diffstat:
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/Makefile.in b/Makefile.in
@@ -106,6 +106,7 @@ tar:
tar zcf $(PWD)/$(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION))
rm -rf $(STAGING)
+include debian/Makefile.pkgdeb
config.rng.h: @srcdir@/config.rng
@SED@ -e 's/"/\\"/g' -e 's/\(.*\)/ "\1" \\/' \
diff --git a/debian/Makefile.pkgdeb b/debian/Makefile.pkgdeb
@@ -0,0 +1,43 @@
+deb_package = $(shell dpkg-parsechangelog | grep ^Source: | sed -e s,'^Source: ',,)
+deb_version = $(shell dpkg-parsechangelog | grep ^Version: | sed -e s,'^Version: ',, -e 's,-.*,,')
+revision = $(shell dpkg-parsechangelog | grep ^Version: | sed -e -e 's,.*-,,')
+architecture = $(shell dpkg --print-architecture)
+tar_dir = $(PACKAGE)-$(VERSION)
+tar_gz = $(tar_dir).tar.gz
+pkg_deb_dir = pkgdeb
+unpack_dir = $(pkg_deb_dir)/$(tar_dir)
+orig_tar_gz = $(pkg_deb_dir)/$(PACKAGE)_$(VERSION).orig.tar.gz
+pkg_deb_src = $(pkg_deb_dir)/$(PACKAGE)_$(VERSION)-$(revision)_source.changes
+pkg_deb_bin = $(pkg_deb_dir)/$(PACKAGE)_$(VERSION)-$(revision)_$(architecture).changes
+
+#deb_pkg_key = -kCB8C5858
+deb_pkg_key = -us -uc
+
+debclean:
+ rm -rf $(pkg_deb_dir)
+
+deb: debsrc debbin
+
+debbin: $(unpack_dir)
+ cd $(unpack_dir) && dpkg-buildpackage -b $(deb_pkg_key)
+
+debsrc: $(unpack_dir)
+ cd $(unpack_dir) && dpkg-buildpackage -S $(deb_pkg_key)
+
+$(unpack_dir): $(orig_tar_gz)
+ tar -zxf $(orig_tar_gz) -C $(pkg_deb_dir)
+ [ $(VERSION) = $(deb_version) ] || \
+ ( cd $(unpack_dir) && debchange -m -v $(VERSION)-1 New upstream release $(VERSION). )
+ # Remove requirements for preparing the release tarball
+ # from the Debian control file
+ sed -i -e '/^ autoconf/d' -e '/^ devscripts/d' $(unpack_dir)/debian/control
+
+$(tar_gz): tar
+
+$(orig_tar_gz): $(tar_gz) debclean
+ mkdir $(pkg_deb_dir)
+ [ $(PACKAGE) = $(deb_package) ]
+ ln -s ../$(tar_gz) $(orig_tar_gz)
+
+
+