Source: binutils
Version: 2.29.1-10
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

Hi Matthias,

I noticed that binutils now fails to cross build from source. I guess
that this was introduced with the dwz change. Simply prefixing the
relevant tools with the host triplet fixes the build.

I took this opportunity to clean up the cross handling in my patch. It
relies on binutils and gcc providing the host triplet symlinks and they
do that in both jessie and trusty, so this should be fine and simplifies
the packaging. Please consider applying the attached patch.

Helmut
diff --minimal -Nru binutils-2.29.1/debian/changelog 
binutils-2.29.1/debian/changelog
--- binutils-2.29.1/debian/changelog
+++ binutils-2.29.1/debian/changelog
@@ -1,3 +1,10 @@
+binutils (2.29.1-10.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Use host tools. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 08 Dec 2017 15:50:09 +0100
+
 binutils (2.29.1-10) unstable; urgency=medium
 
   * Update, taken from the 2.29 branch 20171201.
diff --minimal -Nru binutils-2.29.1/debian/rules binutils-2.29.1/debian/rules
--- binutils-2.29.1/debian/rules
+++ binutils-2.29.1/debian/rules
@@ -94,7 +94,7 @@
 install_dir    = install -d -m 755
 install_file   = install -m 644
 install_script = install -m 755
-install_binary = install -m 755 -s
+install_binary = install -m 755 -s --strip-program="$(STRIP)"
 
 NATIVE_ARCHS ?= amd64 i386 arm64 armhf armel mips mipsel mips64el \
        ppc64el s390x
@@ -238,20 +238,13 @@
 
 with_multiarch := yes
 
-CC     = gcc
-CXX    = g++
 CFLAGS = -g -O2
 CXXFLAGS = -g -O2
 LDFLAGS =
-STRIP  = strip --remove-section=.comment --remove-section=.note
-CROSS :=
-ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-  CROSS := $(DEB_HOST_GNU_TYPE)-
-  CC   = $(CROSS)gcc
-  CXX  = $(CROSS)g++
-  STRIP= $(CURDIR)/debian/strip.cross
-  install_binary = install -m 755 -s --strip-program="$(STRIP)"
-endif
+CROSS := $(DEB_HOST_GNU_TYPE)-
+CC     = $(CROSS)gcc
+CXX    = $(CROSS)g++
+STRIP  = $(CROSS)strip --remove-section=.comment --remove-section=.note
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
   CFLAGS = -g -O0
@@ -572,11 +565,6 @@
        @mkdir -p stamps
        touch $@
 
-debian/strip.cross: debian/strip.cross.in
-       sed -e "s/__TARGET__/$(CROSS)/" \
-               < debian/strip.cross.in >> debian/strip.cross
-       chmod 755 debian/strip.cross
-
 #######################
 # single-arch targets #
 #######################
@@ -805,7 +793,7 @@
 endif
        touch $@
 
-stamps/install.%: stamps/build.% $(if $(CROSS),debian/strip.cross)
+stamps/install.%: stamps/build.%
        $(checkdir)
        @echo BEGIN $@
        rm -rf $(D_CROSS)
@@ -984,7 +972,7 @@
     install_stamps :=
 endif
 install: $(install_stamp)
-stamps/install: checkroot stamps/build $(install_stamps) $(if 
$(CROSS),debian/strip.cross)
+stamps/install: checkroot stamps/build $(install_stamps)
        $(checkdir)
 
        rm -fr $(d_bin) $(d_com) $(d_lib) $(d_nat) $(d_dev) $(d_mul) $(d_mdev) 
$(d_doc) $(d_src) $(d_bld)
@@ -1218,7 +1206,7 @@
 endif
        touch $@
 
-stamps/install-hppa64: checkroot stamps/build-hppa64 $(if 
$(CROSS),debian/strip.cross)
+stamps/install-hppa64: checkroot stamps/build-hppa64
        $(checkdir)
 
        rm -fr $(d_hppa64)
@@ -1753,23 +1741,23 @@
        dwz=usr/lib/debug/.dwz/$(DEB_HOST_MULTIARCH)/$(strip $1).debug; \
        dwz -m $(strip $2)-dbg/$$dwz -M /$$dwz \
          $$files; \
-       objcopy --compress-debug-sections $(strip $2)-dbg/$$dwz; \
+       $(CROSS)objcopy --compress-debug-sections $(strip $2)-dbg/$$dwz; \
        for i in $$files; do \
-         b_id=$$(LC_ALL=C readelf -n $$i | sed -n 's/ *Build ID: 
*\([0-9a-f][0-9a-f]*\)/\1/p'); \
+         b_id=$$(LC_ALL=C $(CROSS)readelf -n $$i | sed -n 's/ *Build ID: 
*\([0-9a-f][0-9a-f]*\)/\1/p'); \
          if [ -z "$$b_id" ]; then \
            id=$$(echo $$i | sed -r 's,debian/[^/]+,$2-dbg/usr/lib/debug,'); \
            echo strip $$i; \
            mkdir -p $$(dirname $$id); \
-           objcopy --only-keep-debug $$i $$id; \
+           $(CROSS)objcopy --only-keep-debug $$i $$id; \
            chmod 644 $$id; \
            $(STRIP) $$i; \
-           objcopy --add-gnu-debuglink $$id $$i; \
+           $(CROSS)objcopy --add-gnu-debuglink $$id $$i; \
          else \
            echo "ID: $${b_id} -> $$(echo $$i | sed 's,$(strip $2),,')"; \
            d=usr/lib/debug/.build-id/$${b_id:0:2}; \
            f=$${b_id:2}.debug; \
            mkdir -p $(strip $2)-dbg/$$d; \
-           objcopy --only-keep-debug --compress-debug-sections $$i $(strip 
$2)-dbg/$$d/$$f; \
+           $(CROSS)objcopy --only-keep-debug --compress-debug-sections $$i 
$(strip $2)-dbg/$$d/$$f; \
            chmod 644 $(strip $2)-dbg/$$d/$$f; \
            $(STRIP) $$i; \
          fi; \
diff --minimal -Nru binutils-2.29.1/debian/strip.cross.in 
binutils-2.29.1/debian/strip.cross.in
--- binutils-2.29.1/debian/strip.cross.in
+++ binutils-2.29.1/debian/strip.cross.in
@@ -1,3 +0,0 @@
-#! /bin/sh
-
-__TARGET__strip --remove-section=.comment --remove-section=.note $*

Reply via email to