package binutils tags 231707 + patch thanks The attached patch is an update of Nikita's most recent patch to apply cleanly to binutils 2.16.1cvs20050902-1. With this patch, I can successfully build an i386-hosted binutils targetting powerpc-linux-gnu.
I'm also adding the patch tag, since it doesn't seem to already be set on this bug. - Josh Triplett
diff -Naur binutils-2.16.1cvs20050902.old/debian/README.cross binutils-2.16.1cvs20050902/debian/README.cross
--- binutils-2.16.1cvs20050902.old/debian/README.cross 1969-12-31 16:00:00.000000000 -0800
+++ binutils-2.16.1cvs20050902/debian/README.cross 2005-10-13 23:49:51.000000000 -0700
@@ -0,0 +1,13 @@
+Cross-binutils debian packages can be built directly from binutils
+source package.
+
+To build cross-binutils package, download and unpack binutils
+source package, and run
+
+TARGET=your-target fakeroot debian/rules binary-cross
+
+Target name may be set both as debian arch name (such as 'arm', 'powerpc', ...)
+ans ad GNU system type (arm-linux-gnu, powerpc-linux-gnu, etc).
+
+---
+Nikita Youshchenko <[EMAIL PROTECTED]>
diff -Naur binutils-2.16.1cvs20050902.old/debian/generate-cross-control binutils-2.16.1cvs20050902/debian/generate-cross-control
--- binutils-2.16.1cvs20050902.old/debian/generate-cross-control 1969-12-31 16:00:00.000000000 -0800
+++ binutils-2.16.1cvs20050902/debian/generate-cross-control 2005-10-13 23:49:51.000000000 -0700
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+target=`echo -n $1 | sed 's/_/-/g'`
+
+sed '/^$/ q' < debian/control
+
+echo "Package: binutils-$target"
+echo 'Architecture: any'
+echo 'Depends: binutils, ${shlibs:Depends}'
+echo 'Suggests: binutils-doc (= ${Source-Version})'
+
+# Add conflicts/replaces/provides for older names of same binutils
+oldtarget=`echo -n $target | sed 's/-linux-gnu$/-linux/'`
+if [ "$target" != "$oldtarget" ]; then
+ # Add conflicts with old EmDebian toolchain which was available for
+ # arm and powerpc
+ if [ "$oldtarget" = "arm-linux" ] || [ "$oldtarget" = "powerpc-linux" ]; then
+ veryoldtarget=`echo -n $target | sed 's/-linux$//'`
+ echo "Conflicts: binutils-$oldtarget, binutils-$veryoldtarget"
+ else
+ echo "Conflicts: binutils-$oldtarget"
+ fi
+ echo "Replaces: binutils-$oldtarget"
+ echo "Provides: binutils-$oldtarget"
+fi
+echo "Description: The GNU binary utilities, for $target target"
+echo " This package provides GNU assembler, linker and binary utilities"
+echo " for $target target, for use in cross-compilation environment."
+echo " ."
+echo " You don't need this package unless you plan to cross-compile programs"
+echo " for $target."
diff -Naur binutils-2.16.1cvs20050902.old/debian/patch-stamp binutils-2.16.1cvs20050902/debian/patch-stamp
--- binutils-2.16.1cvs20050902.old/debian/patch-stamp 1969-12-31 16:00:00.000000000 -0800
+++ binutils-2.16.1cvs20050902/debian/patch-stamp 2005-10-13 23:49:51.000000000 -0700
@@ -0,0 +1,2 @@
+Patches applied in the Debian version of :
+
diff -Naur binutils-2.16.1cvs20050902.old/debian/patches/001_ld_makefile_patch.dpatch binutils-2.16.1cvs20050902/debian/patches/001_ld_makefile_patch.dpatch
--- binutils-2.16.1cvs20050902.old/debian/patches/001_ld_makefile_patch.dpatch 2005-10-13 23:58:15.000000000 -0700
+++ binutils-2.16.1cvs20050902/debian/patches/001_ld_makefile_patch.dpatch 2005-10-13 23:57:48.000000000 -0700
@@ -6,6 +6,10 @@
## DP: Author: Chris Chimelis <[EMAIL PROTECTED]>
## DP: Upstream status: N/A
## DP: Date: ??
+## DP: Fixed by Nikita Youshchenko <[EMAIL PROTECTED]> to be correct for
+## DP: cross-binutils - in that case change of $(scriptdir) to /usr/lib causes
+## DP: cross-ld to look for libraries in /usr/lib instead of
+## DP: /usr/$(target-alias)/lib
if [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
@@ -29,24 +33,50 @@
diff -urNad --exclude=CVS --exclude=.svn ./ld/Makefile.am /tmp/dpep-work.eKU2vW/binutils-2.16.1cvs20050902/ld/Makefile.am
--- ./ld/Makefile.am 2005-08-31 03:27:36.000000000 +0000
+++ /tmp/dpep-work.eKU2vW/binutils-2.16.1cvs20050902/ld/Makefile.am 2005-09-02 21:42:18.000000000 +0000
-@@ -20,7 +20,7 @@
+@@ -20,7 +20,11 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
++scriptdir = `if [ "@host@" = "@target@" ] ; then \
++ echo '$(libdir)'; \
++ else \
++ echo '$(tooldir)/lib'; \
++ fi`
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
+@@ -431,7 +435,7 @@
+
+ ldmain.o: ldmain.c config.status
+ $(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' \
+- -DSCRIPTDIR='"$(scriptdir)"' -DBINDIR='"$(bindir)"' \
++ -DSCRIPTDIR='"'$(scriptdir)'"' -DBINDIR='"$(bindir)"' \
+ -DTOOLBINDIR='"$(tooldir)/bin"' \
+ -DTARGET='"@target@"' @TARGET_SYSTEM_ROOT_DEFINE@ \
+ $(srcdir)/ldmain.c
diff -urNad --exclude=CVS --exclude=.svn ./ld/Makefile.in /tmp/dpep-work.eKU2vW/binutils-2.16.1cvs20050902/ld/Makefile.in
--- ./ld/Makefile.in 2005-08-31 03:27:36.000000000 +0000
+++ /tmp/dpep-work.eKU2vW/binutils-2.16.1cvs20050902/ld/Makefile.in 2005-09-02 21:43:37.259127535 +0000
-@@ -268,7 +268,7 @@
+@@ -268,7 +268,11 @@
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
-+scriptdir = $(libdir)
++scriptdir = `if [ "@host@" = "@target@" ] ; then \
++ echo '$(libdir)'; \
++ else \
++ echo '$(tooldir)/lib'; \
++ fi`
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include
+@@ -1173,7 +1177,7 @@
+
+ ldmain.o: ldmain.c config.status
+ $(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' \
+- -DSCRIPTDIR='"$(scriptdir)"' -DBINDIR='"$(bindir)"' \
++ -DSCRIPTDIR='"'$(scriptdir)'"' -DBINDIR='"$(bindir)"' \
+ -DTOOLBINDIR='"$(tooldir)/bin"' \
+ -DTARGET='"@target@"' @TARGET_SYSTEM_ROOT_DEFINE@ \
+ $(srcdir)/ldmain.c
diff -Naur binutils-2.16.1cvs20050902.old/debian/patches/00list binutils-2.16.1cvs20050902/debian/patches/00list
--- binutils-2.16.1cvs20050902.old/debian/patches/00list 2005-10-13 23:58:15.000000000 -0700
+++ binutils-2.16.1cvs20050902/debian/patches/00list 2005-10-13 23:49:51.000000000 -0700
@@ -7,3 +7,4 @@
117_mips_symbolic_link
118_arm_pass_all
120_mips_xgot_multigot_workaround
+999_lib64_for_cross
diff -Naur binutils-2.16.1cvs20050902.old/debian/patches/999_lib64_for_cross.dpatch binutils-2.16.1cvs20050902/debian/patches/999_lib64_for_cross.dpatch
--- binutils-2.16.1cvs20050902.old/debian/patches/999_lib64_for_cross.dpatch 1969-12-31 16:00:00.000000000 -0800
+++ binutils-2.16.1cvs20050902/debian/patches/999_lib64_for_cross.dpatch 2005-10-13 23:49:51.000000000 -0700
@@ -0,0 +1,56 @@
+#! /bin/sh -e
+## 999_lib64_for_cross.dpatch by Nikita Youshchenko <[EMAIL PROTECTED]>
+##
+## DP: Add /usr/${target-alias}/lib${LIBPATH_SUFFIX} to ld's default
+## DP: library search path for cross targets. Needed for cross targets that
+## DP: try to support both 32bit and 64bit emulations.
+
+if [ $# -lt 1 ]; then
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+ -patch) patch -p1 ${patch_opts} < $0;;
+ -unpatch) patch -R -p1 ${patch_opts} < $0;;
+ *)
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1;;
+esac
+
+exit 0
+
[EMAIL PROTECTED]@
+diff -urNad /home/nikita/debian/binutils/binutils-2.14.90.0.7.cross/ld/genscripts.sh binutils-2.14.90.0.7.cross/ld/genscripts.sh
+--- /home/nikita/debian/binutils/binutils-2.14.90.0.7.cross/ld/genscripts.sh 2003-10-29 20:37:48.000000000 +0300
++++ binutils-2.14.90.0.7.cross/ld/genscripts.sh 2004-07-15 00:29:19.000000000 +0400
+@@ -176,6 +176,26 @@
+ ::) LIB_PATH=${tool_lib} ;;
+ *) LIB_PATH=${tool_lib}:${LIB_PATH} ;;
+ esac
++ # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX}
++ # and ${TOOL_LIB}/lib${LIBPATH_SUFFIX} to default search path, because
++ # 64bit libraries may be in both places, depending on cross-development
++ # setup method (e.g.: /usr/s390x-linux/lib64 vs /usr/s390-linux/lib64)
++ case "${LIBPATH_SUFFIX}:${tool_lib}" in
++ :*) ;;
++ *:*${LIBPATH_SUFFIX}) ;;
++ *)
++ paths="${exec_prefix}/${target_alias}/lib${LIBPATH_SUFFIX}"
++ if [ "${TOOL_LIB}" != x ]; then
++ paths="${paths} ${exec_prefix}/${TOOL_LIB}/lib${LIBPATH_SUFFIX}"
++ fi
++ for path in $paths; do
++ case :${LIB_PATH}: in
++ ::: | *:${path}:*) ;;
++ *) LIB_PATH=${path}:${LIB_PATH} ;;
++ esac
++ done
++ ;;
++ esac
+ fi
+
+ LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`
diff -Naur binutils-2.16.1cvs20050902.old/debian/rules binutils-2.16.1cvs20050902/debian/rules
--- binutils-2.16.1cvs20050902.old/debian/rules 2005-10-13 23:58:15.000000000 -0700
+++ binutils-2.16.1cvs20050902/debian/rules 2005-10-13 23:49:51.000000000 -0700
@@ -378,7 +378,8 @@
endif
$(install_file) $(pwd)/test-summary binutils/NEWS \
- debian/README.Debian $(d_bin)/usr/share/doc/$(p_bin)/
+ debian/README.Debian debian/README.cross \
+ $(d_bin)/usr/share/doc/$(p_bin)/
$(install_file) binutils/ChangeLog $(d_bin)/usr/share/doc/$(p_bin)/changelog
@@ -438,6 +439,133 @@
################################################################################
+
+#################
+# cross targets #
+#################
+
+# If $(TARGET) is not set, try reading debian/target
+ifeq ($(TARGET),)
+TARGET := $(cat debian/target 2>/dev/null)
+endif
+
+# Process the following only if $(TARGET) is set
+ifneq ($(TARGET),)
+
+# Support TARGET both as Debian architecture specification (e.g. arm),
+# and as the target name (e.g. arm-linux-gnu).
+try_convert := $(shell dpkg-architecture -a$(TARGET) -qDEB_HOST_GNU_TYPE 2>/dev/null)
+ifneq ($(try_convert),)
+override TARGET := $(try_convert)
+endif
+
+# Many people expect cross-binutils to be named like 'arm-linux-ld', not
+# like 'arm-linux-gnu-ld'. Package will provide symlinks. In future, this may
+# be replaced with alternatives.
+tmp_cpu := $(shell dpkg-architecture -t$(TARGET) -qDEB_HOST_ARCH_CPU 2>/dev/null)
+tmp_os := $(shell dpkg-architecture -t$(TARGET) -qDEB_HOST_ARCH_OS 2>/dev/null)
+ifeq ($(TARGET),$(tmp_cpu)-$(tmp_os)-gnu)
+do_symlinks := yes
+else
+do_symlinks := no
+endif
+
+p_cross = $(subst _,-,binutils-$(TARGET))
+d_cross = debian/$(p_cross)
+
+ifneq ($(filter sparc-linux-gnu powerpc-linux-gnu mips-linux-gnu, $(TARGET)),)
+ADDITIONAL_TARGETS = --enable-targets=$(TARGET:%-linux-gnu=%64-linux-gnu)
+endif
+ifneq ($(filter i386-linux-gnu i486-linux-gnu i586-linux-gnu x86-linux-gnu, $(TARGET)),)
+ADDITIONAL_TARGETS = --enable-targets=x86_64-linux-gnu
+endif
+ifeq ($(TARGET), x86_64-linux-gnu)
+ADDITIONAL_TARGETS = --enable-targets=i486-linux-gnu
+endif
+ifeq ($(TARGET), mipsel-linux-gnu)
+ADDITIONAL_TARGETS = --enable-targets=mips64el-linux-gnu
+endif
+ifeq ($(TARGET), sparc64-linux-gnu)
+ADDITIONAL_TARGETS = --enable-targets=sparc-linux-gnu
+endif
+ifeq ($(TARGET), s390-linux-gnu)
+ADDITIONAL_TARGETS = --enable-targets=s390x-linux-gnu
+endif
+ifeq ($(TARGET), s390x-linux-gnu)
+ADDITIONAL_TARGETS = --enable-targets=s390-linux-gnu
+endif
+
+configure-$(TARGET)-stamp: patch-stamp
+ $(checkdir)
+ test "" != "$(TARGET)"
+ rm -rf configure-$(TARGET)-stamp builddir-$(TARGET)
+ mkdir builddir-$(TARGET)
+ cd builddir-$(TARGET) \
+ && env CC="$(CC)" ../configure --host=$(DEB_HOST_GNU_TYPE) \
+ --build=$(DEB_BUILD_GNU_TYPE) --target=$(TARGET) --prefix=/usr \
+ $(ADDITIONAL_TARGETS)
+ touch $@
+
+build-$(TARGET)-stamp: configure-$(TARGET)-stamp
+ $(checkdir)
+ test "" != "$(TARGET)"
+ $(MAKE) -C builddir-$(TARGET) CFLAGS="$(CFLAGS)"
+ touch $@
+
+install-$(TARGET)-stamp: build-$(TARGET)-stamp
+ $(checkdir)
+ test "" != "$(TARGET)"
+ rm -rf $(d_cross)
+ $(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/usr \
+ mandir=$(pwd)/$(d_cross)/usr/share/man install
+ rm -rf $(d_cross)/usr/lib $(d_cross)/usr/info $(d_cross)/usr/share/locale
+ $(STRIP) $(d_cross)/usr/bin/*
+ gzip -9 $(d_cross)/usr/share/man/man1/*
+ifeq ($(do_symlinks),yes)
+ cd $(d_cross)/usr/bin && for f in *; do \
+ ln -s $$f `echo $$f | sed 's/-gnu//'`; \
+ done
+ cd $(d_cross)/usr/share/man/man1 && for f in *; do \
+ ln -s $$f `echo $$f | sed 's/-gnu//'`; \
+ done
+endif
+ touch $@
+
+binary-cross: checkroot install-$(TARGET)-stamp
+ $(checkdir)
+ test "" != "$(TARGET)"
+
+ chmod 755 debian/generate-cross-control
+ debian/generate-cross-control $(TARGET) > debian/control.$(TARGET)
+
+ $(install_dir) $(d_cross)/DEBIAN
+
+ $(install_dir) $(d_cross)/usr/share/doc/$(p_cross)/
+ $(install_file) debian/changelog $(d_cross)/usr/share/doc/$(p_cross)/changelog.Debian
+ $(install_file) debian/copyright debian/README.cross $(d_cross)/usr/share/doc/$(p_cross)/
+ gzip -f -9 $(d_cross)/usr/share/doc/$(p_cross)/changelog.Debian
+
+ for pkg in bfd gas gprof ld; do \
+ ln -sf ../binutils/$$pkg $(d_cross)/usr/share/doc/$(p_cross)/$$pkg; \
+ done
+
+ rm -f debian/substvars
+ dpkg-shlibdeps $(d_cross)/usr/bin/*
+ dpkg-gencontrol -cdebian/control.$(TARGET) -P$(d_cross) -p$(p_cross)
+ dpkg --build $(d_cross) ..
+
+clean-cross: unpatch
+ $(checkdir)
+ test "" != "$(TARGET)"
+ rm -rf $(d_cross) debian/control.$(TARGET) debian/files debian/substvars \
+ builddir-$(TARGET) {configure,build,install}-$(TARGET)-stamp
+
+.PHONY: binary-cross clean-cross
+
+endif
+
+################################################################################
+
define checkdir
test -f bfd/elf32.c -a -f debian/rules
endef
diff -Naur binutils-2.16.1cvs20050902.old/debian/rules.orig binutils-2.16.1cvs20050902/debian/rules.orig
--- binutils-2.16.1cvs20050902.old/debian/rules.orig 1969-12-31 16:00:00.000000000 -0800
+++ binutils-2.16.1cvs20050902/debian/rules.orig 2005-10-13 12:36:36.000000000 -0700
@@ -0,0 +1,453 @@
+#!/usr/bin/make -f
+# debian/rules file - for binutils (2.16.1cvs20050902)
+# Based on sample debian/rules file - for GNU Hello (1.3).
+# Copyright 1994,1995 by Ian Jackson.
+# Copyright 1998-2005 James Troup
+# I hereby give you perpetual unlimited permission to copy,
+# modify and relicense this file, provided that you do not remove
+# my name from the file itself. (I assert my moral right of
+# paternity under the Copyright, Designs and Patents Act 1988.)
+# This file may have to be extensively modified
+
+################################################################################
+
+include /usr/share/dpatch/dpatch.make
+
+################################################################################
+
+p_bin = binutils
+p_dev = $(p_bin)-dev
+p_mul = $(p_bin)-multiarch
+p_doc = $(p_bin)-doc
+p_hppa64 = $(p_bin)-hppa64
+
+pwd := $(shell pwd)
+d = debian/tmp
+d_bin = $(d)
+d_dev = debian/$(p_dev)
+d_mul = debian/$(p_mul)
+d_doc = debian/$(p_doc)
+d_hppa64 = debian/$(p_hppa64)
+
+install_dir = install -d -m 755
+install_file = install -m 644
+install_script = install -m 755
+install_binary = install -m 755 -s
+
+DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+
+CC = gcc
+CFLAGS = -g -O2
+STRIP = strip --remove-section=.comment --remove-section=.note
+
+VERSION = $(shell sed -n 's/^ *VERSION=\(.*\)/\1/p' bfd/configure)
+MULTI_VERSION = $(VERSION)-multiarch
+MULTI_ARGS = MAKEOVERRIDES="VERSION=$(MULTI_VERSION)"
+
+HPPA64_VERSION= $(VERSION)-hppa64
+HPPA64_ARGS = MAKEOVERRIDES="VERSION=$(HPPA64_VERSION)"
+
+########################################
+
+CONFARGS = --enable-shared --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) \
+ --host=$(DEB_HOST_GNU_TYPE)
+CONFLICTS = -VmainConflicts="gas, elf-binutils, modutils (<< 2.4.19-1)"
+
+ifeq ($(DEB_HOST_ARCH),sparc)
+ CONFARGS += --enable-targets=sparc64-linux-gnu
+ CONFLICTS = -VmainConflicts="gas, elf-binutils, modutils (<< 2.4.19-1), libc6-dev-sparc64 (<< 2.2.5-7)"
+endif
+ifeq ($(DEB_HOST_ARCH),sparc64)
+ CONFARGS += --enable-targets=sparc-linux-gnu
+ CONFLICTS = -VmainConflicts="gas, elf-binutils, libc6-dev-sparc64 (<< 2.2.5-7)"
+endif
+ifeq ($(DEB_HOST_ARCH),powerpc)
+ CONFARGS += --enable-targets=powerpc64-linux-gnu
+endif
+ifeq ($(DEB_HOST_ARCH),s390)
+ CONFARGS += --enable-targets=s390x-linux-gnu
+endif
+ifeq ($(DEB_HOST_ARCH),i386)
+ CONFARGS += --enable-targets=x86_64-linux-gnu
+endif
+ifeq ($(DEB_HOST_ARCH),mips)
+ CONFARGS += --enable-targets=mips64-linux-gnu
+endif
+ifeq ($(DEB_HOST_ARCH),mipsel)
+ CONFARGS += --enable-targets=mips64el-linux-gnu
+endif
+
+################################################################################
+
+################
+# clean target #
+################
+
+clean: unpatch
+ $(checkdir)
+ -rm -fr builddir-multi builddir-single builddir-hppa64
+ -find . -name \*.gmo -o -name \*~ -o -name \*.info | xargs rm -f
+ -rm -f $(pwd)/test-summary
+ -rm -fr $(d_bin) $(d_dev) $(d_mul) $(d_doc) $(d_hppa64)
+ -rm -rf debian/patched debian/tmp debian/files debian/substvars
+
+################################################################################
+
+#######################
+# single-arch targets #
+#######################
+
+configure-single-stamp: patch-stamp
+ $(checkdir)
+ rm -rf configure-single-stamp \
+ builddir-single
+ mkdir builddir-single
+ cd builddir-single && env CC="$(CC)" \
+ ../configure $(CONFARGS)
+ $(MAKE) -C builddir-single configure-host
+ touch configure-single-stamp
+
+build-single-stamp: configure-single-stamp
+ $(checkdir)
+ $(MAKE) -C builddir-single/bfd headers
+ $(MAKE) -C builddir-single \
+ CFLAGS="$(CFLAGS)"
+ -$(MAKE) -C builddir-single -k \
+ CFLAGS="$(CFLAGS)" check
+ cat builddir-single/binutils/binutils.sum \
+ builddir-single/gas/testsuite/gas.sum \
+ builddir-single/ld/ld.sum >> $(pwd)/test-summary
+ touch build-single-stamp
+
+################################################################################
+
+#####################
+# multiarch targets #
+#####################
+
+configure-multi-stamp: patch-stamp
+ $(checkdir)
+ rm -rf configure-multi-stamp \
+ builddir-multi
+ mkdir builddir-multi
+ cd builddir-multi \
+ && env CC="$(CC)" ../configure $(CONFARGS) \
+ --enable-targets=alpha-linux-gnu,arm-linux-gnu,hppa-linux-gnu,i486-gnu,i486-linux-gnu,ia64-linux-gnu,m68k-linux-gnu,m68k-rtems,mips-linux-gnu,mipsel-linux-gnu,mips64-linux-gnu,mips64el-linux-gnu,powerpc-linux-gnu,powerpc64-linux-gnu,s390-linux-gnu,s390x-linux-gnu,sh-linux-gnu,sparc-linux-gnu,sparc64-linux-gnu,x86_64-linux-gnu
+ $(MAKE) -C builddir-multi configure-host
+ touch configure-multi-stamp
+
+build-multi-stamp: configure-multi-stamp
+ $(checkdir)
+ $(MAKE) -C builddir-multi/bfd headers
+ $(MAKE) -C builddir-multi \
+ CFLAGS="$(CFLAGS)" $(MULTI_ARGS)
+ touch build-multi-stamp
+
+################################################################################
+
+#################
+# hppa64 target #
+#################
+
+configure-hppa64-stamp: patch-stamp
+ $(checkdir)
+ rm -rf configure-hppa64-stamp \
+ builddir-hppa64
+ mkdir builddir-hppa64
+ cd builddir-hppa64 \
+ && env CC="$(CC)" ../configure \
+ --enable-shared \
+ --prefix=/usr \
+ --build=$(DEB_BUILD_GNU_TYPE) \
+ --host=$(DEB_BUILD_GNU_TYPE) \
+ --target=hppa64-linux-gnu
+ $(MAKE) -C builddir-hppa64 configure-host
+ touch configure-hppa64-stamp
+
+build-hppa64-stamp: configure-hppa64-stamp
+ $(checkdir)
+ $(MAKE) -C builddir-hppa64/bfd headers
+ $(MAKE) -C builddir-hppa64 \
+ CFLAGS="$(CFLAGS)" $(HPPA64_ARGS)
+ touch build-hppa64-stamp
+
+build_stamps = build-single-stamp build-multi-stamp
+ifeq ($(DEB_HOST_ARCH),hppa)
+ build_stamps += build-hppa64-stamp
+endif
+build: build-stamp
+build-stamp: $(build_stamps)
+ touch build-stamp
+
+
+################################################################################
+
+##################
+# install target #
+##################
+
+install_stamps = install-stamp
+ifeq ($(DEB_HOST_ARCH),hppa)
+ install_stamps += install-hppa64-stamp
+endif
+install: $(install_stamps)
+install-stamp: checkroot build-stamp
+ $(checkdir)
+
+ rm -fr $(d_bin) $(d_dev) $(d_mul) $(d_doc)
+ $(install_dir) $(d_bin) $(d_dev) $(d_mul) $(d_doc)
+
+ : # install binutils and -dev stuff
+ $(MAKE) -C builddir-single \
+ CFLAGS="$(CFLAGS)" prefix=$(pwd)/$(d_bin)/usr \
+ mandir=$(pwd)/$(d_bin)/usr/share/man \
+ infodir=$(pwd)/$(d_doc)/usr/share/info install
+
+ : # now install binutils-multiarch stuff
+ $(MAKE) -C builddir-multi \
+ CFLAGS="$(CFLAGS)" $(MULTI_ARGS) \
+ prefix=$(pwd)/$(d_mul)/usr \
+ mandir=$(pwd)/$(d_mul)/usr/share/man \
+ infodir=$(pwd)/$(d_doc)/usr/share/info install
+
+ : # copy libiberty.h ... not too keen on this, but it was requested
+ cp -f include/libiberty.h $(d_bin)/usr/include
+
+ : # We don't need to distribute everything in binutils and -dev
+ rm -rf $(d_bin)/usr/include/obstack.h
+ rm -f $(d_bin)/usr/man/man1/configure.1
+ rm -f $(d_doc)/usr/share/info/configure.* $(d_doc)/usr/share/info/standards.*
+ : # *sigh*, bugs.debian.org/213524
+ rm -f $(d_doc)/usr/share/info/dir*
+
+ : # Now get rid of just about everything in binutils-multiarch
+ rm -rf $(d_mul)/usr/man $(d_mul)/usr/info $(d_mul)/usr/include
+ rm -rf $(d_mul)/usr/share/man $(d_mul)/usr/share/info $(d_mul)/usr/share/locale
+
+ : # Get rid of ld for the time being since it's suddenly unhappy when
+ : # linking kernels. Also get rid of the ldscripts for good measure.
+ rm -f $(d_mul)/usr/bin/as $(d_mul)/usr/bin/gasp $(d_mul)/usr/bin/c++filt \
+ $(d_mul)/usr/bin/ld
+ rm -rf $(d_mul)/usr/lib/ldscripts
+
+ $(install_dir) $(d_dev)/usr/include/ $(d_dev)/usr/lib/
+ mv $(d_bin)/usr/include/* $(d_dev)/usr/include/
+ mv $(d_bin)/usr/lib/*.a $(d_bin)/usr/lib/libbfd.so $(d_bin)/usr/lib/libopcodes.so \
+ $(d_dev)/usr/lib/
+
+ rm -f $(d_mul)/usr/lib/libbfd.so $(d_mul)/usr/lib/libopcodes.so
+ rm -f $(d_mul)/usr/lib/*.la
+ rm -f $(d_mul)/usr/lib/libiberty*
+
+ : # Get rid of .la files since libtool obviously has no idea about transient paths
+ rm -f $(d_bin)/usr/lib/*.la
+
+ : # Strip shared libraries
+ $(STRIP) --strip-unneeded $(d_bin)/usr/lib/libbfd-*so
+ $(STRIP) --strip-unneeded $(d_bin)/usr/lib/libopcodes-*so
+ $(STRIP) --strip-unneeded $(d_mul)/usr/lib/libbfd-*so
+ $(STRIP) --strip-unneeded $(d_mul)/usr/lib/libopcodes-*so
+
+ chmod ugo-x $(d_bin)/usr/lib/*.so $(d_mul)/usr/lib/*.so
+ $(STRIP) $(d_bin)/usr/bin/* $(d_mul)/usr/bin/*
+
+ : # Don't want /usr/<arch>-linux to exist in any package
+ rm -rf $(d_bin)/usr/$(DEB_HOST_GNU_TYPE)
+ rm -rf $(d_mul)/usr/$(DEB_HOST_GNU_TYPE)
+
+ : # Remove windres manpages
+ rm -f $(d_bin)/usr/share/man/man1/windres.1
+ rm -f $(d_mul)/usr/share/man/man1/windres.1
+
+ : # Remove empty directory
+ rmdir $(d_bin)/usr/include/
+
+ touch install-stamp
+
+install-hppa64-stamp: checkroot build-hppa64-stamp
+ $(checkdir)
+
+ rm -fr $(d_hppa64)
+ $(install_dir) $(d_hppa64)
+ $(install_dir) $(d_hppa64)/usr/lib
+
+ : # install binutils-hppa64 stuff
+ $(MAKE) -C builddir-hppa64 \
+ CFLAGS="$(CFLAGS)" $(HPPA64_ARGS) \
+ prefix=$(pwd)/$(d_hppa64)/usr/ \
+ mandir=$(pwd)/$(d_hppa64)/usr/share/man \
+ infodir=$(pwd)/$(d_hppa64)/usr/share/info install
+
+ : # move shared libs to the standard path
+ mv $(d_hppa64)/usr/hppa-linux-gnu/hppa64-linux-gnu/lib/lib*-*.so \
+ $(d_hppa64)/usr/lib/.
+
+ : # Now get rid of just about everything in binutils-hppa64
+ rm -rf $(d_hppa64)/usr/man
+ rm -rf $(d_hppa64)/usr/info
+ rm -rf $(d_hppa64)/usr/include
+ rm -rf $(d_hppa64)/usr/share
+ rm -rf $(d_hppa64)/usr/hppa-linux-gnu
+ rm -rf $(d_hppa64)/usr/lib/libiberty.a
+
+ : # Strip shared libraries
+ $(STRIP) --strip-unneeded $(d_hppa64)/usr/lib/libbfd-*so
+ $(STRIP) --strip-unneeded $(d_hppa64)/usr/lib/libopcodes-*so
+
+ chmod ugo-x $(d_hppa64)/usr/lib/*.so
+ $(STRIP) $(d_hppa64)/usr/bin/*
+
+ : # Don't want /usr/<arch>-linux to exist in any package
+ rm -rf $(d_hppa64)/usr/hppa64-linux-gnu
+
+ touch install-hppa64-stamp
+
+################################################################################
+
+#######################
+# binary-indep target #
+#######################
+
+binary-indep: checkroot build install
+ $(checkdir)
+
+ rm -f debian/files debian/substvars
+
+ $(install_dir) $(d_doc)/DEBIAN
+ $(install_script) debian/binutils-doc.postinst $(d_doc)/DEBIAN/postinst
+ $(install_script) debian/binutils-doc.prerm $(d_doc)/DEBIAN/prerm
+
+ $(install_dir) $(d_doc)/usr/share/doc/$(p_doc)/
+ $(install_file) debian/changelog $(d_doc)/usr/share/doc/$(p_doc)/changelog.Debian
+ $(install_file) debian/copyright $(d_doc)/usr/share/doc/$(p_doc)/
+ for i in bfd gas gprof ld; do \
+ ln -sf ../$(p_bin)/$$i $(d_doc)/usr/share/doc/$(p_doc)/$$i; \
+ done
+ find $(d_doc)/usr/share/doc/$(p_doc) -type f -maxdepth 1 ! -name copyright | xargs gzip -9
+ gzip -9 $(d_doc)/usr/share/info/*
+
+ dpkg-gencontrol -isp -P$(d_doc) -p$(p_doc)
+ chown -R root:root $(d_doc)
+ chmod -R go=rX $(d_doc)
+ [ -x /usr/bin/pkgstriptranslations ] && /usr/bin/pkgstriptranslations || true
+ dpkg --build $(d_doc) ..
+
+################################################################################
+
+#######################
+# binary-arch target #
+#######################
+
+binary-arch: checkroot build install
+ $(checkdir)
+
+ : # install maintainer scrtips
+ $(install_dir) $(d_bin)/DEBIAN
+ $(install_script) debian/binutils.postinst $(d_bin)/DEBIAN/postinst
+ $(install_script) debian/binutils.postrm $(d_bin)/DEBIAN/postrm
+ $(install_file) debian/binutils.shlibs $(d_bin)/DEBIAN/shlibs
+
+ $(install_dir) $(d_dev)/DEBIAN
+
+ $(install_dir) $(d_mul)/DEBIAN
+ $(install_script) debian/binutils-multiarch.postinst $(d_mul)/DEBIAN/postinst
+ $(install_script) debian/binutils-multiarch.postrm $(d_mul)/DEBIAN/postrm
+ $(install_script) debian/binutils-multiarch.preinst $(d_mul)/DEBIAN/preinst
+ $(install_file) debian/binutils-multiarch.shlibs $(d_mul)/DEBIAN/shlibs
+
+ifeq ($(DEB_HOST_ARCH),hppa)
+ $(install_dir) $(d_hppa64)/DEBIAN
+ $(install_script) debian/binutils-hppa64.postinst $(d_hppa64)/DEBIAN/postinst
+ $(install_script) debian/binutils-hppa64.postrm $(d_hppa64)/DEBIAN/postrm
+ $(install_file) debian/binutils-hppa64.shlibs $(d_hppa64)/DEBIAN/shlibs
+endif
+
+ : # install docs
+ $(install_dir) $(d_bin)/usr/share/doc/$(p_bin)/
+ $(install_file) debian/changelog $(d_bin)/usr/share/doc/$(p_bin)/changelog.Debian
+ $(install_file) debian/copyright $(d_bin)/usr/share/doc/$(p_bin)/
+
+ $(install_dir) $(d_dev)/usr/share/doc/ $(d_mul)/usr/share/doc/
+ ln -sf $(p_bin) $(d_dev)/usr/share/doc/$(p_dev)
+ ln -sf $(p_bin) $(d_mul)/usr/share/doc/$(p_mul)
+ifeq ($(DEB_HOST_ARCH),hppa)
+ $(install_dir) $(d_hppa64)/usr/share/doc/
+ ln -sf $(p_bin) $(d_hppa64)/usr/share/doc/$(p_hppa64)
+endif
+
+ $(install_file) $(pwd)/test-summary binutils/NEWS \
+ debian/README.Debian $(d_bin)/usr/share/doc/$(p_bin)/
+
+ $(install_file) binutils/ChangeLog $(d_bin)/usr/share/doc/$(p_bin)/changelog
+
+ for pkg in bfd gas gprof ld; do \
+ $(install_dir) $(d_bin)/usr/share/doc/$(p_bin)/$$pkg; \
+ done
+ $(install_file) bfd/ChangeLog bfd/PORTING bfd/TODO \
+ $(d_bin)/usr/share/doc/$(p_bin)/bfd/
+ $(install_file) gas/ChangeLog gas/NEWS $(d_bin)/usr/share/doc/$(p_bin)/gas/
+ $(install_file) gprof/ChangeLog gprof/TODO gprof/TEST \
+ $(d_bin)/usr/share/doc/$(p_bin)/gprof/
+ $(install_file) ld/ChangeLog ld/TODO ld/NEWS \
+ $(d_bin)/usr/share/doc/$(p_bin)/ld/
+
+ : # These only exist in H. J. Lu releases not GNU ones.
+ for dir in binutils bfd gas gprof ld; do \
+ if [ -f $$dir/ChangeLog.linux ]; then \
+ $(install_file) $(d_bin)/usr/share/doc/$(p_bin)/$$dir/; \
+ fi; \
+ done
+
+ : # Copy bbconv.pl to the doc dir for use by interested people
+ $(install_file) gprof/bbconv.pl $(d_bin)/usr/share/doc/$(p_bin)/gprof/.
+
+ : # Compress stuff that needs it
+ gzip -9 $(d_bin)/usr/share/man/man1/*
+ find $(d_bin)/usr/share/doc/$(p_bin)/ -type f ! -name copyright -a ! -name bbconv.pl | xargs gzip -9
+
+ : # 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)
+
+ rm -f debian/substvars
+ dpkg-gencontrol -isp -P$(d_dev) -p$(p_dev)
+
+ 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)
+
+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)
+endif
+
+ chown -R root:root $(d_bin) $(d_dev) $(d_mul)
+ chmod -R go=rX $(d_bin) $(d_dev) $(d_mul)
+ [ -x /usr/bin/pkgstriptranslations ] && /usr/bin/pkgstriptranslations || true
+ dpkg --build $(d_bin) ..
+ dpkg --build $(d_dev) ..
+ dpkg --build $(d_mul) ..
+ifeq ($(DEB_HOST_ARCH),hppa)
+ chown -R root:root $(d_hppa64)
+ chmod -R go=rX $(d_hppa64)
+ dpkg --build $(d_hppa64) ..
+endif
+
+################################################################################
+
+define checkdir
+ test -f bfd/elf32.c -a -f debian/rules
+endef
+
+# Below here is fairly generic really
+
+binary: binary-indep binary-arch
+
+checkroot:
+ $(checkdir)
+ test root = "`whoami`"
+
+.PHONY: binary binary-arch binary-indep clean checkroot
signature.asc
Description: OpenPGP digital signature

