This patch is an update against 2.15-6 sources with an additional fix for default search path of shared libararies.
diff -Nru binutils-2.15/debian/README.cross binutils-2.15.cross/debian/README.cross --- binutils-2.15/debian/README.cross Thu Jan 1 01:00:00 1970 +++ binutils-2.15.cross/debian/README.cross Wed Jun 1 11:29:26 2005 @@ -0,0 +1,12 @@ +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 + +(substitute your target name, e.g. "arm-linux", instead of "your-target") + +--- +Nikita Youshchenko <[EMAIL PROTECTED]> diff -Nru binutils-2.15/debian/control.cross.in binutils-2.15.cross/debian/control.cross.in --- binutils-2.15/debian/control.cross.in Thu Jan 1 01:00:00 1970 +++ binutils-2.15.cross/debian/control.cross.in Wed Jun 1 11:29:26 2005 @@ -0,0 +1,12 @@ +Package: PACKAGE +Architecture: any +Depends: binutils, ${shlibs:Depends} +Suggests: binutils-doc (= ${Source-Version}) +Priority: extra +OLD_EMDEBIAN_CONFLICT +Description: The GNU binary utilities, for TARGET target + This package provides GNU assembler, linker and binary utilities + for TARGET target, for use in cross-compilation environment. + . + You don't need this package unless you plan to cross-compile programs + for TARGET. diff -Nru binutils-2.15/debian/patches/00list binutils-2.15.cross/debian/patches/00list --- binutils-2.15/debian/patches/00list Wed Jun 1 11:30:45 2005 +++ binutils-2.15.cross/debian/patches/00list Wed Jun 1 11:30:03 2005 @@ -16,3 +16,4 @@ 121_ia64_unwind_fixes 122_m68k_undefweak_symbols 123_bfd_overflow_fix +999_lib64_for_cross diff -Nru binutils-2.15/debian/patches/999_lib64_for_cross.dpatch binutils-2.15.cross/debian/patches/999_lib64_for_cross.dpatch --- binutils-2.15/debian/patches/999_lib64_for_cross.dpatch Thu Jan 1 01:00:00 1970 +++ binutils-2.15.cross/debian/patches/999_lib64_for_cross.dpatch Wed Jun 1 11:29:26 2005 @@ -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 -Nru binutils-2.15/debian/rules binutils-2.15.cross/debian/rules --- binutils-2.15/debian/rules Wed Jun 1 11:30:45 2005 +++ binutils-2.15.cross/debian/rules Wed Jun 1 11:29:26 2005 @@ -377,7 +377,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 @@ -433,6 +434,99 @@ chmod -R go=rX $(d_hppa64) dpkg --build $(d_hppa64) .. endif + +################################################################################ + +################# +# cross targets # +################# + +p_cross = $(subst _,-,binutils-$(TARGET)) +d_cross = debian/$(p_cross) + +ifneq ($(filter sparc-linux powerpc-linux mips-linux, $(TARGET)),) +ADDITIONAL_TARGETS = --enable-targets=$(TARGET:%-linux=%64-linux) +endif +ifneq ($(filter i386-linux i486-linux i586-linux x86-linux, $(TARGET)),) +ADDITIONAL_TARGETS = --enable-targets=x86_64-linux +endif +ifeq ($(TARGET), x86_64-linux) +ADDITIONAL_TARGETS = --enable-targets=i386-linux +endif +ifeq ($(TARGET), mipsel-linux) +ADDITIONAL_TARGETS = --enable-targets=mips64el-linux +endif +ifeq ($(TARGET), sparc64-linux) +ADDITIONAL_TARGETS = --enable-targets=sparc-linux +endif +ifeq ($(TARGET), s390-linux) +ADDITIONAL_TARGETS = --enable-targets=s390x-linux +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 \ + --libdir=/usr/$(TARGET)/lib $(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 \ + libdir=$(pwd)/$(d_cross)/usr/$(TARGET)/lib \ + 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/* + touch $@ + +binary-cross: checkroot install-$(TARGET)-stamp + $(checkdir) + test "" != "$(TARGET)" + + sed '/^$$/ q' < debian/control > debian/control.$(TARGET) + case "$(TARGET)" in \ + arm-linux|powerpc-linux) \ + sed "s/TARGET/$(TARGET)/g; s/PACKAGE/$(p_cross)/; s/OLD_EMDEBIAN_CONFLICT/Conflicts: binutils-`echo $(TARGET) | sed s/-linux//`/" < debian/control.cross.in >> debian/control.$(TARGET) ;; \ + *) \ + grep -v OLD_EMDEBIAN_CONFLICT debian/control.cross.in | sed "s/TARGET/$(TARGET)/g; s/PACKAGE/$(p_cross)/" >> debian/control.$(TARGET) ;; \ + esac + + $(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 ################################################################################