diff --git a/debian/rules b/debian/rules index 79836d6f0..7d0c96508 100755 --- a/debian/rules +++ b/debian/rules @@ -40,15 +40,51 @@ export version abiname ltver kbuildver flavours patch: debian/patch-stamp debian/patch-stamp: debian/bin/apply + dh_testdir override_version=$(release) home=debian/patches debian/bin/apply +# make-kpkg does this when building kernel-source. + mv scripts/package/Makefile scripts/package/Makefile.dist + mv scripts/package/builddeb scripts/package/builddeb.dist + echo "# Dummy Makefile" > scripts/package/Makefile + echo "all:" >> scripts/package/Makefile touch debian/patch-stamp unpatch: + dh_testdir if [ -e debian/patch-stamp ]; then \ override_version=$(release) home=debian/patches \ debian/bin/apply $(version); \ - rm -f debian/patch-stamp; \ + cd scripts/package; \ + mv Makefile.dist Makefile; \ + mv builddeb.dist builddeb; \ fi + rm -f debian/patch-stamp +# +# Since we do not have separate build/install targets for the +# source, the stamp magic is somewhat redundant. At least, it +# will prevent rebuilding the package from an uncleaned tmpdir. +# +spkg := linux-source-$(version) +sdir := debian/$(spkg)/usr/src +tpkg := linux-tree-$(version)-$(ltver) +files = $(filter-out debian, $(shell echo *)) +source: debian/source-stamp +debian/source-stamp: debian/patch-stamp + dh_testdir + dh_testroot + dh_installdirs -p$(spkg) /usr/share/doc /usr/src +# Link the files and create a tarball in correct location + mkdir $(spkg) + cp -al $(files) $(spkg) + tar -cjf $(sdir)/$(spkg).tar.bz2 $(spkg) + rm -rf $(spkg) + dh_fixperms -p$(spkg) + dh_installdocs -p$(spkg) README debian/README.Debian + dh_installchangelogs -p$(spkg) + dh_compress -p$(spkg) + dh_installdeb -p$(spkg) + dh_gencontrol -p$(spkg) + dh_builddeb -p$(spkg) unpack: debian/linux-source-$(version).tar.bz2 unpack-stamp unpack-stamp: @@ -69,8 +105,10 @@ build-stamp: unpack-stamp done touch build-stamp -clean: +clean: unpatch dh_testdir + rm -f version.Debian + rm -rf linux-source-$(version) cd debian; \ rm -f *-stamp-* *-stamp config.*; \ rm -f header-install-* post-install-* bin/touch.orig; \ @@ -116,4 +154,4 @@ debian/linux-source-$(version).tar.bz2: debian/Makefile.source $(MAKE) -f debian/Makefile.source binary; \ fi -.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch +.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source