Package: binutils
Version: 2.20.1-11
Severity: wishlist
Tags: patch

Here is a patch for your consideration to modify binutils-2.20.51.20100617 to
parameterize out the hardcoded '/usr' prefix and allow a flexible package
build prefix of the user's choice.

This patch does not change the behavior of the "default" build. Essentially,
this modification is just a replacement of the hardcoded '/usr' paths in the
makefile. with a makefile variable $(PF), which is defined to be 'usr' if it
is not explicitly set already in the environment (e.g. on the build command
line).  It is patterned after very similar parameterization of the prefix
parameter in the gcc-4.4 source package.

The "use case" for the alternate prefix is as follows.  I am in what may be a
relatively common situation of supporting a team of embedded developers
working in a generic build environment for application code that gets deployed
on top of an embedded system based on the Debian OS.  One of my jobs is to
provide the cross compiling toolchain for this embedded environment.
Unfortunately I don't have full control over the generic build environment,
and it is not a simple Debian environment. 

Since we use Debian as our embedded operating system environment to deploy
this software, it is most safe and effective to use the same version of the
compiler and toolchain as is used to build the underlying Debian system.
So I leverage the most excellent Debian cross compiler toolchains for this
purpose.  To do this, I need to make the toolchains standalone for use outside
of a Debian environment, using an alternate prefix so that they compile for
use and install under /opt/.. instead of /usr/...  With careful control of
path variables,this effectively allows the cross compiler toolchain to be made
completely independent of the build machine operating system, native compilers
and libraries.  This is a desirable thing in order to ensure that there is no
pollution of the cross toolchain, and to make it effectively portable into
most Linux environements (even non-Debian ones).

I've tested this patch by building as deb packages as follows:

A standard build:
dpkg-buildpackage -us -uc -rfakeroot

A cross build for ARMEL:
TARGET=armel dpkg-buildpackage -us -uc -rfakeroot

A cross build for ARMEL with a changed prefix:
PF=opt/ilomtools/crosscompiler/gcc-4.4.4/arm TARGET=armel dpkg-buildpackage -us 
-uc -rfakeroot 


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages binutils depends on:
ii  libc6                   2.11.2-2         Embedded GNU C Library: Shared lib
ii  libgcc1                 1:4.4.4-5        GCC support library
ii  libstdc++6              4.4.4-5          The GNU Standard C++ Library v3
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

binutils recommends no packages.

Versions of packages binutils suggests:
pn  binutils-doc                  <none>     (no description available)

-- no debconf information
--- rules.orig  2010-07-01 16:17:22.000000000 -0400
+++ rules       2010-07-01 15:52:58.000000000 -0400
@@ -118,12 +118,18 @@ ifeq (,$(TARGET))
          endif
        endif
        
+       # PF is the installation prefix for the package without the leading 
slash.
+       # It's "usr" for gcc releases, so use this if not explicitly set
+       ifeq ($(PF),)
+         PF = usr
+       endif
+       
        ########################################
        
        CONFARGS = \
                --enable-shared \
                --enable-plugins \
-               --prefix=/usr \
+               --prefix=/$(PF) \
                --build=$(DEB_BUILD_GNU_TYPE) \
                --host=$(DEB_HOST_GNU_TYPE) \
                --with-pkgversion="GNU Binutils for $(DISTRIBUTION)"
@@ -354,7 +360,7 @@ configure-static-stamp: patch-stamp
                mkdir builddir-static
                cd builddir-static \
                    && env CC="$(CC)" CXX="$(CXX)" CFLAGS="-g0 -Os" 
../configure \
-                       --prefix=/usr \
+                       --prefix=/$(PF) \
                        --build=$(DEB_BUILD_GNU_TYPE) \
                        --host=$(DEB_HOST_GNU_TYPE) \
                        --with-pkgversion="GNU Binutils for $(DISTRIBUTION)"
@@ -383,7 +389,7 @@ configure-hppa64-stamp: patch-stamp
                cd builddir-hppa64 \
                    && env CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" 
../configure \
                        --enable-shared \
-                       --prefix=/usr \
+                       --prefix=/$(PF) \
                        --build=$(DEB_BUILD_GNU_TYPE) \
                        --host=$(DEB_BUILD_GNU_TYPE) \
                        --target=hppa64-linux-gnu
@@ -411,7 +417,7 @@ configure-spu-stamp: patch-stamp
                cd builddir-spu \
                    && env CC="$(CC)" CFLAGS="$(CFLAGS)" ../configure \
                        --enable-shared \
-                       --prefix=/usr \
+                       --prefix=/$(PF) \
                        --program-prefix=spu- \
                        --build=$(DEB_BUILD_GNU_TYPE) \
                        --host=$(DEB_BUILD_GNU_TYPE) \
@@ -480,139 +486,139 @@ install-stamp: checkroot build-stamp
                : # install binutils and -dev stuff
                env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \
                  $(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
+                       CFLAGS="$(CFLAGS)" prefix=$(pwd)/$(d_bin)/$(PF) \
+                       mandir=$(pwd)/$(d_bin)/$(PF)/share/man \
+                       infodir=$(pwd)/$(d_doc)/$(PF)/share/info install
        
        ifeq ($(with_multiarch),yes)
                : # now install binutils-multiarch stuff
                env MAKE="$(MAKE) VERSION=$(MULTI_VERSION)" \
                  $(MAKE) -C builddir-multi \
                        CFLAGS="$(CFLAGS)" \
-                       prefix=$(pwd)/$(d_mul)/usr \
-                       mandir=$(pwd)/$(d_mul)/usr/share/man \
-                       infodir=$(pwd)/$(d_doc)/usr/share/info install
+                       prefix=$(pwd)/$(d_mul)/$(PF) \
+                       mandir=$(pwd)/$(d_mul)/$(PF)/share/man \
+                       infodir=$(pwd)/$(d_doc)/$(PF)/share/info install
        endif
        
                : # copy libiberty.h ... not too keen on this, but it was 
requested
-               cp -f include/libiberty.h $(d_bin)/usr/include
+               cp -f include/libiberty.h $(d_bin)/$(PF)/include
        
                : # copy demangle.h ... not too keen on this, but it was 
requested
-               cp -f include/demangle.h $(d_bin)/usr/include
+               cp -f include/demangle.h $(d_bin)/$(PF)/include
        
                : # copy plugin-api.h ...
-               cp -f include/plugin-api.h $(d_bin)/usr/include
+               cp -f include/plugin-api.h $(d_bin)/$(PF)/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.*
+               rm -rf $(d_bin)/$(PF)/include/obstack.h
+               rm -f $(d_bin)/$(PF)/man/man1/configure.1
+               rm -f $(d_doc)/$(PF)/share/info/configure.* 
$(d_doc)/$(PF)/share/info/standards.*
                : # *sigh*, bugs.debian.org/213524
-               rm -f $(d_doc)/usr/share/info/dir*
+               rm -f $(d_doc)/$(PF)/share/info/dir*
        
        ifeq ($(with_multiarch),yes)
                : # 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
+               rm -rf $(d_mul)/$(PF)/man $(d_mul)/$(PF)/info 
$(d_mul)/$(PF)/include
+               rm -rf $(d_mul)/$(PF)/share/man $(d_mul)/$(PF)/share/info 
$(d_mul)/$(PF)/share/locale
        
                : # elfedit (even with its --input-mach option)
                : # is the same for all targets.
-               rm -f $(d_mul)/usr/bin/elfedit
+               rm -f $(d_mul)/$(PF)/bin/elfedit
        
                : # c++filt does not link to libbfd for anything more than
                : # the help message, and its behavior does not vary
                : # between arches aside from the --version message.
-               rm -f $(d_mul)/usr/bin/c++filt
+               rm -f $(d_mul)/$(PF)/bin/c++filt
        
                : # As gas/README points out (search for --enable-targets),
                : # multi-arch gas is not ready yet.
-               rm -f $(d_mul)/usr/bin/as
+               rm -f $(d_mul)/$(PF)/bin/as
        
                : # binutils will provide ldscripts for the native architecture.
-               set -e; for i in $(d_bin)/usr/lib/ldscripts/*; do \
-                       rm -f $(d_mul)/usr/lib/ldscripts/`basename $$i`; \
+               set -e; for i in $(d_bin)/$(PF)/lib/ldscripts/*; do \
+                       rm -f $(d_mul)/$(PF)/lib/ldscripts/`basename $$i`; \
                done
        
                : # binutils will provide the ld symlink.
-               mv -f $(d_mul)/usr/bin/ld $(d_mul)/usr/bin/ld.bfd
+               mv -f $(d_mul)/$(PF)/bin/ld $(d_mul)/$(PF)/bin/ld.bfd
        
          ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
-               rm -f $(d_mul)/usr/bin/embedspu
+               rm -f $(d_mul)/$(PF)/bin/embedspu
          endif
        endif
        
-               $(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/
+               $(install_dir) $(d_dev)/$(PF)/include/ $(d_dev)/$(PF)/lib/
+               mv $(d_bin)/$(PF)/include/* $(d_dev)/$(PF)/include/
+               mv $(d_bin)/$(PF)/lib/*.a $(d_bin)/$(PF)/lib/libbfd.so 
$(d_bin)/$(PF)/lib/libopcodes.so \
+                  $(d_dev)/$(PF)/lib/
        
        ifeq ($(with_multiarch),yes)
-               rm -f $(d_mul)/usr/lib/libbfd.so $(d_mul)/usr/lib/libopcodes.so
-               rm -f $(d_mul)/usr/lib/*.la $(d_mul)/usr/lib/*.a
-               rm -f $(d_mul)/usr/lib*/libiberty*
+               rm -f $(d_mul)/$(PF)/lib/libbfd.so 
$(d_mul)/$(PF)/lib/libopcodes.so
+               rm -f $(d_mul)/$(PF)/lib/*.la $(d_mul)/$(PF)/lib/*.a
+               rm -f $(d_mul)/$(PF)/lib*/libiberty*
        endif
        
                : # Get rid of .la files since libtool obviously has no idea 
about transient paths
-               rm -f $(d_bin)/usr/lib/*.la
+               rm -f $(d_bin)/$(PF)/lib/*.la
        
        ifeq ($(with_strip),yes)
                : # 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_bin)/$(PF)/lib/libbfd-*so
+               $(STRIP) --strip-unneeded $(d_bin)/$(PF)/lib/libopcodes-*so
        
-               chmod ugo-x $(d_bin)/usr/lib/*.so
+               chmod ugo-x $(d_bin)/$(PF)/lib/*.so
        
-               $(STRIP) $$(file $(d_bin)/usr/bin/* |awk -F: '$$0 !~ /script/ 
{print $$1}')
+               $(STRIP) $$(file $(d_bin)/$(PF)/bin/* |awk -F: '$$0 !~ /script/ 
{print $$1}')
        
          ifeq ($(with_multiarch),yes)
-               $(STRIP) --strip-unneeded $(d_mul)/usr/lib/libbfd-*so
-               $(STRIP) --strip-unneeded $(d_mul)/usr/lib/libopcodes-*so
+               $(STRIP) --strip-unneeded $(d_mul)/$(PF)/lib/libbfd-*so
+               $(STRIP) --strip-unneeded $(d_mul)/$(PF)/lib/libopcodes-*so
        
-               chmod ugo-x $(d_mul)/usr/lib/*.so
+               chmod ugo-x $(d_mul)/$(PF)/lib/*.so
        
-               $(STRIP) $$(file $(d_mul)/usr/bin/* |awk -F: '$$0 !~ /script/ 
{print $$1}')
+               $(STRIP) $$(file $(d_mul)/$(PF)/bin/* |awk -F: '$$0 !~ /script/ 
{print $$1}')
          endif
        endif
        
                : # Don't want /usr/<arch>-linux to exist in any package
-               rm -rf $(d_bin)/usr/$(DEB_HOST_GNU_TYPE)
+               rm -rf $(d_bin)/$(PF)/$(DEB_HOST_GNU_TYPE)
        
                : # Remove windres manpages
-               rm -f $(d_bin)/usr/share/man/man1/windres.1
+               rm -f $(d_bin)/$(PF)/share/man/man1/windres.1
        
        ifeq ($(with_multiarch),yes)
-               rm -rf $(d_mul)/usr/$(DEB_HOST_GNU_TYPE)
-               rm -f $(d_mul)/usr/share/man/man1/windres.1
+               rm -rf $(d_mul)/$(PF)/$(DEB_HOST_GNU_TYPE)
+               rm -f $(d_mul)/$(PF)/share/man/man1/windres.1
        endif
        
        ifeq ($(with_gold),yes)
-               rm -f $(d_bin)/usr/bin/ld
-               ln -s ld.bfd $(d_bin)/usr/bin/ld
-               ln -s ld.gold $(d_bin)/usr/bin/gold
-               mv $(d_bin)/usr/share/man/man1/ld.1 \
-                       $(d_bin)/usr/share/man/man1/ld.bfd.1
-               ln -s ld.bfd.1.gz $(d_bin)/usr/share/man/man1/ld.1.gz
+               rm -f $(d_bin)/$(PF)/bin/ld
+               ln -s ld.bfd $(d_bin)/$(PF)/bin/ld
+               ln -s ld.gold $(d_bin)/$(PF)/bin/gold
+               mv $(d_bin)/$(PF)/share/man/man1/ld.1 \
+                       $(d_bin)/$(PF)/share/man/man1/ld.bfd.1
+               ln -s ld.bfd.1.gz $(d_bin)/$(PF)/share/man/man1/ld.1.gz
        
                : # install a symlink for the gold linker
-               $(install_dir) $(d_bin)/usr/lib/gold-ld
-               ln -s ../../bin/ld.gold $(d_bin)/usr/lib/gold-ld/ld
+               $(install_dir) $(d_bin)/$(PF)/lib/gold-ld
+               ln -s ../../bin/ld.gold $(d_bin)/$(PF)/lib/gold-ld/ld
        
                : # only keep the gold linker diversion to it's own package.
                rm -fr $(d_gold)
                $(install_dir) $(d_gold)
-               $(install_dir) $(d_gold)/usr/bin
-               ln -s ld.gold $(d_gold)/usr/bin/ld
+               $(install_dir) $(d_gold)/$(PF)/bin
+               ln -s ld.gold $(d_gold)/$(PF)/bin/ld
        endif
                : # install a symlink for the old linker
-               $(install_dir) $(d_bin)/usr/lib/compat-ld
-               ln -s ../../bin/ld.bfd $(d_bin)/usr/lib/compat-ld/ld
+               $(install_dir) $(d_bin)/$(PF)/lib/compat-ld
+               ln -s ../../bin/ld.bfd $(d_bin)/$(PF)/lib/compat-ld/ld
        
                : # Remove empty directory
-               rmdir $(d_bin)/usr/include/
+               rmdir $(d_bin)/$(PF)/include/
        
                : # install libiberty PIC library
                $(install_file) builddir-single/libiberty/pic/libiberty.a \
-                       $(d_dev)/usr/lib/libiberty_pic.a
+                       $(d_dev)/$(PF)/lib/libiberty_pic.a
        
                touch install-stamp
        
@@ -621,39 +627,39 @@ install-hppa64-stamp: checkroot build-hp
        
                rm -fr $(d_hppa64)
                $(install_dir) $(d_hppa64)
-               $(install_dir) $(d_hppa64)/usr/lib
+               $(install_dir) $(d_hppa64)/$(PF)/lib
        
                : # install binutils-hppa64 stuff
                env MAKE="$(MAKE) VERSION=$(HPPA64_VERSION)" \
                  $(MAKE) -C builddir-hppa64 \
                        CFLAGS="$(CFLAGS)" \
-                       prefix=$(pwd)/$(d_hppa64)/usr/ \
-                       mandir=$(pwd)/$(d_hppa64)/usr/share/man \
-                       infodir=$(pwd)/$(d_hppa64)/usr/share/info install
+                       prefix=$(pwd)/$(d_hppa64)/$(PF)/ \
+                       mandir=$(pwd)/$(d_hppa64)/$(PF)/share/man \
+                       infodir=$(pwd)/$(d_hppa64)/$(PF)/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/.
+               mv 
$(d_hppa64)/$(PF)/hppa-linux-gnu/hppa64-linux-gnu/lib/lib*-*.so \
+                       $(d_hppa64)/$(PF)/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
+               rm -rf $(d_hppa64)/$(PF)/man
+               rm -rf $(d_hppa64)/$(PF)/info
+               rm -rf $(d_hppa64)/$(PF)/include
+               rm -rf $(d_hppa64)/$(PF)/share
+               rm -rf $(d_hppa64)/$(PF)/hppa-linux-gnu
+               rm -rf $(d_hppa64)/$(PF)/lib/libiberty.a
        
        ifeq ($(with_strip),yes)
                : # Strip shared libraries
-               $(STRIP) --strip-unneeded $(d_hppa64)/usr/lib/libbfd-*so
-               $(STRIP) --strip-unneeded $(d_hppa64)/usr/lib/libopcodes-*so
-               $(STRIP) $$(file $(d_hppa64)/usr/bin/* | awk -F: '$$0 !~ 
/script/ {print $$1}')
+               $(STRIP) --strip-unneeded $(d_hppa64)/$(PF)/lib/libbfd-*so
+               $(STRIP) --strip-unneeded $(d_hppa64)/$(PF)/lib/libopcodes-*so
+               $(STRIP) $$(file $(d_hppa64)/$(PF)/bin/* | awk -F: '$$0 !~ 
/script/ {print $$1}')
        endif
        
-               chmod ugo-x $(d_hppa64)/usr/lib/*.so
+               chmod ugo-x $(d_hppa64)/$(PF)/lib/*.so
        
                : # Don't want /usr/<arch>-linux to exist in any package
-               rm -rf $(d_hppa64)/usr/hppa64-linux-gnu
+               rm -rf $(d_hppa64)/$(PF)/hppa64-linux-gnu
        
                touch install-hppa64-stamp
        
@@ -680,40 +686,40 @@ install-spu-stamp: checkroot build-spu-s
        
                rm -fr $(d_spu)
                $(install_dir) $(d_spu)
-               $(install_dir) $(d_spu)/usr/lib
+               $(install_dir) $(d_spu)/$(PF)/lib
        
                : # install binutils-spu stuff
                env MAKE="$(MAKE) VERSION=$(SPU_VERSION)" \
                  $(MAKE) -C builddir-spu \
                        CFLAGS="$(CFLAGS)" \
-                       prefix=$(pwd)/$(d_spu)/usr/ \
-                       mandir=$(pwd)/$(d_spu)/usr/share/man \
-                       infodir=$(pwd)/$(d_spu)/usr/share/info install
+                       prefix=$(pwd)/$(d_spu)/$(PF)/ \
+                       mandir=$(pwd)/$(d_spu)/$(PF)/share/man \
+                       infodir=$(pwd)/$(d_spu)/$(PF)/share/info install
        
                : # move shared libs to the standard path
-               mv $(d_spu)/usr/$(DEB_HOST_GNU_TYPE)/spu-elf/lib/lib*-*.so \
-                       $(d_spu)/usr/lib/.
+               mv $(d_spu)/$(PF)/$(DEB_HOST_GNU_TYPE)/spu-elf/lib/lib*-*.so \
+                       $(d_spu)/$(PF)/lib/.
        
                : # Now get rid of just about everything in binutils-spu
-               rm -rf $(d_spu)/usr/man
-               rm -rf $(d_spu)/usr/info
-               rm -rf $(d_spu)/usr/include
-               rm -rf $(d_spu)/usr/share
-               rm -rf $(d_spu)/usr/$(DEB_HOST_GNU_TYPE)
-               rm -rf $(d_spu)/usr/lib/libiberty.a
-               rm -rf $(d_spu)/usr/lib/ldscripts
+               rm -rf $(d_spu)/$(PF)/man
+               rm -rf $(d_spu)/$(PF)/info
+               rm -rf $(d_spu)/$(PF)/include
+               rm -rf $(d_spu)/$(PF)/share
+               rm -rf $(d_spu)/$(PF)/$(DEB_HOST_GNU_TYPE)
+               rm -rf $(d_spu)/$(PF)/lib/libiberty.a
+               rm -rf $(d_spu)/$(PF)/lib/ldscripts
        
        ifeq ($(with_strip),yes)
                : # Strip shared libraries
-               $(STRIP) --strip-unneeded $(d_spu)/usr/lib/libbfd-*so
-               $(STRIP) --strip-unneeded $(d_spu)/usr/lib/libopcodes-*so
-               $(STRIP) $$(file $(d_spu)/usr/bin/* | awk -F: '$$0 !~ /script/ 
{print $$1}')
+               $(STRIP) --strip-unneeded $(d_spu)/$(PF)/lib/libbfd-*so
+               $(STRIP) --strip-unneeded $(d_spu)/$(PF)/lib/libopcodes-*so
+               $(STRIP) $$(file $(d_spu)/$(PF)/bin/* | awk -F: '$$0 !~ 
/script/ {print $$1}')
        endif
        
-               chmod ugo-x $(d_spu)/usr/lib/*.so
+               chmod ugo-x $(d_spu)/$(PF)/lib/*.so
        
                : # Don't want /usr/<arch>-linux to exist in any package
-               rm -rf $(d_spu)/usr/spu-elf
+               rm -rf $(d_spu)/$(PF)/spu-elf
        
                touch install-spu-stamp
        
@@ -733,30 +739,30 @@ ifeq (,$(TARGET))
        
                $(install_dir) $(d_doc)/DEBIAN
        
-               $(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)/
+               $(install_dir) $(d_doc)/$(PF)/share/doc/$(p_doc)/
+               $(install_file) debian/changelog 
$(d_doc)/$(PF)/share/doc/$(p_doc)/changelog.Debian
+               $(install_file) debian/copyright 
$(d_doc)/$(PF)/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; \
+                 ln -sf ../$(p_bin)/$$i $(d_doc)/$(PF)/share/doc/$(p_doc)/$$i; 
\
                done
-               find $(d_doc)/usr/share/doc/$(p_doc) -maxdepth 1 -type f ! 
-name copyright | xargs gzip -9
-               gzip -9 $(d_doc)/usr/share/info/*
+               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)
                chown -R root:root $(d_doc)
                chmod -R go=rX  $(d_doc)
                dpkg --build $(d_doc) ..
        
-               $(install_dir) $(d_src)/usr/share/doc/$(p_src)/
-               $(install_file) debian/changelog 
$(d_src)/usr/share/doc/$(p_src)/changelog.Debian
-               $(install_file) debian/copyright 
$(d_src)/usr/share/doc/$(p_src)/
-               find $(d_src)/usr/share/doc/$(p_src) -maxdepth 1 -type f ! 
-name copyright | xargs gzip -9
+               $(install_dir) $(d_src)/$(PF)/share/doc/$(p_src)/
+               $(install_file) debian/changelog 
$(d_src)/$(PF)/share/doc/$(p_src)/changelog.Debian
+               $(install_file) debian/copyright 
$(d_src)/$(PF)/share/doc/$(p_src)/
+               find $(d_src)/$(PF)/share/doc/$(p_src) -maxdepth 1 -type f ! 
-name copyright | xargs gzip -9
        
                $(install_dir) $(d_src)/DEBIAN
-               $(install_dir) $(d_src)/usr/src/binutils/patches
-               $(install_file) debian/patches/* 
$(d_src)/usr/src/binutils/patches/
+               $(install_dir) $(d_src)/$(PF)/src/binutils/patches
+               $(install_file) debian/patches/* 
$(d_src)/$(PF)/src/binutils/patches/
                tar -c --xz -C .. --exclude=CVS \
-                       -f 
$(pwd)/$(d_src)/usr/src/binutils/binutils-$(VERSION).tar.xz \
+                       -f 
$(pwd)/$(d_src)/$(PF)/src/binutils/binutils-$(VERSION).tar.xz \
                        $(source_files)
        
                dpkg-gencontrol -isp -P$(d_src) -p$(p_src)
@@ -785,17 +791,17 @@ ifneq (,$(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 -9f $(d_cross)/usr/share/doc/$(p_cross)/changelog.Debian
+               $(install_dir) $(d_cross)/$(PF)/share/doc/$(p_cross)/
+               $(install_file) debian/changelog 
$(d_cross)/$(PF)/share/doc/$(p_cross)/changelog.Debian
+               $(install_file) debian/copyright debian/README.cross 
$(d_cross)/$(PF)/share/doc/$(p_cross)/
+               gzip -9f $(d_cross)/$(PF)/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; \
+                 ln -sf ../binutils/$$pkg 
$(d_cross)/$(PF)/share/doc/$(p_cross)/$$pkg; \
                done
        
                rm -f debian/substvars
-               dpkg-shlibdeps $(d_cross)/usr/bin/*
+               dpkg-shlibdeps $(d_cross)/$(PF)/bin/*
                dpkg-gencontrol -isp -cdebian/control.$(TARGET) -P$(d_cross) 
-p$(p_cross)
                dpkg --build $(d_cross) ..
        
@@ -815,22 +821,22 @@ else
        
                : # make lintian happy
                $(install_file) -D debian/$(p_bin).overrides \
-                       $(d_bin)/usr/share/lintian/overrides/$(p_bin)
+                       $(d_bin)/$(PF)/share/lintian/overrides/$(p_bin)
        ifeq ($(with_multiarch),yes)
                $(install_file) -D debian/$(p_mul).overrides \
-                       $(d_mul)/usr/share/lintian/overrides/$(p_mul)
+                       $(d_mul)/$(PF)/share/lintian/overrides/$(p_mul)
        endif
        ifeq ($(DEB_HOST_ARCH),hppa)
                $(install_file) -D debian/$(p_hppa64).overrides \
-                       $(d_hppa64)/usr/share/lintian/overrides/$(p_hppa64)
+                       $(d_hppa64)/$(PF)/share/lintian/overrides/$(p_hppa64)
        endif
        ifeq ($(with_gold),yes)
                $(install_file) -D debian/$(p_gold).overrides \
-                       $(d_gold)/usr/share/lintian/overrides/$(p_gold)
+                       $(d_gold)/$(PF)/share/lintian/overrides/$(p_gold)
        endif
        ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
                $(install_file) -D debian/$(p_spu).overrides \
-                       $(d_spu)/usr/share/lintian/overrides/$(p_spu)
+                       $(d_spu)/$(PF)/share/lintian/overrides/$(p_spu)
        endif
        
                : # install maintainer scrtips
@@ -870,63 +876,63 @@ ifneq (,$(filter $(DEB_HOST_ARCH),powerp
        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_bin)/$(PF)/share/doc/$(p_bin)/
+               $(install_file) debian/changelog 
$(d_bin)/$(PF)/share/doc/$(p_bin)/changelog.Debian
+               $(install_file) debian/copyright 
$(d_bin)/$(PF)/share/doc/$(p_bin)/
        
-               $(install_dir) $(d_dev)/usr/share/doc/
-               ln -sf $(p_bin) $(d_dev)/usr/share/doc/$(p_dev)
+               $(install_dir) $(d_dev)/$(PF)/share/doc/
+               ln -sf $(p_bin) $(d_dev)/$(PF)/share/doc/$(p_dev)
        ifeq ($(with_multiarch),yes)
-               $(install_dir) $(d_mul)/usr/share/doc/
-               ln -sf $(p_bin) $(d_mul)/usr/share/doc/$(p_mul)
+               $(install_dir) $(d_mul)/$(PF)/share/doc/
+               ln -sf $(p_bin) $(d_mul)/$(PF)/share/doc/$(p_mul)
        endif
        ifeq ($(with_gold),yes)
-               $(install_dir) $(d_gold)/usr/share/doc/
-               ln -sf $(p_bin) $(d_gold)/usr/share/doc/$(p_gold)
+               $(install_dir) $(d_gold)/$(PF)/share/doc/
+               ln -sf $(p_bin) $(d_gold)/$(PF)/share/doc/$(p_gold)
        endif
        ifeq ($(DEB_HOST_ARCH),hppa)
-               $(install_dir) $(d_hppa64)/usr/share/doc/
-               ln -sf $(p_bin) $(d_hppa64)/usr/share/doc/$(p_hppa64)
+               $(install_dir) $(d_hppa64)/$(PF)/share/doc/
+               ln -sf $(p_bin) $(d_hppa64)/$(PF)/share/doc/$(p_hppa64)
        endif
        ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
-               $(install_dir) $(d_spu)/usr/share/doc/
-               ln -sf $(p_bin) $(d_spu)/usr/share/doc/$(p_spu)
+               $(install_dir) $(d_spu)/$(PF)/share/doc/
+               ln -sf $(p_bin) $(d_spu)/$(PF)/share/doc/$(p_spu)
        endif
        
        ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
        ifeq ($(with_check),yes)
-               $(install_file) $(pwd)/test-summary 
$(d_bin)/usr/share/doc/$(p_bin)/
+               $(install_file) $(pwd)/test-summary 
$(d_bin)/$(PF)/share/doc/$(p_bin)/
        endif
        endif
                $(install_file) binutils/NEWS debian/README.cross \
-                               $(d_bin)/usr/share/doc/$(p_bin)/
+                               $(d_bin)/$(PF)/share/doc/$(p_bin)/
        
-               $(install_file) binutils/ChangeLog 
$(d_bin)/usr/share/doc/$(p_bin)/changelog
+               $(install_file) binutils/ChangeLog 
$(d_bin)/$(PF)/share/doc/$(p_bin)/changelog
        
                for pkg in bfd gas gprof ld; do \
-                 $(install_dir) $(d_bin)/usr/share/doc/$(p_bin)/$$pkg; \
+                 $(install_dir) $(d_bin)/$(PF)/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/
+                               $(d_bin)/$(PF)/share/doc/$(p_bin)/bfd/
+               $(install_file) gas/ChangeLog gas/NEWS 
$(d_bin)/$(PF)/share/doc/$(p_bin)/gas/
                $(install_file) gprof/ChangeLog gprof/TODO gprof/TEST \
-                               $(d_bin)/usr/share/doc/$(p_bin)/gprof/
+                               $(d_bin)/$(PF)/share/doc/$(p_bin)/gprof/
                $(install_file) ld/ChangeLog ld/TODO ld/NEWS \
-                               $(d_bin)/usr/share/doc/$(p_bin)/ld/
+                               $(d_bin)/$(PF)/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) $$dir/ChangeLog.linux 
$(d_bin)/usr/share/doc/$(p_bin)/$$dir/; \
+                   $(install_file) $$dir/ChangeLog.linux 
$(d_bin)/$(PF)/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/.
+               $(install_file) gprof/bbconv.pl 
$(d_bin)/$(PF)/share/doc/$(p_bin)/gprof/.
        
                : # Compress stuff that needs it
-               gzip -9 $(d_bin)/usr/share/man/man1/*.1
-               find $(d_bin)/usr/share/doc/$(p_bin)/ -type f ! -name copyright 
-a ! -name bbconv.pl | xargs gzip -9
+               gzip -9 $(d_bin)/$(PF)/share/man/man1/*.1
+               find $(d_bin)/$(PF)/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
@@ -1057,7 +1063,7 @@ configure-cross-stamp: patch-stamp
                mkdir builddir-$(TARGET)
                cd builddir-$(TARGET) \
                    && env CC="$(CC)" CXX="$(CXX)" ../configure 
--host=$(DEB_HOST_GNU_TYPE) \
-                       --build=$(DEB_BUILD_GNU_TYPE) --target=$(TARGET) 
--prefix=/usr \
+                       --build=$(DEB_BUILD_GNU_TYPE) --target=$(TARGET) 
--prefix=/$(PF) \
                        $(ADDITIONAL_TARGETS) $(CONFARGS)
                touch $@
        
@@ -1071,13 +1077,13 @@ install-cross-stamp: build-cross-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
+               $(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/$(PF) \
+                       mandir=$(pwd)/$(d_cross)/$(PF)/share/man install
+               rm -rf $(d_cross)/$(PF)/lib* $(d_cross)/$(PF)/info 
$(d_cross)/$(PF)/share/locale
        ifeq ($(with_strip),yes)
-               $(STRIP) $$(file $(d_cross)/usr/bin/* | awk -F: '$$0 !~ 
/script/ {print $$1}')
+               $(STRIP) $$(file $(d_cross)/$(PF)/bin/* | awk -F: '$$0 !~ 
/script/ {print $$1}')
        endif
-               gzip -9 $(d_cross)/usr/share/man/man1/*
+               gzip -9 $(d_cross)/$(PF)/share/man/man1/*
                touch $@
        
        binary-cross: 

Reply via email to