[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Updated cross-binutils patch for binutils 2.16.1-2



Hello.

Attached to this mail, there is updated cross-binutils patch for binutils 
2.16.1-2 source package.

Compared to previouse versions, it has the following change.

*) Tool names follow recent change in dpkg-architecture, and now are 
'arm-linux-gnu-ld' and similar.
For old names, symlinks are provided
 (e.g. arm-linux-ld -> arm-linux-gnu-ld).
Package is named 'binutils-arm-linux-gnu' and Conflicts/Replaces/Provides 
binutils-arm-linux.

*) TARGET now may contain both debian architecture name and GNU target 
name; both will be processed correctly.

Build instructions are the same as usual, see debian/README.cross.

Updated cross-binutils sid binary packages for i386 host and all debian 
targets are available in my repository at 
http://zigzag.lvk.cs.msu.su/~nikita/debian/sid/.
(Sarge version is still at 
http://zigzag.lvk.cs.msu.su/~nikita/debian/sarge/, and will be available 
there while sarge remains the current Debian release).
diff -urN binutils-2.16.1-2/debian/generate-cross-control binutils-2.16.1/debian/generate-cross-control
--- binutils-2.16.1-2/debian/generate-cross-control	1970-01-01 03:00:00.000000000 +0300
+++ binutils-2.16.1/debian/generate-cross-control	2005-07-13 00:52:11.000000000 +0400
@@ -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 -urN binutils-2.16.1-2/debian/patches/001_ld_makefile_patch.dpatch binutils-2.16.1/debian/patches/001_ld_makefile_patch.dpatch
--- binutils-2.16.1-2/debian/patches/001_ld_makefile_patch.dpatch	2005-07-11 23:55:47.000000000 +0400
+++ binutils-2.16.1/debian/patches/001_ld_makefile_patch.dpatch	2005-07-12 00:05:21.000000000 +0400
@@ -6,6 +6,10 @@
 ## DP: Author: Chris Chimelis <chris@debian.org>
 ## DP: Upstream status: N/A
 ## DP: Date: ??
+## DP: Fixed by Nikita Youshchenko <yoush@cs.msu.su> 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"
@@ -26,27 +30,53 @@
 exit 0
 
 @DPATCH@
-diff -urNad binutils-2.16/ld/Makefile.am /tmp/dpep.svnHqO/binutils-2.16/ld/Makefile.am
---- binutils-2.16/ld/Makefile.am	2005-01-20 20:37:49.000000000 +0100
-+++ /tmp/dpep.svnHqO/binutils-2.16/ld/Makefile.am	2005-05-06 19:11:13.208248365 +0200
-@@ -19,7 +19,7 @@
+diff -urNad binutils-2.16.1/ld/Makefile.am /tmp/dpep.61Jy7A/binutils-2.16.1/ld/Makefile.am
+--- binutils-2.16.1/ld/Makefile.am	2005-01-20 22:37:49.000000000 +0300
++++ /tmp/dpep.61Jy7A/binutils-2.16.1/ld/Makefile.am	2005-07-12 00:04:29.598914672 +0400
+@@ -19,7 +19,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@
-diff -urNad binutils-2.16/ld/Makefile.in /tmp/dpep.svnHqO/binutils-2.16/ld/Makefile.in
---- binutils-2.16/ld/Makefile.in	2005-01-23 06:36:37.000000000 +0100
-+++ /tmp/dpep.svnHqO/binutils-2.16/ld/Makefile.in	2005-05-06 19:11:13.209248065 +0200
-@@ -139,7 +139,7 @@
+@@ -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 binutils-2.16.1/ld/Makefile.in /tmp/dpep.61Jy7A/binutils-2.16.1/ld/Makefile.in
+--- binutils-2.16.1/ld/Makefile.in	2005-01-23 08:36:37.000000000 +0300
++++ /tmp/dpep.61Jy7A/binutils-2.16.1/ld/Makefile.in	2005-07-12 00:05:17.381650592 +0400
+@@ -139,7 +139,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@
+@@ -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 -urN binutils-2.16.1-2/debian/patches/00list binutils-2.16.1/debian/patches/00list
--- binutils-2.16.1-2/debian/patches/00list	2005-07-11 23:55:47.000000000 +0400
+++ binutils-2.16.1/debian/patches/00list	2005-07-12 00:07:15.000000000 +0400
@@ -7,3 +7,4 @@
 117_mips_symbolic_link
 118_arm_pass_all
 120_mips_xgot_multigot_workaround
+999_lib64_for_cross
diff -urN binutils-2.16.1-2/debian/patches/999_lib64_for_cross.dpatch binutils-2.16.1/debian/patches/999_lib64_for_cross.dpatch
--- binutils-2.16.1-2/debian/patches/999_lib64_for_cross.dpatch	1970-01-01 03:00:00.000000000 +0300
+++ binutils-2.16.1/debian/patches/999_lib64_for_cross.dpatch	2005-07-11 23:57:05.000000000 +0400
@@ -0,0 +1,56 @@
+#! /bin/sh -e
+## 999_lib64_for_cross.dpatch by Nikita Youshchenko <yoush@cs.msu.su>
+##
+## 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
+
+@DPATCH@
+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 -urN binutils-2.16.1-2/debian/patch-stamp binutils-2.16.1/debian/patch-stamp
--- binutils-2.16.1-2/debian/patch-stamp	1970-01-01 03:00:00.000000000 +0300
+++ binutils-2.16.1/debian/patch-stamp	2005-07-12 23:17:11.000000000 +0400
@@ -0,0 +1,2 @@
+Patches applied in the Debian version of :
+
diff -urN binutils-2.16.1-2/debian/README.cross binutils-2.16.1/debian/README.cross
--- binutils-2.16.1-2/debian/README.cross	1970-01-01 03:00:00.000000000 +0300
+++ binutils-2.16.1/debian/README.cross	2005-07-12 23:24:22.000000000 +0400
@@ -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 <yoush@cs.msu.su>
diff -urN binutils-2.16.1-2/debian/rules binutils-2.16.1/debian/rules
--- binutils-2.16.1-2/debian/rules	2005-07-11 23:55:47.000000000 +0400
+++ binutils-2.16.1/debian/rules	2005-07-12 23:37:34.000000000 +0400
@@ -393,7 +393,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
 
@@ -453,6 +454,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

Attachment: pgp5zQXUF08f0.pgp
Description: PGP signature


Reply to: