Package: src:binutils
Severity: normal
Hi.

I've been talking to Wookey about building cross toolchains, binutils.
Here's a patch that's useful for that. It adds Built-Using tags to the
generated packages.

>From afe2e8bd3102847d40233084d7171befa5eb404d Mon Sep 17 00:00:00 2001
From: Dima Kogan <d...@oblong.com>
Date: Sat, 8 Feb 2014 22:01:45 +0000
Subject: [PATCH] Packages now have Built-Using tags

---
 debian/control.cross.in |    1 +
 debian/control.in       |    5 +++++
 debian/rules            |   20 ++++++++++++--------
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/debian/control.cross.in b/debian/control.cross.in
index 81f5328..5bf0aff 100644
--- a/debian/control.cross.in
+++ b/debian/control.cross.in
@@ -3,6 +3,7 @@ Architecture: any
 Depends: binutils, ${shlibs:Depends}
 Suggests: binutils-doc (= ${Source-Version})
 Priority: extra
+Built-Using: ${Built-Using}
 Description: GNU binary utilities, for __TARGET__ target
  This package provides GNU assembler, linker and binary utilities
  for __TARGET__ target, for use in a cross-compilation environment.
diff --git a/debian/control.in b/debian/control.in
index a504c4e..89c7e93 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -23,6 +23,7 @@ Replaces: binutils-gold (<< 2.20.51.20100415),
   binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3)
 Provides: elf-binutils, ${gold:Provides}
 Suggests: binutils-doc (>= ${source:Version})
+Built-Using: ${Built-Using}
 Description: GNU assembler, linker and binary utilities
  The programs in this package are used to assemble, link and manipulate
  binary and object files.  They may be used in conjunction with a compiler
@@ -35,6 +36,7 @@ Depends: binutils (= ${binary:Version})
 Conflicts: libbfd-dev
 Provides: libbfd-dev
 Replaces: libbfd-dev, libc5-dev
+Built-Using: ${Built-Using}
 Description: GNU binary utilities (BFD development files)
  This package includes header files and static libraries necessary to build
  programs which use the GNU BFD library, which is part of binutils.  Note
@@ -46,6 +48,7 @@ Architecture: any
 Priority: extra
 Depends: ${shlibs:Depends}, binutils (= ${binary:Version})
 Provides: multiarch-binutils
+Built-Using: ${Built-Using}
 Description: Binary utilities that support multi-arch targets
  The programs in this package are used to manipulate binary and object
  files that may have been created on other architectures.  This package
@@ -60,6 +63,7 @@ Architecture: any
 Depends: ${shlibs:Depends}, binutils (= ${binary:Version})
 Recommends: libc6-dev
 Suggests: binutils-doc (>= ${source:Version})
+Built-Using: ${Built-Using}
 Description: GNU assembler, linker and binary utilities targeted for hppa64-linux
  The programs in this package are used to assemble, link and manipulate
  binary and object files.  They may be used in conjunction with a compiler
@@ -75,6 +79,7 @@ Conflicts: spu-binutils
 Replaces: spu-binutils
 Provides: spu-binutils
 Suggests: binutils-doc (>= ${source:Version})
+Built-Using: ${Built-Using}
 Description: GNU assembler, linker and binary utilities targeted for spu-elf
  The programs in this package are used to assemble, link and manipulate
  binary and object files.  They may be used in conjunction with a compiler
diff --git a/debian/rules b/debian/rules
index 3e9ef83..b7a80f6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -873,6 +873,10 @@ install-spu-stamp: checkroot build-spu-stamp
 # binary-indep target #
 #######################
 
+THIS_PKG      := $(shell dpkg-parsechangelog | sed -n 's/-*//; s/^Source: \(.*\)/\1/p')
+THIS_PKG_VER  := $(shell dpkg-parsechangelog | sed -n 's/^Version: \(.*\)/\1/p')
+Built-Using   := $(THIS_PKG) (= $(THIS_PKG_VER))
+
 binary-indep: checkroot build install
 	$(checkdir)
 
@@ -899,7 +903,7 @@ ifneq ($(BACKPORT),true)
 	find $(d_doc)/$(PF)/share/doc/$(p_doc) -maxdepth 1 -type f ! -name copyright | xargs gzip -9
 	gzip -9 $(d_doc)/$(PF)/share/info/*
 
-	dpkg-gencontrol -isp -P$(d_doc) -p$(p_doc)
+	dpkg-gencontrol -isp -P$(d_doc) -p$(p_doc) -VBuilt-Using='$(Built-Using)'
 	chown -R root:root $(d_doc)
 	chmod -R go=rX  $(d_doc)
 	dpkg --build $(d_doc) ..
@@ -928,7 +932,7 @@ endif # ifndef BACKPORT
 	-chmod 755 $(d_src)/$(PF)/src/binutils/debian/*.{pre,post}{inst,rm}
 	chmod 755 $(d_src)/$(PF)/src/binutils/debian/test-suite-compare.py
 
-	dpkg-gencontrol -isp -P$(d_src) -p$(p_src)
+	dpkg-gencontrol -isp -P$(d_src) -p$(p_src) -VBuilt-Using='$(Built-Using)'
 	chown -R root:root $(d_src)
 	chmod -R go=rX  $(d_src)
 	dpkg --build $(d_src) ..
@@ -964,7 +968,7 @@ ifneq (,$(TARGET))
 
 	rm -f debian/substvars
 	dpkg-shlibdeps $(d_cross)/$(PF)/bin/*
-	dpkg-gencontrol -isp -P$(d_cross) -p$(p_cross)
+	dpkg-gencontrol -isp -P$(d_cross) -p$(p_cross) -VBuilt-Using='$(Built-Using)'
 	dpkg --build $(d_cross) ..
 
 else
@@ -1103,30 +1107,30 @@ endif
 
 	: # Finish it all up
 	find $(d_bin) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
-	dpkg-gencontrol -isp -P$(d_bin) -p$(p_bin) $(CONFLICTS) $(gold_provides)
+	dpkg-gencontrol -isp -P$(d_bin) -p$(p_bin) $(CONFLICTS) $(gold_provides) -VBuilt-Using='$(Built-Using)'
 	cd $(d_bin) && find -type f  ! -regex './DEBIAN/.*' -printf '%P\n' | xargs md5sum > DEBIAN/md5sums
 
 	rm -f debian/substvars
-	dpkg-gencontrol -isp -P$(d_dev) -p$(p_dev)
+	dpkg-gencontrol -isp -P$(d_dev) -p$(p_dev) -VBuilt-Using='$(Built-Using)'
 	cd $(d_dev) && find -type f  ! -regex './DEBIAN/.*' -printf '%P\n' | xargs md5sum > DEBIAN/md5sums
 
 ifeq ($(with_multiarch),yes)
 	rm -f debian/substvars
 	find $(d_mul) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
-	dpkg-gencontrol -isp -P$(d_mul) -p$(p_mul)
+	dpkg-gencontrol -isp -P$(d_mul) -p$(p_mul) -VBuilt-Using='$(Built-Using)'
 	cd $(d_mul) && find -type f  ! -regex './DEBIAN/.*' -printf '%P\n' | xargs md5sum > DEBIAN/md5sums
 endif
 
 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
 	rm -f debian/substvars
 	find $(d_spu) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
-	dpkg-gencontrol -isp -P$(d_spu) -p$(p_spu)
+	dpkg-gencontrol -isp -P$(d_spu) -p$(p_spu) -VBuilt-Using='$(Built-Using)'
 	cd $(d_spu) && find -type f  ! -regex './DEBIAN/.*' -printf '%P\n' | xargs md5sum > DEBIAN/md5sums
 endif
 ifeq ($(DEB_HOST_ARCH),hppa)
 	rm -f debian/substvars
 	find $(d_hppa64) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
-	dpkg-gencontrol -isp -P$(d_hppa64) -p$(p_hppa64)
+	dpkg-gencontrol -isp -P$(d_hppa64) -p$(p_hppa64) -VBuilt-Using='$(Built-Using)'
 	cd $(d_hppa64) && find -type f  ! -regex './DEBIAN/.*' -printf '%P\n' | xargs md5sum > DEBIAN/md5sums
 endif
 
-- 
1.7.10.4

Reply via email to