r3258 - branches/kernel-image-2.6.11/debian

Jurij Smakov jurij-guest@costa.debian.org
Sat, 28 May 2005 23:07:32 +0000


Author: jurij-guest
Date: 2005-05-28 23:07:32 +0000 (Sat, 28 May 2005)
New Revision: 3258

Modified:
   branches/kernel-image-2.6.11/debian/rules
Log:
Added the 'source' target which builds the
linux-source binary package.


Modified: branches/kernel-image-2.6.11/debian/rules
===================================================================
--- branches/kernel-image-2.6.11/debian/rules	2005-05-28 20:18:48 UTC (rev 3257)
+++ branches/kernel-image-2.6.11/debian/rules	2005-05-28 23:07:32 UTC (rev 3258)
@@ -40,15 +40,51 @@
 
 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 @@
 	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 @@
 	  $(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