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

Unidentified subject!



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello.

Attached to this message, there is my latest patch for cross compiler 
support in gcc-3.3 source package.
The patch is against gcc-3.3_3.3.4-3 source package.

Together with new binutils-cross.patch submitted today and dpkg-cross 1.17 
just uploaded, this enables cross-compiler build for ALL debian linux 
targets, including multilib'ed sparc and s390.

The patch is somewhat large because it contains maky changes to 
README.cross, and also makes binary-libgcc-cross.mk and 
binary-libstdcxx-cross.mk to look as mush similar to their native 
equivalents as possible; I hope a merge is will be possible soon.


Updated patch for gcc-3.4 will follow soon. If would be great it you'll 
give me access to gcc 3.4 source package that you are going to upload to 
unstable, so I could fix and/or update cross-compiler support before the 
upload.

I hope that patch for gcc-2.95 will also be ready soon, so cross-compiler 
build support will be available for all gcc packages released with sarge.

Nikita
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA9kwzsTbPknTfAB4RAj4XAKCtVtKLITqfkduUyBt1y1Zev8oS4gCfXg4+
NiweqSlLdWaUPu5dScKW+3o=
=y8Dv
-----END PGP SIGNATURE-----
diff -urN gcc-3.3-3.3.4/debian/control.m4 gcc-3.3-3.3.4.cross/debian/control.m4
--- gcc-3.3-3.3.4/debian/control.m4	2004-07-15 00:33:47.000000000 +0400
+++ gcc-3.3-3.3.4.cross/debian/control.m4	2004-07-15 00:34:41.000000000 +0400
@@ -20,6 +20,8 @@
 ifdef(`TARGET', `
     define(`PRI', `optional')
     define(`LS', `-'TARGET`-cross')
+    define(`BD64', `ifelse(TARGET, `sparc', `, libc6-dev-sparc64-sparc-cross',
+                   `ifelse(TARGET, `s390', `, libc6-dev-s390x-s390-cross')')')
 ', `
     define(`TS')
     define(`LS')
@@ -36,7 +38,7 @@
 Uploaders: Matthias Klose <doko@debian.org>, Gerhard Tonn <gt@debian.org>
 Standards-Version: 3.6.1
 ifdef(`TARGET',`dnl cross
-Build-Depends: LIBC_BUILD_DEP, m4, autoconf2.13, automake1.4 | automake (<< 1.5), libtool, autotools-dev, gawk, dpkg-cross (>= 1.14.5), binutils`'TS
+Build-Depends: LIBC_BUILD_DEP, m4, autoconf2.13, automake1.4 | automake (<< 1.5), libtool, autotools-dev, gawk, dpkg-cross (>= 1.14.5), binutils`'TS`'BD64
 ',`dnl native
 Build-Depends: LIBC_BUILD_DEP, libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], m4, autoconf2.13, automake1.4 | automake (<< 1.5), libtool, autotools-dev, gawk, dejagnu (>= 1.4.3) [check_no_archs], expect (>= 5.38.0) [check_no_archs], bzip2, BINUTILS_BUILD_DEP, binutils-hppa64 [hppa], debhelper (>= 3.0.25), gperf (>= 2.7-3), bison (>= 1:1.875a-1) | bison (<< 1:1.50), flex-old | flex (<< 2.5.31), gettext, texinfo (>= 4.3), zlib1g-dev, libgc-dev [libgc_no_archs], xlibs-dev, gnat-3.3 [ada_no_archs] | gnat-3.2 [ada_no_archs] | gnat [i386 powerpc sparc], libncurses5-dev [pascal_no_archs], libgmp3-dev, tetex-bin [pascal_no_archs], locales [locale_no_archs !hurd-i386], procps [check_no_archs], help2man, sharutils
 Build-Depends-Indep: doxygen (>= 1.3.6.20040222)
@@ -69,7 +71,7 @@
  special needs for some languages.
 ifdef(`TARGET', `dnl
  .
- This package contains files for TARGET architecture architecture, for use in cross-compile
+ This package contains files for TARGET architecture, for use in cross-compile
  environment.
 ')`'dnl
 ')`'dnl libgcc
diff -urN gcc-3.3-3.3.4/debian/README.cross gcc-3.3-3.3.4.cross/debian/README.cross
--- gcc-3.3-3.3.4/debian/README.cross	2004-07-15 00:33:46.000000000 +0400
+++ gcc-3.3-3.3.4.cross/debian/README.cross	2004-07-15 00:39:38.000000000 +0400
@@ -6,6 +6,13 @@
 Cross-compiler build support is not perfect yet, please send fixes
 and improvements to debian-gcc@lists.debian.org              ]
 
+Before you start, you should probably check available pre-built
+cross-toolchain debs. At the time of writing (Jul 2004) those are
+available from
+  http://zigzag.lvk.cs.msu.su/~nikita/debian/
+If they are no longer there, you may check EmDebian web site at
+  http://emdebian.sf.net/
+or ask debian-embedded@lists.debian.org for newer location.
 
 0. What's wrong with toolchain-source approach
 
@@ -17,9 +24,9 @@
 do contain bug fixes and improvements, especially for non-x86 architectures.
 Cross-compilers built using toolchain-source will not get those fixes unless
 toolchain-source package is updated after each binutils and gcc update.
-The later is not hapenning in real life. In fact, currently (Jan 2004)
-toolchain-source is still for gcc-3.2, although Debian is already using
-gcc-3.3 for many months.
+The later is not hapenning in real life. For example, toolchain-source
+was upgraded from gcc-3.2 to gcc-3.3 half a year later than gcc-3.3 became
+Debian default compiler.
 
 Keeping toolchain-source package up-to-date requires lots of work, and seems
 to be a waste of time. It is much better to build cross-compilers directly
@@ -31,85 +38,87 @@
 1.1. dpkg-cross package
 
 Dpkg-cross package contains several tools to manage cross-compile environment.
-
 It can convert native debian library and lib-dev packages for the target
 architecture to binary-all packages that keep libraries and headers under
-/usr/$(TARGET)/.
-
-Also it contains helper tools for cross-compiling debian packages. Some of
-these tools are used while building libgcc1 and libstdc++ library packages.
-The resulting library packages follow the same convensions as library packages
-converted by dpkg-cross.
-
-Note that dpkg-shlibdeps wrapper provided by dpkg-cross used to have a bug that
-caused cross-compiler build to fail if libgcc1-$(TARGET)-cross package is not
-installed. This bug was fixed in (unofficial) version 1.14.5 of dpkg-cross,
-currently available from http://zigzag.lvk.cs.msu.su/~nikita/debian/.
-
-1.2. Packages for the Target architecture
-
-There are two ways of getting the packages you need for compiling to the
-target architecture.  The simplest way is to use the Debian 'crosshurd'
-package to build a system in a directory.  crosshurd is like debootstrap
-but cross-arch, and works on the Hurd, Linux and FreeBSD.  (The name is
-historical).  You will then need to fix symlinks in lib and usr/lib to be
-relative links instead of absolute ones.
-
-For example:
-
-lrwxrwxrwx    1 root     root           20 2004-05-06 23:02 libcom_err.so -> /lib/libcom_err.so.2
-
-Needs to be changed to:
+/usr/$(TARGET)/. Also it contains helper tools for cross-compiling debian
+packages. Some of those tools are used while building libgcc1 and libstdc++
+library packages. The resulting library packages follow the same convensions
+as library packages converted by dpkg-cross.
+
+At least version 1.16 of dpkg-cross is needed for cross-gcc package build.
+For sparc, s390 and i386 targets, which build multilib'ed compiler, at least
+version 1.16.1 is needed.
+
+1.2. cross-binutils for the target
+
+You need cross-binutils for your target to build cross-compiler.
+Binutils-multiarch package will not work because it does not provide cross-
+assemblers.
+
+If you don't want to use pre-built cross-binutils packages, you may build
+your own from binutils debian source package, using patches posted to
+bug #231707. Please use the latest of patch versions available there.
+
+Alternatively, you may use toolchain-source package to build cross-binutils
+(but in this case you will probably also want to use toolchain-source
+to build cross-compiler itself). However, multilib'ed cross-compilers may
+not build with these binutils.
+
+1.3. libc for target
+
+You also need libc library and development packages for the target
+architecture installed.
+
+To get those, download linux-kernel-headers, libdb1-compat, libc6,
+and libc6-dev binary debs for your target, convert those using
+dpkg-cross -b, and install resulting -arch-cross debs. Consult dpkg-cross
+manual page for more information.
+
+Building with/for alternative libc's is not supported yet (but this is in
+TODO).
+
+Note that if you plan to use your cross-toolchain to develop kernel drivers
+or similar low-level things, you will probably also need kernel headers
+for the exact kernel version that your target hardware uses.
 
-lrwxrwxrwx    1 root     root           20 2004-05-06 23:02 libcom_err.so -> ../../lib/libcom_err.so.2
-
-If you choose this method, set the environment variable 'with_sysroot' to
-point to the ABSOLUTE PATH where the crosshurd was done.
-
-Otherwise...
-
-1.2.0 kernel-headers package for the target architecture
 
-It is not recommended to use kernel-headers for the host architecture,
-because some constants defined in asm/*.h do differ between architectures.
+2. Building cross-compiler packages
 
-The easiest way is to convert kernel-headers debian package for the target
-architecture using dpkg-cross, and install the resulting package.
-Unfortunately, dpkg-cross versions prior to (unofficial) 1.14.1 failed
-to process linux-kernel-headers package, so please use newer versions.
+Get gcc-3.3 source package.
 
-1.2.1 libc for the target architecture
+Unpack it using dpkg-source -x, and cd to the package directory.
 
-Although it is possible to build cross-gcc without having target libc
-pre-installed, it is somewhat complex, and is not supported by gcc-3.3 source
-package.
+Set GCC_TARGET environment variable to the target architectire name.
 
-The easiest way is to convert libc6, libc6-dev and libdb1-compat debian
-packages for the target architecture using dpkg-cross, and install the
-resulting packages.
+Run debian/rules control. This will change debian/control file, adjusting
+build-depends.
 
-1.3. cross-binutils for the target
+Build the package using dpkg-buildpackage.
 
-It is a good idea to use binutils source package to build cross-binutils.
-See debian bug report #231707 for patches that make it possible.
 
-Alternate way to get cross-binutils package is (still) toolchain-source 
-package. Install it and read /usr/share/doc/toolchain-source/README for more 
-information. 
+3. Using crosshurd
 
+Jeff Bailey <jbailey@raspberryginger.com> suggests alternate way to setup
+environment to build cross-compiler, using 'crosshurd' package. 
+Crosshurd is like debootstrap but cross-arch, and works on the Hurd,
+Linux and FreeBSD.  (The name is historical).
 
-2. Building cross-compiler packages
+If you setup your environment with crosshurd, you will need to fix symlinks
+in lib and usr/lib to be relative instead of absolute. For example:
 
-Get gcc-3.3 source package.
+lrwxrwxrwx    1 root     root           20 2004-05-06 23:02 libcom_err.so -> /lib/libcom_err.so.2
 
-Unpack it using dpkg-source -x, and cd to the package directory.
+Needs to be changed to:
 
-Set GCC_TARGET environment variable to the target architectire name.
+lrwxrwxrwx    1 root     root           20 2004-05-06 23:02 libcom_err.so -> ../../lib/libcom_err.so.2
 
-Run debian/rules control. This will change debian/control file, adjusting
-build-depends.
+Also, if you choose this method, set the environment variable 'with_sysroot'
+to point to the ABSOLUTE PATH where the crosshurd was done.
 
-Build the package using dpkg-buildpackage.
+Note however that build-depends of cross-gcc and dependencies in generated
+libgcc1 and libstdc++ packages assume that you use dpkg-cross to set up
+your environment, and may be wrong or incomplete if you use alternate methods.
+But probably you don't care.
 
 --
 Nikita V. Youshchenko <yoush@cs.msu.su>
diff -urN gcc-3.3-3.3.4/debian/rules.d/binary-libgcc-cross.mk gcc-3.3-3.3.4.cross/debian/rules.d/binary-libgcc-cross.mk
--- gcc-3.3-3.3.4/debian/rules.d/binary-libgcc-cross.mk	2004-07-15 00:33:47.000000000 +0400
+++ gcc-3.3-3.3.4.cross/debian/rules.d/binary-libgcc-cross.mk	2004-07-15 00:34:41.000000000 +0400
@@ -1,17 +1,19 @@
 arch_binaries  := $(arch_binaries) libgcc
+ifeq ($(with_lib64gcc),yes)
+  arch_binaries	:= $(arch_binaries) lib64gcc
+endif
 
-p_lgcc	= libgcc$(GCC_SONAME)$(cross_lib_arch)
-d_lgcc	= debian/$(p_lgcc)
+p_lgcc		= libgcc$(GCC_SONAME)$(cross_lib_arch)
+d_lgcc		= debian/$(p_lgcc)
 
-dirs_lgcc = \
-	$(docdir)/$(p_lgcc) \
-	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib
+p_l64gcc	= lib64gcc$(GCC_SONAME)$(cross_lib_arch)
+d_l64gcc	= debian/$(p_l64gcc)
 
-# If this is false, we basically have an empty libgcc package. This is ok,
-# since that should only be temporary anyway
 ifeq ($(with_shared_libgcc),yes)
 files_lgcc = \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libgcc_s.so.$(GCC_SONAME)
+files_l64gcc = \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib64/libgcc_s.so.$(GCC_SONAME)
 endif
 
 # ----------------------------------------------------------------------
@@ -21,7 +23,9 @@
 	mv $(install_stamp) $(install_stamp)-tmp
 
 	rm -rf $(d_lgcc)
-	dh_installdirs -p$(p_lgcc) $(dirs_lgcc)
+	dh_installdirs -p$(p_lgcc) \
+		$(docdir)/$(p_lgcc) \
+		$(PF)/$(DEB_TARGET_GNU_TYPE)/lib
 
 ifeq ($(with_shared_libgcc),yes)
 	dh_movefiles -p$(p_lgcc) $(files_lgcc)
@@ -31,7 +35,7 @@
 	dh_installchangelogs -p$(p_lgcc)
 
 	debian/dh_rmemptydirs -p$(p_lgcc)
-	PATH=/usr/$(TARGET_ALIAS)/bin:$$PATH dh_strip -p$(p_lgcc)
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_strip -p$(p_lgcc)
 	dh_compress -p$(p_lgcc)
 	dh_fixperms -p$(p_lgcc)
 ifeq ($(with_shared_libgcc),yes)
@@ -41,6 +45,9 @@
 	mv debian/$(p_lgcc)/DEBIAN/shlibs.fixed debian/$(p_lgcc)/DEBIAN/shlibs
 	cat debian/$(p_lgcc)/DEBIAN/shlibs >> debian/shlibs.local
 endif
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lgcc)
+	sed 's/\(lib[^ ]*\) /\1$(cross_lib_arch) /g' < debian/$(p_lgcc).substvars > debian/$(p_lgcc).substvars.new
+	mv debian/$(p_lgcc).substvars.new debian/$(p_lgcc).substvars
 	dh_gencontrol -p$(p_lgcc) -u-v$(DEB_VERSION)
 	b=libgcc; v=$(GCC_SONAME); \
 	for ext in preinst postinst prerm postrm; do \
@@ -55,3 +62,48 @@
 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
 
 # ----------------------------------------------------------------------
+$(binary_stamp)-lib64gcc: $(install_dependencies)
+	dh_testdir
+	dh_testroot
+	mv $(install_stamp) $(install_stamp)-tmp
+
+	rm -rf $(d_l64gcc)
+	dh_installdirs -p$(p_l64gcc) \
+		$(docdir)/$(p_l64gcc) \
+		$(PF)/$(DEB_TARGET_GNU_TYPE)/lib64
+
+ifeq ($(with_shared_libgcc),yes)
+	dh_movefiles -p$(p_l64gcc) $(files_l64gcc)
+endif
+
+	dh_installdocs -p$(p_l64gcc)
+	dh_installchangelogs -p$(p_l64gcc)
+
+	debian/dh_rmemptydirs -p$(p_l64gcc)
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_strip -p$(p_l64gcc)
+	dh_compress -p$(p_l64gcc)
+	dh_fixperms -p$(p_l64gcc)
+ifeq ($(with_shared_libgcc),yes)
+	DH_COMPAT=3 dh_makeshlibs -p$(p_l64gcc) \
+		-V '$(p_l64gcc) (>= $(DEB_SOVERSION))' -n
+	sed s/$(cross_lib_arch)//g < debian/$(p_l64gcc)/DEBIAN/shlibs > debian/$(p_l64gcc)/DEBIAN/shlibs.fixed
+	mv debian/$(p_l64gcc)/DEBIAN/shlibs.fixed debian/$(p_l64gcc)/DEBIAN/shlibs
+	cat debian/$(p_l64gcc)/DEBIAN/shlibs >> debian/shlibs.local
+endif
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_l64gcc)
+	sed 's/\(lib[^ ]*\) /\1$(cross_lib_arch) /g' < debian/$(p_l64gcc).substvars > debian/$(p_l64gcc).substvars.new
+	mv debian/$(p_l64gcc).substvars.new debian/$(p_l64gcc).substvars
+	dh_gencontrol -p$(p_l64gcc) -u-v$(DEB_VERSION)
+	b=libgcc; v=$(GCC_SONAME); \
+	for ext in preinst postinst prerm postrm; do \
+	  if [ -f debian/$$b$$t.$$ext ]; then \
+	    cp -pf debian/$$b$$t.$$ext debian/$$b$$v$$t.$$ext; \
+	  fi; \
+	done
+	dh_installdeb -p$(p_l64gcc)
+	dh_md5sums -p$(p_l64gcc)
+	dh_builddeb -p$(p_l64gcc)
+
+	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+
+# ----------------------------------------------------------------------
diff -urN gcc-3.3-3.3.4/debian/rules.d/binary-libstdcxx-cross.mk gcc-3.3-3.3.4.cross/debian/rules.d/binary-libstdcxx-cross.mk
--- gcc-3.3-3.3.4/debian/rules.d/binary-libstdcxx-cross.mk	2004-07-15 00:33:47.000000000 +0400
+++ gcc-3.3-3.3.4.cross/debian/rules.d/binary-libstdcxx-cross.mk	2004-07-15 00:34:41.000000000 +0400
@@ -1,15 +1,22 @@
-arch_binaries  := $(arch_binaries) libstdcxx
+ifeq ($(with_libcxx),yes)
+  arch_binaries  := $(arch_binaries) libstdcxx
+endif
+ifeq ($(with_lib64cxx),yes)
+  arch_binaries  := $(arch_binaries) lib64stdcxx
+endif
 
 ifeq ($(with_cxxdev),yes)
   arch_binaries  := $(arch_binaries) libstdcxx-dev
 endif
 
 p_lib	= libstdc++$(CXX_SONAME)$(cross_lib_arch)
+p_lib64	= lib64stdc++$(CXX_SONAME)$(cross_lib_arch)
 p_dev	= libstdc++$(CXX_SONAME)$(pkg_ver)-dev$(cross_lib_arch)
 p_pic	= libstdc++$(CXX_SONAME)$(pkg_ver)-pic$(cross_lib_arch)
 p_dbg	= libstdc++$(CXX_SONAME)$(pkg_ver)-dbg$(cross_lib_arch)
 
 d_lib	= debian/$(p_lib)
+d_lib64	= debian/$(p_lib64)
 d_dev	= debian/$(p_dev)
 d_pic	= debian/$(p_pic)
 d_dbg	= debian/$(p_dbg)
@@ -18,12 +25,18 @@
 	$(docdir) \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib
 
+dirs_lib64 = \
+	$(docdir) \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib64
+
 files_lib = \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libstdc++.so.*
 
+files_lib64 = \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib64/libstdc++.so.*
+
 dirs_dev = \
 	$(docdir)/$(p_lib) \
-	$(PF)/share/info \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib \
 	$(gcc_lib_dir)/include \
 	$(cxx_inc_dir)
@@ -39,7 +52,6 @@
 	$(docdir) \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/debug \
 	$(gcc_lib_dir)
-
 files_dbg = \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/debug/libstdc++.*
 
@@ -49,6 +61,16 @@
 files_pic = \
 	$(gcc_lib_dir)/libstdc++_pic.a
 
+ifeq ($(with_lib64cxx),yes)
+    dirs_dev += $(gcc_lib_dir)/64/
+    files_dev += $(gcc_lib_dir)/64/libstdc++.{a,so} \
+        $(gcc_lib_dir)/64/libsupc++.a
+    dirs_dbg += $(PF)/$(DEB_TARGET_GNU_TYPE)/lib64/debug
+    files_dbg += $(PF)/$(DEB_TARGET_GNU_TYPE)/lib64/debug/libstdc++.*
+    dirs_pic += $(gcc_lib_dir)
+    files_pic += $(gcc_lib_dir)/64/libstdc++_pic.a
+endif
+
 # ----------------------------------------------------------------------
 
 $(binary_stamp)-libstdcxx: $(install_stamp)
@@ -58,16 +80,8 @@
 
 	rm -rf $(d_lib)
 	dh_installdirs -p$(p_lib) $(dirs_lib)
-
 	dh_movefiles -p$(p_lib) $(files_lib)
 
-# do this here, else the libraries get stripped, before they are copied ...
-	rm -rf $(d_dbg)
-#	dh_installdirs -p$(p_dbg) $(dirs_dbg)
-#	: # Copy the libraries in libstdc++ to libstdc++-dbg
-#	(cd $(d_lib)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/$(lib) ; tar cfp - .) | \
-#		(cd $(d_dbg)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/debug ; tar xvfp -)
-
 	dh_installdocs -p$(p_lib)
 	echo "See /$(docdir)/$(p_base) for more information" \
 		> $(d_lib)/$(docdir)/$(p_lib)/README.Debian
@@ -75,18 +89,28 @@
 	dh_installchangelogs -p$(p_lib)
 	debian/dh_rmemptydirs -p$(p_lib)
 
-	PATH=/usr/$(TARGET_ALIAS)/bin:$$PATH dh_strip -p$(p_lib)
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_strip -p$(p_lib)
 	dh_compress -p$(p_lib)
 	dh_fixperms -p$(p_lib)
 	DH_COMPAT=3 dh_makeshlibs -p$(p_lib) \
 		-V '$(p_lib) (>= $(DEB_SOVERSION))' -n
 	sed s/$(cross_lib_arch)//g < debian/$(p_lib)/DEBIAN/shlibs > debian/$(p_lib)/DEBIAN/shlibs.fixed
 	mv debian/$(p_lib)/DEBIAN/shlibs.fixed debian/$(p_lib)/DEBIAN/shlibs
-	: # The prefix of the following command makes dpkg-shlibdeps from dpkg-cross to process non-native binaries
 	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib)
 	sed 's/\(lib[^ ]*\) /\1$(cross_lib_arch) /g' < debian/$(p_lib).substvars > debian/$(p_lib).substvars.new
 	mv debian/$(p_lib).substvars.new debian/$(p_lib).substvars
 	dh_gencontrol -p$(p_lib) -u-v$(DEB_VERSION)
+
+	b=libstdc++; \
+	for ext in preinst postinst prerm postrm; do \
+	  for t in ''; do \
+	    v=$(CXX_SONAME); \
+	    if [ -f debian/$$b$$t.$$ext ]; then \
+	      cp -pf debian/$$b$$t.$$ext debian/$$b$$v$$t.$$ext; \
+	    fi; \
+	  done; \
+	done
+
 	dh_installdeb -p$(p_lib)
 	dh_md5sums -p$(p_lib)
 	dh_builddeb -p$(p_lib)
@@ -94,6 +118,52 @@
 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
 
 # ----------------------------------------------------------------------
+
+$(binary_stamp)-lib64stdcxx: $(install_stamp)
+	dh_testdir
+	dh_testroot
+	mv $(install_stamp) $(install_stamp)-tmp
+
+	rm -rf $(d_lib64)
+	dh_installdirs -p$(p_lib64) $(dirs_lib64)
+	dh_movefiles -p$(p_lib64) $(files_lib64)
+
+	dh_installdocs -p$(p_lib64)
+	echo "See /$(docdir)/$(p_base) for more information" \
+		> $(d_lib64)/$(docdir)/$(p_lib64)/README.Debian
+
+	dh_installchangelogs -p$(p_lib64)
+	debian/dh_rmemptydirs -p$(p_lib64)
+
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_strip -p$(p_lib64)
+	dh_compress -p$(p_lib64)
+	dh_fixperms -p$(p_lib64)
+	DH_COMPAT=3 dh_makeshlibs -p$(p_lib64) \
+		-V '$(p_lib64) (>= $(DEB_SOVERSION))' -n
+	sed s/$(cross_lib_arch)//g < debian/$(p_lib64)/DEBIAN/shlibs > debian/$(p_lib64)/DEBIAN/shlibs.fixed
+	mv debian/$(p_lib64)/DEBIAN/shlibs.fixed debian/$(p_lib64)/DEBIAN/shlibs
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib64)
+	sed 's/\(lib[^ ]*\) /\1$(cross_lib_arch) /g' < debian/$(p_lib64).substvars > debian/$(p_lib64).substvars.new
+	mv debian/$(p_lib64).substvars.new debian/$(p_lib64).substvars
+	dh_gencontrol -p$(p_lib64) -u-v$(DEB_VERSION)
+
+	b=libstdc++; \
+	for ext in preinst postinst prerm postrm; do \
+	  for t in ''; do \
+	    v=$(CXX_SONAME); \
+	    if [ -f debian/$$b$$t.$$ext ]; then \
+	      cp -pf debian/$$b$$t.$$ext debian/$$b$$v$$t.$$ext; \
+	    fi; \
+	  done; \
+	done
+
+	dh_installdeb -p$(p_lib64)
+	dh_md5sums -p$(p_lib64)
+	dh_builddeb -p$(p_lib64)
+
+	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+
+# ----------------------------------------------------------------------
 $(binary_stamp)-libstdcxx-dev: $(install_stamp) \
     $(binary_stamp)-libstdcxx
 	dh_testdir
@@ -106,15 +176,21 @@
 	dh_installdirs -p$(p_dbg) $(dirs_dbg)
 
 	: # - correct libstdc++-v3 file locations
-	mv $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libsupc++.a \
-		$(d)/$(gcc_lib_dir)/
-	mv $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libstdc++.{a,so} \
-		$(d)/$(gcc_lib_dir)/
-	ln -sf ../../../../$(DEB_TARGET_GNU_TYPE)/lib/libstdc++.so.$(CXX_SONAME) \
-		$(d)/$(gcc_lib_dir)/libstdc++.so
+	mv $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libsupc++.a $(d)/$(gcc_lib_dir)/
+	mv $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libstdc++.{a,so} $(d)/$(gcc_lib_dir)/
+	ln -sf ../../../../$(DEB_TARGET_GNU_TYPE)/lib/libstdc++.so.$(CXX_SONAME) $(d)/$(gcc_lib_dir)/libstdc++.so
 	mv $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libstdc++_pic.a \
 		$(d)/$(gcc_lib_dir)/
 
+	rm -f $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/debug/libstdc++_pic.a
+	rm -f $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib64/debug/libstdc++_pic.a
+
+ifeq ($(biarch),yes)
+	mv $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib64/lib*c++*.a $(d)/$(gcc_lib_dir)/64/.
+	ln -sf ../../../../../lib64/libstdc++.so.$(CXX_SONAME) \
+		$(d)/$(gcc_lib_dir)/64/libstdc++.so
+endif
+
 	dh_movefiles -p$(p_dev) $(files_dev)
 	dh_movefiles -p$(p_pic) $(files_pic)
 	dh_movefiles -p$(p_dbg) $(files_dbg)
@@ -124,7 +200,6 @@
 	debian/dh_doclink -p$(p_dbg) $(p_lib)
 	cp -p $(srcdir)/libstdc++-v3/ChangeLog \
 		$(d_dev)/usr/share/doc/$(p_lib)/changelog
-
 	cp -p $(srcdir)/libstdc++-v3/config/linker-map.gnu \
 		$(d_pic)/$(gcc_lib_dir)/libstdc++_pic.map
 
@@ -134,11 +209,22 @@
 	debian/dh_rmemptydirs -p$(p_dbg)
 endif
 
-	PATH=/usr/$(TARGET_ALIAS)/bin:$$PATH dh_strip -p$(p_dev) -p$(p_pic)
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_strip -p$(p_dev) -p$(p_pic)
 	dh_compress -p$(p_dev) -p$(p_pic) -p$(p_dbg) -X.txt
 	dh_fixperms -p$(p_dev) -p$(p_pic) -p$(p_dbg)
 	dh_gencontrol -p$(p_dev) -p$(p_pic) -p$(p_dbg) \
 		-u-v$(DEB_VERSION)
+	
+	b=libstdc++; \
+	for ext in preinst postinst prerm postrm; do \
+	  for t in -dev -dbg -pic; do \
+	    v=$(CXX_SONAME); \
+	    if [ -f debian/$$b$$t.$$ext ]; then \
+	      cp -pf debian/$$b$$t.$$ext debian/$$b$$v$$t.$$ext; \
+	    fi; \
+	  done; \
+	done
+
 	dh_installdeb -p$(p_dev) -p$(p_pic) -p$(p_dbg)
 	dh_md5sums -p$(p_dev) -p$(p_pic) -p$(p_dbg)
 	dh_builddeb -p$(p_dev) -p$(p_pic) -p$(p_dbg)
diff -urN gcc-3.3-3.3.4/debian/rules.defs gcc-3.3-3.3.4.cross/debian/rules.defs
--- gcc-3.3-3.3.4/debian/rules.defs	2004-07-15 00:33:47.000000000 +0400
+++ gcc-3.3-3.3.4.cross/debian/rules.defs	2004-07-15 00:34:41.000000000 +0400
@@ -480,7 +480,9 @@
 # hppa64 build --------------------
 with_hppa64 := no
 ifeq ($(DEB_TARGET_ARCH),hppa)
-  with_hppa64 := yes
+  ifneq ($(DEB_CROSS),yes)
+    with_hppa64 := yes
+  endif
 endif
 
 # sparc64 build --------------------

Reply to: