Package: binutils Version: 2.20.1-12 Severity: wishlist Tags: patch Here is a combined patch for your consideration. This patch implements the features already incorporated into binutils-2.20.51.20100908. See bugs http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588357 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=590101 for reference.
This combined patch will modify binutils-2.20.1-14 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. This patch will also modify the rules makefile for the binutils package to allow an option to build statically when creating a cross compiler by passing the environment variable DEB_BUILD_OPTIONS=static-cross on the command line when building. This patch has been tested using the following build lines Cross build With modified prefix and static build PF=opt/ilomtools/crosscompiler/gcc-4.4__100910/arm DEB_BUILD_OPTIONS=static-cro$ Cross build With modified prefix PF=opt/ilomtools/crosscompiler/gcc-4.4__100910/arm TARGET=armel fakeroot debian$ Normal cross build TARGET=armel fakeroot debian/rules binary-cross Each test produced a package with the expected contents, which installed properly. -- 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-8 GCC support library ii libstdc++6 4.4.4-8 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
--- binutils-2.20.1/debian/rules.orig 2010-09-17 10:55:46.000000000 -0400 +++ binutils-2.20.1/debian/rules 2010-09-17 10:55:54.000000000 -0400 @@ -93,12 +93,18 @@ with_multiarch = disabled in DEB_BUILD_OPTIONS 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)" @@ -299,7 +305,7 @@ 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)" @@ -328,7 +334,7 @@ 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 @@ -356,7 +362,7 @@ 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) \ @@ -418,121 +424,121 @@ : # 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 : # 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 : # 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 + rm -f $(d_mul)/$(PF)/bin/as $(d_mul)/$(PF)/bin/gasp $(d_mul)/$(PF)/bin/c++filt \ + $(d_mul)/$(PF)/bin/ld + rm -rf $(d_mul)/$(PF)/lib/ldscripts 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 - ln -s ld.bfd.1.gz $(d_bin)/usr/share/man/man1/gold.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 + ln -s ld.bfd.1.gz $(d_bin)/$(PF)/share/man/man1/gold.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 @@ -541,39 +547,39 @@ 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 @@ -582,40 +588,40 @@ 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 @@ -632,31 +638,31 @@ $(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/ - chmod 755 $(d_src)/usr/src/binutils/patches/*.dpatch + $(install_dir) $(d_src)/$(PF)/src/binutils/patches + $(install_file) debian/patches/* $(d_src)/$(PF)/src/binutils/patches/ + chmod 755 $(d_src)/$(PF)/src/binutils/patches/*.dpatch tar -c --bzip2 -C .. --exclude=CVS \ - -f $(pwd)/$(d_src)/usr/src/binutils/binutils-$(VERSION).tar.bz2 \ + -f $(pwd)/$(d_src)/$(PF)/src/binutils/binutils-$(VERSION).tar.bz2 \ $(source_files) dpkg-gencontrol -isp -P$(d_src) -p$(p_src) @@ -676,22 +682,22 @@ : # 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 @@ -730,63 +736,63 @@ 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 @@ -856,6 +862,12 @@ # Process the following only if $(TARGET) is set ifneq ($(TARGET),) +ifneq (,$(findstring static-cross,$(DEB_BUILD_OPTIONS))) + cross_install_stamp = install-static-$(TARGET)-stamp +else + cross_install_stamp = install-$(TARGET)-stamp +endif + # 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 -f -a$(TARGET) -qDEB_HOST_GNU_TYPE 2>/dev/null) @@ -917,7 +929,7 @@ 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 $@ @@ -931,17 +943,43 @@ $(checkdir) test "" != "$(TARGET)" rm -rf $(d_cross) - $(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/usr \ - mandir=$(pwd)/$(d_cross)/usr/share/man \ - infodir=$(pwd)/$(d_cross)/usr/share/info install - rm -rf $(d_cross)/usr/lib* $(d_cross)/usr/share/info $(d_cross)/usr/share/locale + $(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/$(PF) \ + mandir=$(pwd)/$(d_cross)/$(PF)/share/man \ + infodir=$(pwd)/$(d_cross)/$(PF)/share/info install + rm -rf $(d_cross)/$(PF)/lib* $(d_cross)/$(PF)/share/info $(d_cross)/$(PF)/share/locale +ifeq ($(with_strip),yes) + $(STRIP) $$(file $(d_cross)/$(PF)/bin/* | awk -F: '$$0 !~ /script/ {print $$1}') +endif + gzip -9 $(d_cross)/$(PF)/share/man/man1/* + touch $@ + +configure-host-$(TARGET)-stamp: configure-$(TARGET)-stamp + $(checkdir) + test "" != "$(TARGET)" + $(MAKE) configure-host -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)" + touch $@ + +build-static-$(TARGET)-stamp: configure-host-$(TARGET)-stamp + $(checkdir) + test "" != "$(TARGET)" + $(MAKE) -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)" LDFLAGS="-all-static" + touch $@ + +install-static-$(TARGET)-stamp: build-static-$(TARGET)-stamp + $(checkdir) + test "" != "$(TARGET)" + rm -rf $(d_cross) + $(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/$(PF) \ + mandir=$(pwd)/$(d_cross)/$(PF)/share/man \ + infodir=$(pwd)/$(d_cross)/$(PF)/share/info install + rm -rf $(d_cross)/$(PF)/lib* $(d_cross)/$(PF)/share/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: checkroot install-$(TARGET)-stamp +binary-cross: checkroot $(cross_install_stamp) $(checkdir) test "" != "$(TARGET)" @@ -951,17 +989,17 @@ $(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) ..