Updated cross-binutils patch
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello.
Attached to this message is my updated patch to binutils debian source
package that enables cross-binutils builds.
The only difference from the previous version is that now it sets same
additional --enable-targets for cross targets as are set for native
targets.
As previously, the patch only adds additional targets to debian/rules.
Native build is not affected anyhow.
Do I understand correctly that debian binutils source package +
binutils.cross patch is the 'official' way of building emdebian
cross-binutils? If so, maybe we should ask James Troup once more to
include this (definitly harmless) patch to the official package?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA2eZ7sTbPknTfAB4RAiNtAJsGqKv4AbErFDYZ+VUpBpq/Eoi7KwCfQeJz
x4jrR9Cdlz92kB8tZdwJo/Y=
=MOZc
-----END PGP SIGNATURE-----
diff -urN binutils-2.14.90.0.7/debian/control.cross.in binutils-2.14.90.0.7.cross/debian/control.cross.in
--- binutils-2.14.90.0.7/debian/control.cross.in 1970-01-01 03:00:00.000000000 +0300
+++ binutils-2.14.90.0.7.cross/debian/control.cross.in 2004-06-23 00:56:36.000000000 +0400
@@ -0,0 +1,11 @@
+Package: binutils-TARGET
+Architecture: any
+Depends: binutils, ${shlibs:Depends}
+Suggests: binutils-doc (= ${Source-Version})
+Priority: extra
+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 -urN binutils-2.14.90.0.7/debian/README.cross binutils-2.14.90.0.7.cross/debian/README.cross
--- binutils-2.14.90.0.7/debian/README.cross 1970-01-01 03:00:00.000000000 +0300
+++ binutils-2.14.90.0.7.cross/debian/README.cross 2004-06-23 00:56:36.000000000 +0400
@@ -0,0 +1,9 @@
+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")
diff -urN binutils-2.14.90.0.7/debian/rules binutils-2.14.90.0.7.cross/debian/rules
--- binutils-2.14.90.0.7/debian/rules 2004-06-23 00:59:20.000000000 +0400
+++ binutils-2.14.90.0.7.cross/debian/rules 2004-06-23 00:58:40.000000000 +0400
@@ -382,7 +382,7 @@
endif
$(install_file) $(pwd)/test-summary binutils/NEWS binutils/ChangeLog.linux \
- 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
@@ -434,6 +434,87 @@
################################################################################
+#################
+# cross targets #
+#################
+
+d_cross = debian/binutils-$(TARGET)
+p_cross = binutils-$(TARGET)
+
+ifneq ($(filter sparc-linux powerpc-linux mips-linux mipsel-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), 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 \
+ $(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/*
+ touch $@
+
+binary-cross: checkroot install-$(TARGET)-stamp
+ $(checkdir)
+ test "" != "$(TARGET)"
+
+ sed '/^$$/ q' < debian/control > debian/control.$(TARGET)
+ sed 's/TARGET/$(TARGET)/g' < debian/control.cross.in >> 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
+
+################################################################################
+
define checkdir
test -f bfd/elf32.c -a -f debian/rules
endef
@@ -444,6 +525,6 @@
checkroot:
$(checkdir)
- test root = "`whoami`"
+ test root = "`whoami`"
.PHONY: binary binary-arch binary-indep clean checkroot
Reply to: