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

New cross patches.



Hello.

> > Similar patches for 3.4 and 4.0 will follow in a few days.

It took a bit longer than expected.
At last, all 3 trees are in sync, and I'm ready to submit patches.

> - please describe TARGETBD in debian/rules.defs

Looks that rules.defs is not the correct place, rules.conf is better (at 
least, other similar thins, like LIBC_DEP, are set there). Moved.

> - check that the native configuration still works.

OK.
Sorry for that issue, I applied a patch sent me by other person without 
proper checking. I will try to be more careful in future.


At last I restored ability of 3.4 to buiild for all debian linux targets 
(except x86 on non-x86 host - which never worked yet), including ia64, 
where it cross-builds libunwind. This is currently done a bit hacky, 
because libunwind does not have proper support for cross-building, but 
works, and affects only rules.d/binary-libgcc-cross.mk (which is 100% not 
used for native builds).

4.0 does not currently build for powerpc and ia64 targets, and builds ok 
for others. I had to restore setting of --with-gxx-include-dir configure 
flag in debian/rules2 in 4.0 - looks that it was removed in error? If you 
really meant to remove it, the settings should be put in
ifdef DEB_CROSS ... endif

I also added ability to use debian/target file instead of GCC_TARGET 
variable - the request was from toolchain-source maintainer, who is going 
to convert toolchain-source to use gcc source package's cross-compiler 
build functionality :).


I've tested native builds on x86 this time, using sbuild.
3.3 and 3.4 build ok.
4.0 failed somewhere in ada code, which does not look like cross-gcc 
related problem. Error was:
...
gnatbind -C -I- -I. -Iada -I../../src/gcc/ada -o ada/b_gnatb.c 
ada/gnatbind.ali
fatal error: file gnatbind.ali is incorrectly formatted
make sure you are using consistent versions of gcc-3.3/gnatbind


I've set up a private subversion repository to maintain cross-gcc trees, 
these patches are created using 'svn diff'. Patches are against packages 
currently in sid.

Nikita
Index: debian/control.m4
===================================================================
--- debian/control.m4	(.../debian/3.3.5-5)	(revision 46)
+++ debian/control.m4	(.../3.3)	(revision 46)
@@ -10,7 +10,7 @@
 dnl ifdef(`CV',		, errexit(`CV'))
 dnl ifdef(`NV',		, errexit(`NV'))
 dnl ifdef(`PV',		, errexit(`PV'))
-dnl ifdef(`ARCH',		, errexit(`ARCH'))
+dnl ifdef(`ARCH',	, errexit(`ARCH'))
 
 dnl The architecture will also be defined (-D__i386__, -D__powerpc__, etc.)
 
@@ -20,17 +20,6 @@
 ')
 define(`MAINTAINER', `Debian GCC maintainers <debian-gcc@lists.debian.org>')
 
-ifelse(TARGET, `sparc', `
-define(`TARGETBD', `, libc6-dev-sparc64-sparc-cross')
-')
-ifelse(TARGET, `s390', `
-define(`TARGETBD', `, libc6-dev-s390x-s390-cross')
-')
-ifelse(TARGET, `ia64', `
-define(`TARGETBD', `, libunwind7-dev-ia64-cross (>= 0.98.3-3)')
-')
-ifdef(`TARGETBD', , `')
-
 define(`ifenabled', `ifelse(index(enabled_languages, `$1'), -1, `dnl', `$2')')
 
 divert`'dnl
Index: debian/rules.defs
===================================================================
--- debian/rules.defs	(.../debian/3.3.5-5)	(revision 46)
+++ debian/rules.defs	(.../3.3)	(revision 46)
@@ -18,6 +18,15 @@
 DEB_HOST_GNU_SYSTEM	:= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
 DEB_HOST_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
+# allow debian/target to be used instead of GCC_TARGET - this was requested
+# by toolchain-source maintainer
+ifndef GCC_TARGET
+DEBIAN_TARGET_FILE := $(strip $(shell cat debian/target 2>/dev/null))
+ifneq ($(DEBIAN_TARGET_FILE),)
+GCC_TARGET := $(DEBIAN_TARGET_FILE)
+endif
+endif
+
 DEB_TARGET_ARCH		:= $(shell dpkg-architecture -f \
 			-a$(GCC_TARGET) -qDEB_HOST_ARCH 2>/dev/null)
 DEB_TARGET_GNU_CPU	:= $(shell dpkg-architecture -f \
Index: debian/README.cross
===================================================================
--- debian/README.cross	(.../debian/3.3.5-5)	(revision 46)
+++ debian/README.cross	(.../3.3)	(revision 46)
@@ -96,6 +96,10 @@
 not GNU system type (i.e. 'powerpc-linux' or 'arm-linux'). Setting GCC_TARGET
 to GNU system type will cause cross-compiler build to fail.
 
+Instead of setting GCC_TARGET, target architecture name may be put into
+debian/target file. If both GCC_TARGET is defined and debian/target file
+exists, GCC_TARGET is used.
+
 Run debian/rules control. This will change debian/control file, adjusting
 build-depends.
 
Index: debian/rules.conf
===================================================================
--- debian/rules.conf	(.../debian/3.3.5-5)	(revision 46)
+++ debian/rules.conf	(.../3.3)	(revision 46)
@@ -123,8 +123,18 @@
 	-DLS=$(LS)
 
 ifdef DEB_CROSS
+  ifeq ($(DEB_TARGET_ARCH),sparc)
+    TARGETBD = , libc6-dev-sparc64-sparc-cross
+  endif
+  ifeq ($(DEB_TARGET_ARCH),s390)
+    TARGETBD = , libc6-dev-s390x-s390-cross
+  endif
+  ifeq ($(DEB_TARGET_ARCH),ia64)
+    TARGETBD = , libunwind7-dev-ia64-cross (>= 0.98.3-3)
+  endif
   ctrl_flags += \
-	-DTARGET=$(DEB_TARGET_ARCH)
+	-DTARGET=$(DEB_TARGET_ARCH) \
+	-DTARGETBD="$(TARGETBD)"
 else
   # XXX uncomment when 3.4 becomes the default compiler
 #  ctrl_flags += \
Index: debian/cross-unwind/path_max.patch
===================================================================
--- debian/cross-unwind/path_max.patch	(revision 0)
+++ debian/cross-unwind/path_max.patch	(revision 46)
@@ -0,0 +1,21 @@
+--- src.orig/os-linux.h	2004-11-04 00:08:07.000000000 +0300
++++ src/os-linux.h	2005-01-04 22:56:46.000000000 +0300
+@@ -26,6 +26,8 @@
+ #ifndef os_linux_h
+ #define os_linux_h
+ 
++#include <linux/limits.h>
++
+ struct map_iterator
+   {
+     off_t offset;
+--- src.orig/ptrace/_UPT_find_proc_info.c	2004-11-04 00:08:07.000000000 +0300
++++ src/ptrace/_UPT_find_proc_info.c	2005-01-04 23:37:34.000000000 +0300
+@@ -35,6 +35,7 @@
+ #if UNW_TARGET_IA64
+ 
+ #include "elf64.h"
++#include <linux/limits.h>
+ 
+ static unw_word_t
+ find_gp (struct UPT_info *ui, Elf64_Phdr *pdyn, Elf64_Addr load_base)
Index: debian/cross-unwind/Gcursor_i.h
===================================================================
--- debian/cross-unwind/Gcursor_i.h	(revision 0)
+++ debian/cross-unwind/Gcursor_i.h	(revision 46)
@@ -0,0 +1,33 @@
+#ifndef cursor_i_h
+#define cursor_i_h
+
+/*
+ * DO NOT MODIFY
+ *
+ * This file was generated by ./a.out.
+ *
+ */
+
+#define IP_OFF				8	/* 0x8 */
+#define PR_OFF				24	/* 0x18 */
+#define BSP_OFF				32	/* 0x20 */
+#define PSP_OFF				48	/* 0x30 */
+#define PFS_LOC_OFF			152	/* 0x98 */
+#define RNAT_LOC_OFF			168	/* 0xa8 */
+#define UNAT_LOC_OFF			328	/* 0x148 */
+#define LC_LOC_OFF			360	/* 0x168 */
+#define FPSR_LOC_OFF			376	/* 0x178 */
+#define B1_LOC_OFF			392	/* 0x188 */
+#define B2_LOC_OFF			408	/* 0x198 */
+#define B3_LOC_OFF			424	/* 0x1a8 */
+#define B4_LOC_OFF			440	/* 0x1b8 */
+#define B5_LOC_OFF			456	/* 0x1c8 */
+#define F2_LOC_OFF			472	/* 0x1d8 */
+#define F3_LOC_OFF			488	/* 0x1e8 */
+#define F4_LOC_OFF			504	/* 0x1f8 */
+#define F5_LOC_OFF			520	/* 0x208 */
+#define FR_LOC_OFF			536	/* 0x218 */
+#define LOC_SIZE				16	/* 0x10 */
+#define SIGCONTEXT_ADDR_OFF		824	/* 0x338 */
+
+#endif /* cursor_i_h */
Index: debian/cross-unwind/Lcursor_i.h
===================================================================
--- debian/cross-unwind/Lcursor_i.h	(revision 0)
+++ debian/cross-unwind/Lcursor_i.h	(revision 46)
@@ -0,0 +1,33 @@
+#ifndef cursor_i_h
+#define cursor_i_h
+
+/*
+ * DO NOT MODIFY
+ *
+ * This file was generated by ./a.out.
+ *
+ */
+
+#define IP_OFF				8	/* 0x8 */
+#define PR_OFF				24	/* 0x18 */
+#define BSP_OFF				32	/* 0x20 */
+#define PSP_OFF				48	/* 0x30 */
+#define PFS_LOC_OFF			104	/* 0x68 */
+#define RNAT_LOC_OFF			112	/* 0x70 */
+#define UNAT_LOC_OFF			192	/* 0xc0 */
+#define LC_LOC_OFF			208	/* 0xd0 */
+#define FPSR_LOC_OFF			216	/* 0xd8 */
+#define B1_LOC_OFF			224	/* 0xe0 */
+#define B2_LOC_OFF			232	/* 0xe8 */
+#define B3_LOC_OFF			240	/* 0xf0 */
+#define B4_LOC_OFF			248	/* 0xf8 */
+#define B5_LOC_OFF			256	/* 0x100 */
+#define F2_LOC_OFF			264	/* 0x108 */
+#define F3_LOC_OFF			272	/* 0x110 */
+#define F4_LOC_OFF			280	/* 0x118 */
+#define F5_LOC_OFF			288	/* 0x120 */
+#define FR_LOC_OFF			296	/* 0x128 */
+#define LOC_SIZE				8	/* 0x8 */
+#define SIGCONTEXT_ADDR_OFF		456	/* 0x1c8 */
+
+#endif /* cursor_i_h */
Index: debian/cross-unwind/README
===================================================================
--- debian/cross-unwind/README	(revision 0)
+++ debian/cross-unwind/README	(revision 46)
@@ -0,0 +1,10 @@
+Files in this directory are used to cross-compile libunwind while building
+cross-gcc for ia64 target. Libunwind source can't cross-compile as-is because
+it builds tools to generate two header files that are used later in build
+process, and this procedure can't handle cross-compiling case properly.
+
+Fixing build procedure seems too hard because autotools don't seem to
+support this case.
+
+So, as a temporary solution, files are pre-built on ia64 host and provided
+in this directory.
Index: debian/rules.d/binary-libstdcxx-cross.mk
===================================================================
--- debian/rules.d/binary-libstdcxx-cross.mk	(.../debian/3.4.3-6)	(revision 46)
+++ debian/rules.d/binary-libstdcxx-cross.mk	(.../3.4)	(revision 46)
@@ -212,7 +212,7 @@
 	: # remove precompiled headers
 	-find $(d) -type d -name '*.gch' | xargs rm -rf
 
-ifeq ($(biarch),yes)
+ifeq ($(with_lib64cxx),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
Index: debian/rules.d/binary-libgcc-cross.mk
===================================================================
--- debian/rules.d/binary-libgcc-cross.mk	(.../debian/3.4.3-6)	(revision 46)
+++ debian/rules.d/binary-libgcc-cross.mk	(.../3.4)	(revision 46)
@@ -23,7 +23,11 @@
 endif
 
 # ----------------------------------------------------------------------
+ifeq ($(DEB_TARGET_GNU_CPU),ia64)
+$(binary_stamp)-libgcc: $(install_dependencies) $(binary_stamp)-libunwind
+else
 $(binary_stamp)-libgcc: $(install_dependencies)
+endif
 	dh_testdir
 	dh_testroot
 	mv $(install_stamp) $(install_stamp)-tmp
@@ -41,18 +45,30 @@
 	dh_installchangelogs -p$(p_lgcc)
 
 	debian/dh_rmemptydirs -p$(p_lgcc)
-	PATH=/usr/share/dpkg-cross:$$PATH dh_strip -p$(p_lgcc)
-	dh_compress -p$(p_lgcc)
-	dh_fixperms -p$(p_lgcc)
 ifeq ($(with_shared_libgcc),yes)
+  ifeq ($(DEB_TARGET_GNU_CPU),ia64)
+	cp -a $(PWD)/$(d)-unwind/usr/lib/libunwind.so.* $(d_lgcc)/usr/$(DEB_TARGET_GNU_TYPE)/lib/
+	dh_makeshlibs -p$(p_lgcc) -V '$(p_lgcc) (>= 1:3.4.3-6)' -n
+	sed s/$(cross_lib_arch)//g < debian/$(p_lgcc)/DEBIAN/shlibs > debian/$(p_lgcc)/DEBIAN/shlibs.fixed
+	mv debian/$(p_lgcc)/DEBIAN/shlibs.fixed debian/$(p_lgcc)/DEBIAN/shlibs
+	touch debian/$(p_lgcc).substvars
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lgcc) -Xlibgcc_s
+	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
+  else
 	dh_makeshlibs -p$(p_lgcc) -V '$(p_lgcc) (>= $(DEB_LIBGCC_SOVERSION))' -n
 	sed s/$(cross_lib_arch)//g < debian/$(p_lgcc)/DEBIAN/shlibs > debian/$(p_lgcc)/DEBIAN/shlibs.fixed
 	mv debian/$(p_lgcc)/DEBIAN/shlibs.fixed debian/$(p_lgcc)/DEBIAN/shlibs
-	cat debian/$(p_lgcc)/DEBIAN/shlibs >> debian/shlibs.local
-endif
+	touch debian/$(p_lgcc).substvars
 	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
+  endif
+	cat debian/$(p_lgcc)/DEBIAN/shlibs >> debian/shlibs.local
+endif
+	PATH=/usr/share/dpkg-cross:$$PATH dh_strip -p$(p_lgcc)
+	dh_compress -p$(p_lgcc)
+	dh_fixperms -p$(p_lgcc)
 	dh_gencontrol -p$(p_lgcc) -u-v$(DEB_LIBGCC_VERSION)
 	b=libgcc; v=$(GCC_SONAME); \
 	for ext in preinst postinst prerm postrm; do \
@@ -158,3 +174,40 @@
 	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
 
 # ----------------------------------------------------------------------
+
+unwind_dir = libunwind-0.98.3
+xxx: $(binary_stamp)-libunwind
+$(binary_stamp)-libunwind:
+	rm -rf $(unwind_dir).tar.gz $(unwind_dir) $(d)-unwind
+	uudecode libunwind.uue
+	tar xfz $(unwind_dir).tar.gz
+
+	: Below are several hacks to allow cross-build of libunwind unless
+	: related bugs both at unwind side and at gcc side are fixed
+
+	: Put pre-built Gcursor_i.h and Lcursor_i.h into src/ ...
+	cp debian/cross-unwind/[GL]cursor_i.h $(unwind_dir)/src/
+	touch $(unwind_dir)/src/[GL]cursor_i.h
+
+	: ... and avoid rebuilding of those files
+	sed 's/\(@[GL]cursor_i.h\):/\1DISABLE:/g' $(unwind_dir)/src/Makefile.in > $(unwind_dir)/src/Makefile.in.tmp
+	mv -f $(unwind_dir)/src/Makefile.in.tmp $(unwind_dir)/src/Makefile.in
+	
+	: also, alter configure to disable REMOTE_ONLY mode of libunwind
+	: that is turned on with target!=build
+	: /manually checked that the following regexp affects only this/
+	sed 's/test x\$$target_arch != x\$$build_arch/false/g' $(unwind_dir)/configure > $(unwind_dir)/configure.tmp
+	mv $(unwind_dir)/configure.tmp $(unwind_dir)/configure
+	chmod 755 $(unwind_dir)/configure
+
+	: also, patch iseveral files to ensure PATH_MAX is defined
+	: /limits.h does not include it because of some problem/
+	cd $(unwind_dir)/src && patch -p1 < ../../debian/cross-unwind/path_max.patch
+
+	cd $(unwind_dir) && CC="$(PWD)/build/gcc/xgcc -B$(PWD)/build/gcc/" ./configure \
+		--build=$(DEB_BUILD_GNU_TYPE) \
+		--host=$(DEB_TARGET_GNU_TYPE) \
+		--prefix=/usr
+	$(MAKE) -C $(unwind_dir)
+	$(MAKE) -C $(unwind_dir) install DESTDIR=$(PWD)/$(d)-unwind
+	touch $(binary_stamp)-libunwind
Index: debian/control.m4
===================================================================
--- debian/control.m4	(.../debian/3.4.3-6)	(revision 46)
+++ debian/control.m4	(.../3.4)	(revision 46)
@@ -10,7 +10,7 @@
 dnl ifdef(`CV',		, errexit(`CV'))
 dnl ifdef(`NV',		, errexit(`NV'))
 dnl ifdef(`PV',		, errexit(`PV'))
-dnl ifdef(`ARCH',		, errexit(`ARCH'))
+dnl ifdef(`ARCH',	, errexit(`ARCH'))
 
 dnl The architecture will also be defined (-D__i386__, -D__powerpc__, etc.)
 
@@ -19,14 +19,6 @@
     define(`PRI', `$1')
 ')
 define(`MAINTAINER', `Debian GCC maintainers <debian-gcc@lists.debian.org>')
-ifdef(`TARGET', `
-    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')
-')
 
 define(`ifenabled', `ifelse(index(enabled_languages, `$1'), -1, `dnl', `$2')')
 
@@ -39,7 +31,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, autoconf, automake1.4, automake1.7, libtool, autotools-dev, gawk, bzip2, dpkg-cross (>= 1.18.1), BINUTILS_BUILD_DEP, debhelper (>= 4.1), , bison (>= 1:1.875a-1) | bison (<< 1:1.50), flex`', realpath (>= 1.9.12)BD64
+Build-Depends: LIBC_BUILD_DEP, m4, autoconf2.13, autoconf, automake1.4, automake1.7, libtool, autotools-dev, gawk, bzip2, dpkg-cross (>= 1.18.1), BINUTILS_BUILD_DEP, debhelper (>= 4.1), bison (>= 1:1.875a-1) | bison (<< 1:1.50), flex, realpath (>= 1.9.12)`'TARGETBD
 ',`dnl native
 Build-Depends: LIBC_BUILD_DEP, libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], amd64-libs-dev [i386], ia32-libs-dev [amd64], libunwind7-dev (>= 0.98.3-3) [ia64], libatomic-ops-dev [ia64], m4, autoconf2.13, autoconf, automake1.4, automake1.7, 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 (>= 4.1), gperf (>= 2.7-3), bison (>= 1:1.875a-1) | bison (<< 1:1.50), flex, gettext, texinfo (>= 4.3), zlib1g-dev, libgc-dev [libgc_no_archs], xlibs-dev, gnat-3.3 [ada_no_archs] | gnat-3.4 [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 [pascal_no_archs], sharutils, libgtk2.0-dev (>= 2.4.4-2) [java_no_archs], libart-2.0-dev [java_no_archs], g++-3.3 [!amd64], g77-3.3 [!amd64], gobjc-3.3 [!amd64], realpath (>= 1.9.12)
 Build-Depends-Indep: doxygen (>= 1.3.9.1)
@@ -67,8 +59,8 @@
 Priority: ifdef(`TARGET',`extra',required)
 Depends: ${shlibs:Depends}
 ifelse(ARCH,`ia64',`dnl
-Conflicts: libunwind7 (<< 0.98.3-2)
-Replaces: libunwind7 (<< 0.98.3-2)
+Conflicts: libunwind7`'LS (<< 0.98.3-2)
+Replaces: libunwind7`'LS (<< 0.98.3-2)
 ')`'dnl
 Description: GCC support library`'ifdef(`TARGET)',` (TARGET)', `')
  Shared version of the support library, a library of internal subroutines
@@ -131,8 +123,8 @@
 Architecture: any
 Section: devel
 Priority: ifdef(`TARGET',`extra',`PRI(standard)')
-Depends: gcc`'PV-base (>= CV), libgcc`'GCC_SO`'LS (>= ifelse(GCC_SO,1,CEV,CV)), ${shlibs:Depends}, cpp`'PV`'TS (>= CV), cpp`'PV`'TS (<< NV), binutils`'TS (>= BINUTILSV)ifelse(ARCH,`ia64',`, libunwind7-dev (>= 0.98.3-3)')
-Recommends: ifdef(`TARGET',`libc6-dev`'LS | libc-dev`'LS',`LIBC_DEP')
+Depends: gcc`'PV-base (>= CV), libgcc`'GCC_SO`'LS (>= ifelse(GCC_SO,1,CEV,CV)), ${shlibs:Depends}, cpp`'PV`'TS (>= CV), cpp`'PV`'TS (<< NV), binutils`'TS (>= BINUTILSV)ifelse(ARCH,`ia64',`, libunwind7-dev`'LS (>= 0.98.3-3)')
+Recommends: LIBC_DEP
 Conflicts: gcc-3.2`'TS (<= 1:3.2.3-0pre8)
 Suggests: gcc`'PV-doc (>= CV)ifelse(ARCH,`i386',`, amd64-libs-dev',ARCH,`amd64',`, lib32gcc1')
 Provides: c-compiler`'TS
@@ -533,11 +525,11 @@
  environment.
 ')`'dnl
 
-Package: lib32stdc++6-0
-Architecture: any
-Section: libs
-Priority: optional
-Depends: gcc`'PV-base (>= CV), lib32gcc`'GCC_SO
+Package: lib32stdc++6-0`'LS
+Architecture: ifdef(`TARGET',`all',`any')
+Section: ifdef(`TARGET',`devel',`libs')
+Priority: ifdef(`TARGET',`extra',PRI(optional))
+Depends: gcc`'PV-base (>= CV), lib32gcc`'GCC_SO`'LS
 Description: The GNU Standard C++ Library v3 (ia32)
  This package contains an additional runtime library for C++ programs
  built with the GNU compiler.
@@ -573,10 +565,8 @@
 Architecture: ifdef(`TARGET',`all',`any')
 Section: ifdef(`TARGET',`devel',`libdevel')
 Priority: ifdef(`TARGET',`extra',PRI(standard))
-ifdef(`TARGET',`dnl cross
-Depends: gcc`'PV-base (>= CV), libstdc++CXX_SO`'LS (>= CV), libc6-dev`'LS, g++`'PV`'TS (>= CV)
-',`dnl native
-Depends: gcc`'PV-base (>= CV), libstdc++CXX_SO (>= CV), LIBC_DEP, g++`'PV (>= CV)
+Depends: gcc`'PV-base (>= CV), libstdc++CXX_SO`'LS (>= CV), LIBC_DEP, g++`'PV`'TS (>= CV)
+ifdef(`TARGET',`',`dnl
 Conflicts: libg++27-dev, libg++272-dev (<< 2.7.2.8-1), libstdc++2.8-dev, libg++2.8-dev, libstdc++2.9-dev, libstdc++2.9-glibc2.1-dev, libstdc++2.10-dev (<< 1:2.95.3-2), libstdc++3.0-dev
 Suggests: libstdc++CXX_SO-doc, stl-manual
 ')`'dnl native
@@ -599,10 +589,8 @@
 Architecture: ifdef(`TARGET',`all',`amd64 arm')
 Section: ifdef(`TARGET',`devel',`libdevel')
 Priority: ifdef(`TARGET',`extra',PRI(standard))
-ifdef(`TARGET',`dnl cross
-Depends: gcc`'PV-base (>= CV), libstdc++6-0`'LS (>= CV), libc6-dev`'LS, g++`'PV`'TS (>= CV)
-',`dnl native
-Depends: gcc`'PV-base (>= CV), libstdc++6-0 (>= CV), LIBC_DEP, g++`'PV (>= CV)
+Depends: gcc`'PV-base (>= CV), libstdc++6-0`'LS (>= CV), LIBC_DEP, g++`'PV`'TS (>= CV)
+ifdef(`TARGET',`',`dnl native
 Conflicts: libg++27-dev, libg++272-dev (<< 2.7.2.8-1), libstdc++2.8-dev, libg++2.8-dev, libstdc++2.9-dev, libstdc++2.9-glibc2.1-dev, libstdc++2.10-dev (<< 1:2.95.3-2), libstdc++3.0-dev, libstdc++6-dev (<< 3.4.1-2)
 Suggests: libstdc++CXX_SO-doc, stl-manual
 ')`'dnl native
Index: debian/rules.defs
===================================================================
--- debian/rules.defs	(.../debian/3.4.3-6)	(revision 46)
+++ debian/rules.defs	(.../3.4)	(revision 46)
@@ -21,6 +21,15 @@
 DEB_HOST_GNU_SYSTEM	:= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
 DEB_HOST_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
+# allow debian/target to be used instead of GCC_TARGET - this was requested
+# by toolchain-source maintainer
+ifndef GCC_TARGET
+DEBIAN_TARGET_FILE := $(strip $(shell cat debian/target 2>/dev/null))
+ifneq ($(DEBIAN_TARGET_FILE),)
+GCC_TARGET := $(DEBIAN_TARGET_FILE)
+endif
+endif
+
 DEB_TARGET_ARCH		:= $(shell dpkg-architecture -f \
 			-a$(GCC_TARGET) -qDEB_HOST_ARCH 2>/dev/null)
 DEB_TARGET_GNU_CPU	:= $(shell dpkg-architecture -f \
@@ -46,9 +55,12 @@
   #     names (e.g. powerpc-linux-gcc).
   # TS: Target Suffix. Used primarily at the end of cross compiler
   #     package names (e.g. gcc-powerpc).
+  # LS: Library Suffix. Used primarily at the end of cross compiler
+  #     library package names (e.g. libgcc-powerpc-cross).
+  DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
   TP = $(DEB_TARGET_GNU_TYPE)-
-  DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
   TS = -$(DEB_TARGET_ALIAS)
+  LS = -$(DEB_TARGET_ARCH)-cross
 endif
 
 ifeq ($(DEB_CROSS),yes)
Index: debian/README.cross
===================================================================
--- debian/README.cross	(.../debian/3.4.3-6)	(revision 46)
+++ debian/README.cross	(.../3.4)	(revision 46)
@@ -96,6 +96,10 @@
 not GNU system type (i.e. 'powerpc-linux' or 'arm-linux'). Setting GCC_TARGET
 to GNU system type will cause cross-compiler build to fail.
 
+Instead of setting GCC_TARGET, target architecture name may be put into
+debian/target file. If both GCC_TARGET is defined and debian/target file
+exists, GCC_TARGET is used.
+
 Run debian/rules control. This will change debian/control file, adjusting
 build-depends.
 
Index: debian/rules.conf
===================================================================
--- debian/rules.conf	(.../debian/3.4.3-6)	(revision 46)
+++ debian/rules.conf	(.../3.4)	(revision 46)
@@ -12,7 +12,7 @@
 # various platforms in INSTALL/specific.html) ).
 BINUTILSV = 2.15-5
 ifdef DEB_CROSS
-  BINUTILS_BUILD_DEP = binutils-$(DEB_TARGET_GNU_TYPE)
+  BINUTILS_BUILD_DEP = binutils$(TS) (>= $(BINUTILSV))
 else
   BINUTILS_BUILD_DEP = binutils (>= $(BINUTILSV)) | binutils-multiarch (>= $(BINUTILSV))
 endif
@@ -21,25 +21,33 @@
 libc_ver := 2.3.2.ds1-16
 ifeq ($(DEB_TARGET_GNU_SYSTEM),linux)
   ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),alpha ia64))
-    LIBC_DEP = libc6.1-dev (>= $(libc_ver))
+    LIBC_DEP = libc6.1-dev$(LS) (>= $(libc_ver))
   else
-    LIBC_DEP = libc6-dev (>= $(libc_ver))
+    LIBC_DEP = libc6-dev$(LS) (>= $(libc_ver))
   endif
 endif
 ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
-  LIBC_DEP = libc0.3-dev
+  LIBC_DEP = libc0.3-dev$(LS)
 endif
 ifeq ($(DEB_TARGET_GNU_SYSTEM),kfreebsd-gnu)
-  LIBC_DEP = libc0.1-dev
+  LIBC_DEP = libc0.1-dev$(LS)
 endif
 ifeq ($(DEB_TARGET_GNU_SYSTEM),knetbsd-gnu)
-  LIBC_DEP = libc0.1-dev
+  LIBC_DEP = libc0.1-dev$(LS)
 endif
 ifeq ($(DEB_TARGET_GNU_SYSTEM),netbsd-elf-gnu)
-  LIBC_DEP = libc12-dev
+  LIBC_DEP = libc12-dev$(LS)
 endif
+
+ifndef DEB_CROSS
 LIBC_BUILD_DEP = libc6.1-dev (>= $(libc_ver)) [alpha ia64] | libc0.3-dev (>= $(libc_ver)) | libc0.1-dev (>= $(libc_ver)) | libc12-dev (>= $(libc_ver)) | libc6-dev (>= $(libc_ver))
+else
+# When building a cross compiler, the libc-dev build dependancy must be
+# sensitive to the target architecture; the host architecture is irrelevant.
+LIBC_BUILD_DEP = $(LIBC_DEP)
+endif
 
+
 SOURCE_VERSION := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$NF}')
 DEB_VERSION := $(shell echo $(SOURCE_VERSION) \
 	| sed -e 's/.*://' -e 's/ds[0-9]*//')
@@ -142,14 +150,24 @@
 ctrl_flags += \
 	-DLIBC_DEP="$(LIBC_DEP)" \
 	-DBINUTILS_BUILD_DEP="$(BINUTILS_BUILD_DEP)" \
-	-DLIBC_BUILD_DEP="$(LIBC_BUILD_DEP)"
+	-DLIBC_BUILD_DEP="$(LIBC_BUILD_DEP)" \
+	-DTP=$(TP) \
+	-DTS=$(TS) \
+	-DLS=$(LS)
 
 ifdef DEB_CROSS
+  ifeq ($(DEB_TARGET_ARCH),sparc)
+    TARGETBD = , libc6-dev-sparc64-sparc-cross
+  endif
+  ifeq ($(DEB_TARGET_ARCH),s390)
+    TARGETBD = , libc6-dev-s390x-s390-cross
+  endif
+  ifeq ($(DEB_TARGET_ARCH),ia64)
+    TARGETBD = , libunwind7-dev-ia64-cross (>= 0.98.3-3), libatomic-ops-dev-ia64-cross
+  endif
   ctrl_flags += \
 	-DTARGET=$(DEB_TARGET_ARCH) \
-	-DTP=$(TP) \
-	-DTS=$(TS) \
-	-DPRI=optional
+	-DTARGETBD="$(TARGETBD)"
 else
   # XXX change when 3.4 becomes the default compiler
   ctrl_flags += \
Index: debian/rules2
===================================================================
--- debian/rules2	(.../debian/4.0ds1-0pre2)	(revision 46)
+++ debian/rules2	(.../4.0)	(revision 46)
@@ -82,6 +82,7 @@
 	--enable-languages=$(shell echo $(enabled_languages) | tr -s ' ' ',') \
 	--prefix=/$(PF) \
 	--libexecdir=/$(libexecdir) \
+	--with-gxx-include-dir=/$(cxx_inc_dir) \
 	--enable-shared \
 	--with-system-zlib \
 	--enable-nls \
@@ -911,9 +912,11 @@
   include debian/rules.d/binary-libstdcxx-cross.mk
 endif
 
-#ifeq ($(DEB_TARGET_GNU_CPU),powerpc)
-#  include debian/rules.d/binary-nof-cross.mk
-#endif
+ifneq ($(with_libnof),yes)
+  ifeq ($(DEB_TARGET_GNU_CPU),powerpc)
+    include debian/rules.d/binary-nof-cross.mk
+  endif
+endif
 
 ifeq ($(with_cdev),yes)
   include debian/rules.d/binary-gcc-cross.mk
Index: debian/control.m4
===================================================================
--- debian/control.m4	(.../debian/4.0ds1-0pre2)	(revision 46)
+++ debian/control.m4	(.../4.0)	(revision 46)
@@ -19,14 +19,6 @@
     define(`PRI', `$1')
 ')
 define(`MAINTAINER', `Debian GCC maintainers <debian-gcc@lists.debian.org>')
-ifdef(`TARGET', `
-    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')
-')
 
 define(`ifenabled', `ifelse(index(enabled_languages, `$1'), -1, `dnl', `$2')')
 
@@ -39,10 +31,10 @@
 Uploaders: Matthias Klose <doko@debian.org>
 Standards-Version: 3.6.1
 ifdef(`TARGET',`dnl cross
-Build-Depends: LIBC_BUILD_DEP, m4, autoconf, automake1.9, libtool, autotools-dev, autogen, gawk, bzip2, dpkg-cross (>= 1.18.1), BINUTILS_BUILD_DEP, debhelper (>= 4.1), bison (>= 1:1.875a-1) | bison (<< 1:1.50), flex, realpath (>= 1.9.12), chrpath`'BD64
+Build-Depends: LIBC_BUILD_DEP, m4, autoconf, automake1.9, libtool, autotools-dev, autogen, gawk, bzip2, dpkg-cross (>= 1.18.1), BINUTILS_BUILD_DEP, debhelper (>= 4.1), bison (>= 1:1.875a-1) | bison (<< 1:1.50), flex, realpath (>= 1.9.12)`'TARGETBD
 ',`dnl native
 Build-Depends: LIBC_BUILD_DEP, libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], amd64-libs-dev [i386], ia32-libs-dev [amd64], libunwind7-dev [ia64], m4, autoconf, automake1.9, libtool, autogen, gawk, dejagnu (>= 1.4.3) [check_no_archs], expect (>= 5.38.0) [check_no_archs], bzip2, BINUTILS_BUILD_DEP, binutils-hppa64 [hppa], debhelper (>= 4.1), gperf (>= 2.7-3), bison (>= 1:1.875a-1), flex, gettext, texinfo (>= 4.3), zlib1g-dev, libgc-dev [libgc_no_archs], xlibs-dev, gnat-3.3 [ada_no_archs] | gnat-3.4 [ada_no_archs], libncurses5-dev [pascal_no_archs], libmpfr-dev | libgmp3-dev (<< 4.1.4-3), tetex-bin [pascal_no_archs], locales [locale_no_archs], procps [linux_gnu_archs], help2man [pascal_no_archs], sharutils, libgtk2.0-dev [java_no_archs], libart-2.0-dev [java_no_archs], g++-3.4, gobjc-3.4, type-handling (>= 0.2.1), realpath (>= 1.9.12), chrpath
-Build-Depends-Indep: doxygen (>= 1.3.9.1)
+Build-Depends-Indep: doxygen (>= 1.3.7)
 ')dnl
 
 ifdef(`TARGET', `', `
@@ -129,8 +121,8 @@
 Architecture: any
 Section: devel
 Priority: ifdef(`TARGET',`extra',`PRI(standard)')
-Depends: gcc`'PV-base (>= CV), libgcc`'GCC_SO`'LS (>= ifelse(GCC_SO,1,CEV,CV)), ${shlibs:Depends}, cpp`'PV`'TS (>= CV), cpp`'PV`'TS (<< NV), binutils`'TS (>= BINUTILSV)ifelse(ARCH,`ia64',`, libunwind7-dev')
-Recommends: ifdef(`TARGET',`libc6-dev`'LS | libc-dev`'LS',`LIBC_DEP'), libmudflap`'MF_SO-dev (>= CV)
+Depends: gcc`'PV-base (>= CV), libgcc`'GCC_SO`'LS (>= ifelse(GCC_SO,1,CEV,CV)), ${shlibs:Depends}, cpp`'PV`'TS (>= CV), cpp`'PV`'TS (<< NV), binutils`'TS (>= BINUTILSV)ifelse(ARCH,`ia64',`, libunwind7-dev`'LS')
+Recommends: LIBC_DEP, libmudflap`'MF_SO-dev`'LS (>= CV)
 Conflicts: gcc-3.2`'TS (<= 1:3.2.3-0pre8), gcc-3.5
 Replaces: gcc-3.5
 Suggests: gcc`'PV-doc (>= CV)ifelse(ARCH,`i386',`, amd64-libs-dev',ARCH,`amd64',`, lib32gcc1')
@@ -552,10 +544,8 @@
 Architecture: ifdef(`TARGET',`all',`any')
 Section: ifdef(`TARGET',`devel',`libdevel')
 Priority: ifdef(`TARGET',`extra',PRI(standard))
-ifdef(`TARGET',`dnl cross
-Depends: gcc`'PV-base (>= CV), libstdc++CXX_SO`'LS (>= CV), libc6-dev`'LS, g++`'PV`'TS (>= CV)
-',`dnl native
-Depends: gcc`'PV-base (>= CV), libstdc++CXX_SO (>= CV), LIBC_DEP, g++`'PV (>= CV)
+Depends: gcc`'PV-base (>= CV), libstdc++CXX_SO`'LS (>= CV), LIBC_DEP, g++`'PV`'TS (>= CV)
+ifdef(`TARGET',`',`dnl native
 Conflicts: libg++27-dev, libg++272-dev (<< 2.7.2.8-1), libstdc++2.8-dev, libg++2.8-dev, libstdc++2.9-dev, libstdc++2.9-glibc2.1-dev, libstdc++2.10-dev (<< 1:2.95.3-2), libstdc++3.0-dev
 Suggests: libstdc++CXX_SO`'PV-doc, stl-manual
 ')`'dnl native
Index: debian/rules.defs
===================================================================
--- debian/rules.defs	(.../debian/4.0ds1-0pre2)	(revision 46)
+++ debian/rules.defs	(.../4.0)	(revision 46)
@@ -18,6 +18,15 @@
 DEB_HOST_GNU_SYSTEM	:= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
 DEB_HOST_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
+# allow debian/target to be used instead of GCC_TARGET - this was requested
+# by toolchain-source maintainer
+ifndef GCC_TARGET
+DEBIAN_TARGET_FILE := $(strip $(shell cat debian/target 2>/dev/null))
+ifneq ($(DEBIAN_TARGET_FILE),)
+GCC_TARGET := $(DEBIAN_TARGET_FILE)
+endif
+endif
+
 DEB_TARGET_ARCH		:= $(shell dpkg-architecture -f \
 			-a$(GCC_TARGET) -qDEB_HOST_ARCH 2>/dev/null)
 DEB_TARGET_GNU_CPU	:= $(shell dpkg-architecture -f \
@@ -43,9 +52,12 @@
   #     names (e.g. powerpc-linux-gcc).
   # TS: Target Suffix. Used primarily at the end of cross compiler
   #     package names (e.g. gcc-powerpc).
+  # LS: Library Suffix. Used primarily at the end of cross compiler
+  #     library package names (e.g. libgcc-powerpc-cross).
+  DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
   TP = $(DEB_TARGET_GNU_TYPE)-
-  DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
   TS = -$(DEB_TARGET_ALIAS)
+  LS = -$(DEB_TARGET_ARCH)-cross
 endif
 
 ifeq ($(DEB_CROSS),yes)
Index: debian/README.cross
===================================================================
--- debian/README.cross	(.../debian/4.0ds1-0pre2)	(revision 46)
+++ debian/README.cross	(.../4.0)	(revision 46)
@@ -96,6 +96,10 @@
 not GNU system type (i.e. 'powerpc-linux' or 'arm-linux'). Setting GCC_TARGET
 to GNU system type will cause cross-compiler build to fail.
 
+Instead of setting GCC_TARGET, target architecture name may be put into
+debian/target file. If both GCC_TARGET is defined and debian/target file
+exists, GCC_TARGET is used.
+
 Run debian/rules control. This will change debian/control file, adjusting
 build-depends.
 
Index: debian/rules.conf
===================================================================
--- debian/rules.conf	(.../debian/4.0ds1-0pre2)	(revision 46)
+++ debian/rules.conf	(.../4.0)	(revision 46)
@@ -12,7 +12,7 @@
 # various platforms in INSTALL/specific.html) ).
 BINUTILSV = 2.15-5
 ifdef DEB_CROSS
-  BINUTILS_BUILD_DEP = binutils-$(DEB_TARGET_GNU_TYPE) (>= $(BINUTILSV))
+  BINUTILS_BUILD_DEP = binutils$(TS) (>= $(BINUTILSV))
 else
   BINUTILS_BUILD_DEP = binutils (>= $(BINUTILSV)) | binutils-multiarch (>= $(BINUTILSV))
 endif
@@ -21,24 +21,31 @@
 libc_ver := 2.3.2.ds1-19
 ifeq ($(DEB_TARGET_GNU_SYSTEM),linux)
   ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),alpha ia64))
-    LIBC_DEP = libc6.1-dev (>= $(libc_ver))
+    LIBC_DEP = libc6.1-dev$(LS) (>= $(libc_ver))
   else
-    LIBC_DEP = libc6-dev (>= $(libc_ver))
+    LIBC_DEP = libc6-dev$(LS) (>= $(libc_ver))
   endif
 endif
 ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
-  LIBC_DEP = libc0.3-dev
+  LIBC_DEP = libc0.3-dev$(LS)
 endif
 ifeq ($(DEB_TARGET_GNU_SYSTEM),kfreebsd-gnu)
-  LIBC_DEP = libc0.1-dev
+  LIBC_DEP = libc0.1-dev$(LS)
 endif
 ifeq ($(DEB_TARGET_GNU_SYSTEM),knetbsd-gnu)
-  LIBC_DEP = libc0.1-dev
+  LIBC_DEP = libc0.1-dev$(LS)
 endif
 ifeq ($(DEB_TARGET_GNU_SYSTEM),netbsd-elf-gnu)
-  LIBC_DEP = libc12-dev
+  LIBC_DEP = libc12-dev$(LS)
 endif
+
+ifndef DEB_CROSS
 LIBC_BUILD_DEP = libc6.1-dev (>= $(libc_ver)) [alpha ia64] | libc0.3-dev (>= $(libc_ver)) | libc0.1-dev | libc12-dev (>= $(libc_ver)) | libc6-dev (>= $(libc_ver))
+else
+# When building a cross compiler, the libc-dev build dependancy must be
+# sensitive to the target architecture; the host architecture is irrelevant.
+LIBC_BUILD_DEP = $(LIBC_DEP)
+endif
 
 SOURCE_VERSION := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$NF}')
 DEB_VERSION := $(shell echo $(SOURCE_VERSION) \
@@ -133,14 +140,24 @@
 ctrl_flags += \
 	-DLIBC_DEP="$(LIBC_DEP)" \
 	-DBINUTILS_BUILD_DEP="$(BINUTILS_BUILD_DEP)" \
-	-DLIBC_BUILD_DEP="$(LIBC_BUILD_DEP)"
+	-DLIBC_BUILD_DEP="$(LIBC_BUILD_DEP)" \
+	-DTP=$(TP) \
+	-DTS=$(TS) \
+	-DLS=$(LS)
 
 ifdef DEB_CROSS
+  ifeq ($(DEB_TARGET_ARCH),sparc)
+    TARGETBD = , libc6-dev-sparc64-sparc-cross
+  endif
+  ifeq ($(DEB_TARGET_ARCH),s390)
+    TARGETBD = , libc6-dev-s390x-s390-cross
+  endif
+  ifeq ($(DEB_TARGET_ARCH),ia64)
+    TARGETBD = , libunwind7-dev-ia64-cross
+  endif
   ctrl_flags += \
 	-DTARGET=$(DEB_TARGET_ARCH) \
-	-DTP=$(TP) \
-	-DTS=$(TS) \
-	-DPRI=optional
+	-DTARGETBD="$(TARGETBD)"
 else
   # XXX change when 4.0 becomes the default compiler
   ctrl_flags += \

Attachment: pgpuD7q2fp3Ej.pgp
Description: PGP signature


Reply to: