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

cross compile patch - superseed non responsible toolchain-source



hi folks

this patch reworks the cross compiling facilities within the gcc
package. i write this because the toolchain-source, which should do that
work, isn't longer maintained.

it changes the following:
- debian/control.m4:
  - cross packages don't have a version
  - enable c++ cross package
- debian/rules.d/binary-*-cross.mk:
  - add copies of the native rules
- debian/rules.defs:
  - rework the arch resolution code
  - define DEB_TARGET_* along with DEB_HOST_*
  - enable common packages for cross compilation
  - explicite disable libffi from cross compilation
- debian/rules*:
  - use DEB_CROSS for cross compile determination
- debian/rules2:
  - change configure options
  - fix package names
  - import right make files

bastian

-- 
Sometimes a feeling is all we humans have to go on.
		-- Kirk, "A Taste of Armageddon", stardate 3193.9
diff -urN gcc-3.2-3.2.3ds0.orig/debian/changelog gcc-3.2-3.2.3ds0/debian/changelog
--- gcc-3.2-3.2.3ds0.orig/debian/changelog	2003-02-22 13:30:27.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/changelog	2003-02-23 08:57:02.000000000 +0100
@@ -1,3 +1,9 @@
+gcc-3.2 (1:3.2.3ds0-0pre1.cross.1) unstable; urgency=low
+
+  * fix cross compile.
+
+ -- Bastian Blank <waldi@debian.org>  Sun, 23 Feb 2003 08:57:02 +0100
+
 gcc-3.2 (1:3.2.3ds0-0pre1) unstable; urgency=low
 
   * gcc-3.2.3 prerelease (CVS 20030210)
diff -urN gcc-3.2-3.2.3ds0.orig/debian/control.m4 gcc-3.2-3.2.3ds0/debian/control.m4
--- gcc-3.2-3.2.3ds0.orig/debian/control.m4	2003-02-22 13:30:27.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/control.m4	2003-02-23 09:03:15.000000000 +0100
@@ -47,48 +47,54 @@
 ')`'dnl native
 
 ifenabled(`libgcc',`
-ifdef(`TARGET', `', `
 Package: libgcc`'GCC_SO`'TS
 Architecture: any
 Section: libs
 Priority: PRI(standard)
 Depends: ${shlibs:Depends}
-Replaces: libgcc300, libgcc0
+ifdef(`TARGET',
+`Description: GCC support library (TARGET)
+',
+`Replaces: libgcc300, libgcc0
 Description: GCC support library
+')`'dnl native
  Shared version of the support library, a library of internal subroutines
  that GCC uses to overcome shortcomings of particular machines, or
  special needs for some languages.
-')`'dnl native
 ')`'dnl libgcc
 
 ifenabled(`cdev',`
-ifdef(`TARGET', `
-dnl gcc cross compiler
-Package: gcc`'TS`'PV
+ifdef(`TARGET',
+`Package: gcc`'TS
+',
+`Package: gcc`'PV
+')`'dnl native
 Architecture: any
 Section: devel
 Priority: PRI(optional)
-Depends: ${shlibs:Depends}, binutils`'TS (>= BINUTILSV)
+Depends: gcc`'PV-base, libgcc`'GCC_SO`'TS (>= CV), ${shlibs:Depends}, cpp`'PV (>= CV), cpp`'PV (<< NV), binutils`'TS (>= BINUTILSV)
+Suggests: task-c-devel
+ifdef(`TARGET',
+`Depends: gcc`'PV-base, libgcc`'GCC_SO`'TS (>= CV), ${shlibs:Depends}, cpp`'PV (>= CV), cpp`'PV (<< NV), binutils`'TS (>= BINUTILSV)
 Suggests: task-c-devel
 Provides: c-compiler`'TS
 Recommends: TARGET-libc
 Suggests: gcc`'PV-doc (>= CV)
-Description: The GNU C compiler (cross compiler for TARGET)
- This is the GNU C compiler, a fairly portable optimizing compiler for C.
-', `
-dnl gcc native compiler
-Package: gcc`'TS`'PV
-Architecture: any
-Depends: gcc`'TS`'PV-base, libgcc`'GCC_SO`'TS (>= CV), ${shlibs:Depends}, cpp`'TS`'PV (>= CV), cpp`'TS`'PV (<< NV), binutils`'TS (>= BINUTILSV)
+',
+`Depends: gcc`'TS`'PV-base, libgcc`'GCC_SO`'TS (>= CV), ${shlibs:Depends}, cpp`'TS`'PV (>= CV), cpp`'TS`'PV (<< NV), binutils (>= BINUTILSV)
 Suggests: task-c-devel
 Conflicts: libc5-dev, gcc-3.1
 Replaces: gcc-3.1
 Provides: c-compiler`'TS
 Recommends: LIBC_DEV
 Suggests: gcc`'PV-doc (>= CV)
-Description: The GNU C compiler
- This is the GNU C compiler, a fairly portable optimizing compiler for C.
 ')`'dnl native
+ifdef(`TARGET',
+`Description: The GNU C compiler (cross compiler for TARGET)
+',
+`Description: The GNU C compiler
+')`'dnl native
+ This is the GNU C compiler, a fairly portable optimizing compiler for C.
 ')`'dnl cdev
 
 ifenabled(`cdev',`
@@ -103,9 +109,7 @@
  .
  This package has been separated from gcc for the benefit of those who
  require the preprocessor but not the compiler.
-')`'dnl native
 
-ifdef(`TARGET', `', `
 Package: cpp`'PV-doc
 Architecture: all
 Section: doc
@@ -119,31 +123,28 @@
 
 ifenabled(`c++',`
 ifenabled(`c++dev',`
-ifdef(`TARGET', `
-dnl C++ cross compiler
-Package: g++`'TS`'PV
+ifdef(`TARGET',
+`Package: g++`'TS
+',
+`Package: g++`'TS`'PV
+')`'dnl native
 Architecture: any
 Section: devel
-Priority: PRI(optional)
+Priority: PRI(standard)
 Provides: c++-compiler`'TS
-Depends: ${shlibs:Depends}, gcc`'TS`'PV (>= CV), gcc`'TS`'PV (<< NV)
+ifdef(`TARGET',
+`Depends: gcc`'PV-base, ${shlibs:Depends}, gcc`'TS (>= CV), gcc`'TS (<< NV), libstdc++CXX_SO`'TS-dev (>= CV)
 Suggests: task-c++-devel
 Suggests: gcc`'PV-doc (>= CV)
 Description: The GNU C++ compiler (cross compiler for TARGET)
- This is the GNU C++ compiler, a fairly portable optimizing compiler for C++.
-', `
-dnl C++ native compiler
-Package: g++`'TS`'PV
-Architecture: any
-Priority: PRI(standard)
-Provides: c++-compiler`'TS
-Depends: gcc`'TS`'PV-base, ${shlibs:Depends}, gcc`'TS`'PV (>= CV), gcc`'TS`'PV (<< NV), libstdc++CXX_SO-dev (>= CV)
+',
+`Depends: gcc`'TS`'PV-base, ${shlibs:Depends}, gcc`'TS`'PV (>= CV), gcc`'TS`'PV (<< NV), libstdc++CXX_SO-dev (>= CV)
 Suggests: task-c++-devel
 Replaces: gcc (<= 2.7.2.3-3)
 Suggests: gcc`'PV-doc (>= CV)
 Description: The GNU C++ compiler
- This is the GNU C++ compiler, a fairly portable optimizing compiler for C++.
 ')`'dnl native
+ This is the GNU C++ compiler, a fairly portable optimizing compiler for C++.
 ')`'dnl c++dev
 ')`'dnl c++
 
@@ -316,13 +317,16 @@
 ')`'dnl ffi
 
 ifenabled(`c++',`
-ifdef(`TARGET', `', `
-Package: libstdc++CXX_SO
+Package: libstdc++CXX_SO`'TS
 Architecture: any
 Section: base
 Priority: PRI(important)
 Depends: gcc`'PV-base, ${shlibs:Depends}
-Description: The GNU Standard C++ Library v3
+ifdef(`TARGET', 
+`Description: The GNU Standard C++ Library v3 (TARGET)
+',
+`Description: The GNU Standard C++ Library v3
+')`'dnl native
  This package contains an additional runtime library for C++ programs
  built with the GNU compiler.
  .
@@ -331,13 +335,18 @@
  in g++-3.0.
 
 ifenabled(`c++dev',`
-Package: libstdc++CXX_SO-dev
+Package: libstdc++CXX_SO`'TS-dev
 Architecture: any
 Priority: PRI(optional)
-Depends: gcc`'PV-base, libstdc++CXX_SO (>= CV), LIBC_DEV, g++`'PV (>= CV)
-Provides: libstdc++-dev
+ifdef(`TARGET', 
+`Depends: gcc`'PV-base, libstdc++CXX_SO`'TS (>= CV), LIBC_DEV, g++`'TS (>= CV)
+Provides: libstdc++`'TS-dev
+',
+`Depends: gcc`'PV-base, libstdc++CXX_SO`'TS (>= CV), LIBC_DEV, g++`'TS`'PV (>= CV)
+Provides: libstdc++`'TS-dev
 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
 Description: The GNU Standard C++ Library v3 (development files)
  This package contains the headers and static library files necessary for
  building C++ programs which use libstdc++. Be advised that this only works
@@ -347,24 +356,25 @@
  was included up to g++-2.95. The first version of libstdc++-v3 appeared
  in g++-3.0.
 
-Package: libstdc++CXX_SO-pic
+Package: libstdc++CXX_SO`'TS-pic
 Architecture: any
-Priority: PRI(extra)
-Depends: gcc`'PV-base, libstdc++CXX_SO, libstdc++CXX_SO-dev
+Priority: extra
+Depends: gcc`'PV-base, libstdc++CXX_SO`'TS, libstdc++CXX_SO`'TS-dev
 Description: The GNU Standard C++ Library v3 (shared library subset kit)
  This is used to develop subsets of the libstdc++ shared libraries for
  use on custom installation floppies and in embedded systems.
  .
  Unless you are making one of those, you will not need this package.
 
-Package: libstdc++CXX_SO-dbg
+Package: libstdc++CXX_SO`'TS-dbg
 Architecture: any
-Priority: PRI(extra)
-Depends: gcc`'PV-base, libstdc++CXX_SO, libstdc++CXX_SO-dev
+Priority: extra
+Depends: gcc`'PV-base, libstdc++CXX_SO`'TS, libstdc++CXX_SO`'TS-dev
 Description: The GNU Standard C++ Library v3 (debugging files)
  This package contains the shared library of libstdc++ compiled with
  debugging symbols.
 
+ifdef(`TARGET', `', `
 Package: libstdc++CXX_SO-doc
 Architecture: all
 Section: doc
@@ -378,9 +388,9 @@
  source documentation including a namespace list, class hierarchy,
  alphabetical list, compound list, file list, namespace members,
  compound members and file members.
+')`'dnl native
 ')`'dnl c++dev
 ')`'dnl c++
-')`'dnl native
 
 ifenabled(`ada',`
 Package: gnat`'-GNAT_V
@@ -442,12 +452,21 @@
  stage. For production use, please use gpc or gpc-2.95.
 ')`'dnl pascal
 
-Package: gcc`'PV-soft-float
+ifdef(`TARGET', 
+`Package: gcc`'TS-soft-float
+Architecture: any
+',
+`Package: gcc`'TS`'PV-soft-float
 Architecture: arm
+')`'dnl native
 Priority: PRI(optional)
-Depends: gcc`'PV-base, ${shlibs:Depends}, gcc`'PV (>= CV), gcc`'PV (<< NV)
+ifdef(`TARGET', 
+`Depends: gcc`'PV-base, ${shlibs:Depends}ifenabled(`cdev',`, gcc`'TS (>= CV), gcc`'TS (<< NV)')
+',
+`Depends: gcc`'PV-base, ${shlibs:Depends}ifenabled(`cdev',`, gcc`'PV (>= CV), gcc`'PV (<< NV)')
+')`'dnl native
 Replaces: gcc-soft-float-ss (<< NV)
-Description: The soft-floating-point gcc libraries
+Description: The soft-floating-point gcc libraries (arm)
  These are versions of basic static libraries such as libgcc.a compiled
  with the -msoft-float option, for CPUs without a floating-point unit.
 
@@ -481,12 +500,20 @@
 ')`'dnl native
 ')`'dnl cdev
 
-Package: gcc`'PV-nof
+ifdef(`TARGET',
+`Package: gcc`'TS-nof
+Architecture: any
+',
+`Package: gcc`'TS`'PV-nof
 Architecture: powerpc
+')`'dnl native
 Priority: PRI(optional)
-Depends: gcc`'PV-base, ${shlibs:Depends}ifenabled(`cdev',`, gcc`'PV (>= CV), gcc`'PV (<< NV)')
-Depends: gcc-3.0-base, ${shlibs:Depends}ifelse(index(enabled_languages, `$1'), -1,`', `, gcc`'PV (>= CV), gcc`'PV (<< NV)')
-Description: The no-floating-point gcc libraries
+ifdef(`TARGET', 
+`Depends: gcc`'PV-base, ${shlibs:Depends}ifenabled(`cdev',`, gcc`'TS (>= CV), gcc`'TS (<< NV)')
+',
+`Depends: gcc`'PV-base, ${shlibs:Depends}ifenabled(`cdev',`, gcc`'PV (>= CV), gcc`'PV (<< NV)')
+')`'dnl native
+Description: The no-floating-point gcc libraries (powerpc)
  These are versions of basic static libraries such as libgcc.a compiled
  with the -msoft-float option, for CPUs without a floating-point unit.
 dnl
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.conf gcc-3.2-3.2.3ds0/debian/rules.conf
--- gcc-3.2-3.2.3ds0.orig/debian/rules.conf	2003-02-22 13:30:27.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.conf	2003-02-23 08:31:35.000000000 +0100
@@ -11,7 +11,7 @@
 # the safe side (something like newest( version in stable, versions for the
 # various platforms in INSTALL/specific.html) ).
 BINUTILSV = 2.13.90.0.10
-ifeq ($(DEB_HOST_ARCH),s390)
+ifeq ($(DEB_TARGET_ARCH),s390)
   BINUTILSV = 2.13.90.0.4
 endif
 
@@ -73,24 +73,24 @@
 	-DGPC_CV=$(DEB_GPC_VERSION) \
 	-DBINUTILSV=$(BINUTILSV) \
 	-DSRCNAME=$(PKGSOURCE) \
-	-D__$(DEB_HOST_GNU_CPU)__ \
-	-DARCH=$(DEB_HOST_GNU_CPU)
+	-D__$(DEB_TARGET_GNU_CPU)__ \
+	-DARCH=$(DEB_TARGET_GNU_CPU)
 ifeq ($(with_objc)-$(with_objc_gc),yes-yes)
   ctrl_flags +=	-DOBJC_GC
 endif
 
 # libc-dev dependencies
 libc_ver := 2.2.5-8
-ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),alpha ia64))
+ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),alpha ia64))
   ctrl_flags += -DLIBC_DEV="libc6.1-dev (>= $(libc_ver))"
 else
-  ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
+  ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
     ctrl_flags += -DLIBC_DEV=libc0.3-dev
   else
-    ifeq ($(DEB_HOST_GNU_SYSTEM),freebsd)
+    ifeq ($(DEB_TARGET_GNU_SYSTEM),freebsd)
       ctrl_flags += -DLIBC_DEV=libc1-dev
     else
-      ifeq ($(DEB_HOST_ARCH),netbsd-i386))
+      ifeq ($(DEB_TARGET_ARCH),netbsd-i386))
         ctrl_flags += -DLIBC_DEV="libc12-dev" 
       else 
         ctrl_flags += -DLIBC_DEV="libc6-dev (>= $(libc_ver))" 
@@ -100,9 +100,9 @@
 endif
 ctrl_flags += -DLIBC_BUILD_DEP="libc6.1-dev (>= $(libc_ver)) [alpha ia64] | libc0.3-dev [hurd-i386] | libc1-dev [freebsd-i386] | libc12-dev [netbsd-i386] | libc6-dev (>= $(libc_ver))"
 
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
   ctrl_flags += \
-	-DTARGET=$(GCC_TARGET) \
+	-DTARGET=$(DEB_TARGET_ARCH) \
 	-DTP=$(TP) \
 	-DTS=$(TS)
 endif
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-cross.mk gcc-3.2-3.2.3ds0/debian/rules.d/binary-cross.mk
--- gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-cross.mk	2003-02-22 13:30:28.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.d/binary-cross.mk	1970-01-01 01:00:00.000000000 +0100
@@ -1,57 +0,0 @@
-arch_binaries  := $(arch_binaries) gcc-cross
-
-dirs_gcc = \
-	$(docdir)/$(p_base)/gcc \
-	$(PF)/bin \
-	$(gcc_lib_dir)/include \
-	$(PF)/share/man/man1
-
-files_gcc = \
-	$(PF)/bin/{$(GCC_TARGET)-linux-gcc,$(GCC_TARGET)-linux-cpp}$(pkg_ver) \
-	$(PF)/share/man/man1/{$(GCC_TARGET)-linux-gcc}$(pkg_ver).1 \
-	$(gcc_lib_dir) \
-
-
-files_gcc += \
-	$(shell test -e $(d)/$(gcc_lib_dir)/SYSCALLS.c.X \
-		&& echo $(gcc_lib_dir)/SYSCALLS.c.X)
-
-usr_doc_files = debian/README.Bugs \
-	$(shell test -f $(srcdir)/FAQ && echo $(srcdir)/FAQ)
-ifeq ($(with_check),yes)
-  usr_doc_files += test-summary
-endif
-ifeq ($(DEB_HOST_ARCH),sparc)
-  usr_doc_files += debian/README.sparc
-endif
-
-# ----------------------------------------------------------------------
-$(binary_stamp)-gcc-cross: $(install_stamp)
-	dh_testdir
-	dh_testroot
-	rm -rf $(d_gcc)
-	dh_installdirs -p$(p_gcc) $(dirs_gcc)
-	$(IS) debian/c89 $(d)/$(PF)/bin/
-	$(IR) debian/c89.1 $(d)/$(PF)/share/man/man1/
-
-	rm -f $(d)/$(PF)/lib/libgcc_s.so
-	ln -sf /lib/libgcc_s.so.$(GCC_SONAME) $(d)/$(gcc_lib_dir)/libgcc_s.so
-
-	dh_movefiles -p$(p_gcc) $(files_gcc)
-
-#	dh_installdebconf
-	debian/dh_doclink -p$(p_gcc) $(p_base)
-	cp -p $(usr_doc_files) $(d_gcc)/$(docdir)/$(p_base)/.
-	cp -p debian/NEWS.gcc $(d_gcc)/$(docdir)/$(p_base)/NEWS
-	dh_undocumented -p$(p_gcc) gccbug$(pkg_ver).1
-	debian/dh_rmemptydirs -p$(p_gcc)
-	dh_strip -p$(p_gcc)
-	dh_compress -p$(p_gcc)
-	dh_fixperms -p$(p_gcc)
-	dh_shlibdeps -p$(p_gcc)
-	dh_gencontrol -p$(p_gcc) -u-v$(DEB_VERSION)
-	dh_installdeb -p$(p_gcc)
-	dh_md5sums -p$(p_gcc)
-	dh_builddeb -p$(p_gcc)
-	touch $@
-
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-cxx-cross.mk gcc-3.2-3.2.3ds0/debian/rules.d/binary-cxx-cross.mk
--- gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-cxx-cross.mk	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.d/binary-cxx-cross.mk	2003-02-22 20:57:34.000000000 +0100
@@ -0,0 +1,39 @@
+arch_binaries  := $(arch_binaries) cxx
+
+dirs_cxx = \
+	$(PF)/bin \
+	$(PF)/share/info \
+	$(gcc_lib_dir) \
+	$(PF)/share/man/man1
+files_cxx = \
+	$(PF)/bin/$(DEB_TARGET_GNU_TYPE)-g++ \
+	$(PF)/share/man/man1/$(DEB_TARGET_GNU_TYPE)-g++.1 \
+	$(gcc_lib_dir)/cc1plus
+
+# ----------------------------------------------------------------------
+$(binary_stamp)-cxx: $(install_stamp)
+	dh_testdir
+	dh_testroot
+	mv $(install_stamp) $(install_stamp)-tmp
+
+	rm -rf $(d_cxx)
+	dh_installdirs -p$(p_cxx) $(dirs_cxx)
+	dh_movefiles -p$(p_cxx) $(files_cxx)
+# g++ man page is a .so link
+	rm -f $(d_cxx)/$(PF)/share/man/man1/$(DEB_TARGET_GNU_TYPE)-g++.1
+	ln -sf $(DEB_TARGET_GNU_TYPE)-gcc.1.gz \
+		$(d_cxx)/$(PF)/share/man/man1/$(DEB_TARGET_GNU_TYPE)-g++.1.gz
+
+	debian/dh_doclink -p$(p_cxx) $(p_base)
+	debian/dh_rmemptydirs -p$(p_cxx)
+
+	dh_strip -p$(p_cxx)
+	dh_compress -p$(p_cxx)
+	dh_fixperms -p$(p_cxx)
+	dh_shlibdeps -p$(p_cxx)
+	dh_gencontrol -p$(p_cxx) -u-v$(DEB_VERSION)
+	dh_installdeb -p$(p_cxx)
+	dh_md5sums -p$(p_cxx)
+	dh_builddeb -p$(p_cxx)
+
+	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-gcc-cross.mk gcc-3.2-3.2.3ds0/debian/rules.d/binary-gcc-cross.mk
--- gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-gcc-cross.mk	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.d/binary-gcc-cross.mk	2003-02-22 20:57:49.000000000 +0100
@@ -0,0 +1,89 @@
+arch_binaries  := $(arch_binaries) gcc
+
+# gcc must be moved after g77 and g++
+# not all files $(PF)/include/*.h are part of gcc,
+# but it becomes difficult to name all these files ...
+
+dirs_gcc = \
+	$(docdir)/$(p_base)/gcc \
+	$(PF)/bin \
+	$(gcc_lib_dir)/include \
+	$(PF)/share/man/man1 lib
+
+files_gcc = \
+	$(PF)/bin/$(DEB_TARGET_GNU_TYPE)-{gcc,gcov,gccbug} \
+	$(PF)/share/man/man1/$(DEB_TARGET_GNU_TYPE)-{gcc,gcov}.1 \
+	$(gcc_lib_dir)/{collect2,specs,cc1,libgcc*,*.o} \
+	$(gcc_lib_dir)/include/README \
+	$(gcc_lib_dir)/include/{float,iso646,limits,std*,syslimits,varargs}.h \
+	$(shell for d in asm bits gnu linux; do \
+		  test -e $(d)/$(gcc_lib_dir)/include/$$d \
+		    && echo $(gcc_lib_dir)/include/$$d; \
+		done)
+
+files_gcc += \
+	$(shell test -e $(d)/$(gcc_lib_dir)/SYSCALLS.c.X \
+		&& echo $(gcc_lib_dir)/SYSCALLS.c.X)
+
+ifeq ($(DEB_TARGET_ARCH),ia64)
+    files_gcc += $(gcc_lib_dir)/include/ia64intrin.h
+endif
+
+ifeq ($(DEB_TARGET_ARCH),i386)
+    files_gcc += $(gcc_lib_dir)/include/{mmintrin.h,xmmintrin.h}
+endif
+
+ifeq ($(DEB_TARGET_ARCH),hurd-i386)
+    files_gcc += $(gcc_lib_dir)/include/{mmintrin.h,xmmintrin.h}
+endif
+
+ifeq ($(DEB_TARGET_ARCH),m68k)
+    files_gcc += $(gcc_lib_dir)/include/math-68881.h
+endif
+
+ifeq ($(DEB_TARGET_ARCH),powerpc)
+    files_gcc += $(gcc_lib_dir)/include/{altivec.h,ppc-asm.h}
+endif
+
+usr_doc_files = debian/README.Bugs \
+	$(shell test -f $(srcdir)/FAQ && echo $(srcdir)/FAQ)
+ifeq ($(with_check),yes)
+  usr_doc_files += test-summary
+endif
+
+# ----------------------------------------------------------------------
+$(binary_stamp)-gcc: $(install_dependencies)
+	dh_testdir
+	dh_testroot
+	mv $(install_stamp) $(install_stamp)-tmp
+
+	rm -rf $(d_gcc)
+	dh_installdirs -p$(p_gcc) $(dirs_gcc)
+#	$(IS) debian/c89 $(d)/$(PF)/bin/
+#	$(IR) debian/c89.1 $(d)/$(PF)/share/man/man1/
+
+	rm -f $(d)/$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libgcc_s.so
+	ln -sf /usr/$(DEB_TARGET_GNU_TYPE)/lib/libgcc_s.so.$(GCC_SONAME) $(d)/$(gcc_lib_dir)/libgcc_s.so
+
+	mv $(d)/$(PF)/share/man/man1/gcov.1 $(d)/$(PF)/share/man/man1/$(DEB_TARGET_GNU_TYPE)-gcov.1
+
+	dh_movefiles -p$(p_gcc) $(files_gcc)
+
+#	dh_installdebconf
+	debian/dh_doclink -p$(p_gcc) $(p_base)
+	dh_undocumented -p$(p_gcc) gccbug$(gcc_arch)$(pkg_ver).1
+	debian/dh_rmemptydirs -p$(p_gcc)
+	dh_strip -p$(p_gcc)
+	dh_compress -p$(p_gcc)
+	dh_fixperms -p$(p_gcc)
+	dh_shlibdeps -p$(p_gcc)
+	dh_gencontrol -p$(p_gcc) -u-v$(DEB_VERSION)
+	dh_installdeb -p$(p_gcc)
+	dh_md5sums -p$(p_gcc)
+	dh_builddeb -p$(p_gcc)
+
+	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+
+	@echo "Listing installed files not included in any package:"
+	-find $(d) ! -type d
+
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-libgcc-cross.mk gcc-3.2-3.2.3ds0/debian/rules.d/binary-libgcc-cross.mk
--- gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-libgcc-cross.mk	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.d/binary-libgcc-cross.mk	2003-02-22 20:58:12.000000000 +0100
@@ -0,0 +1,55 @@
+arch_binaries  := $(arch_binaries) libgcc
+
+p_lgcc	= libgcc$(GCC_SONAME)$(pkg_arch)
+d_lgcc	= debian/$(p_lgcc)
+
+dirs_lgcc = \
+	$(docdir)/$(p_lgcc) \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib
+
+# 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)
+endif
+
+# ----------------------------------------------------------------------
+$(binary_stamp)-libgcc: $(install_dependencies)
+	dh_testdir
+	dh_testroot
+	mv $(install_stamp) $(install_stamp)-tmp
+
+	rm -rf $(d_lgcc)
+	dh_installdirs -p$(p_lgcc) $(dirs_lgcc)
+
+ifeq ($(with_shared_libgcc),yes)
+	dh_movefiles -p$(p_lgcc) $(files_lgcc)
+endif
+
+	dh_installdocs -p$(p_lgcc)
+	dh_installchangelogs -p$(p_lgcc)
+
+	debian/dh_rmemptydirs -p$(p_lgcc)
+	dh_strip -p$(p_lgcc)
+	dh_compress -p$(p_lgcc)
+	dh_fixperms -p$(p_lgcc)
+ifeq ($(with_shared_libgcc),yes)
+	DH_COMPAT=3 dh_makeshlibs -p$(p_lgcc) \
+		-V '$(p_lgcc) (>= $(DEB_SOVERSION))'
+	cat debian/$(p_lgcc)/DEBIAN/shlibs >> debian/shlibs.local
+endif
+	dh_gencontrol -p$(p_lgcc) -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_lgcc)
+	dh_md5sums -p$(p_lgcc)
+	dh_builddeb -p$(p_lgcc)
+
+	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+
+# ----------------------------------------------------------------------
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-libstdcxx-cross.mk gcc-3.2-3.2.3ds0/debian/rules.d/binary-libstdcxx-cross.mk
--- gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-libstdcxx-cross.mk	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.d/binary-libstdcxx-cross.mk	2003-02-22 20:58:02.000000000 +0100
@@ -0,0 +1,132 @@
+arch_binaries  := $(arch_binaries) libstdcxx
+
+ifeq ($(with_cxxdev),yes)
+  arch_binaries  := $(arch_binaries) libstdcxx-dev
+endif
+
+p_lib	= libstdc++$(CXX_SONAME)$(pkg_arch)
+p_dev	= libstdc++$(CXX_SONAME)$(pkg_arch)-dev
+p_pic	= libstdc++$(CXX_SONAME)$(pkg_arch)-pic
+p_dbg	= libstdc++$(CXX_SONAME)$(pkg_arch)-dbg
+
+d_lib	= debian/$(p_lib)
+d_dev	= debian/$(p_dev)
+d_pic	= debian/$(p_pic)
+d_dbg	= debian/$(p_dbg)
+
+dirs_lib = \
+	$(docdir) \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib
+
+files_lib = $(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libstdc++.so.*
+
+dirs_dev = \
+	$(docdir)/$(p_lib) \
+	$(PF)/share/info \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib \
+	$(gcc_lib_dir)/include \
+	$(cxx_inc_dir)
+
+files_dev = \
+	$(cxx_inc_dir)/ \
+	$(PF)/$(lib_linkdir)/libstdc++.{a,so} \
+	$(gcc_lib_dir)/libsupc++.a
+# Not yet...
+#	$(PF)/lib/lib{supc,stdc}++.la
+
+dirs_dbg = \
+	$(docdir) \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/debug
+files_dbg =
+
+dirs_pic = \
+	$(docdir) \
+	$(gcc_lib_dir)
+files_pic = \
+	$(gcc_lib_dir)/libstdc++_pic.a
+
+# ----------------------------------------------------------------------
+
+$(binary_stamp)-libstdcxx: $(install_stamp)
+	dh_testdir
+	dh_testroot
+	mv $(install_stamp) $(install_stamp)-tmp
+
+	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
+
+	dh_installchangelogs -p$(p_lib)
+	debian/dh_rmemptydirs -p$(p_lib)
+
+	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))'
+	dh_gencontrol -p$(p_lib) -u-v$(DEB_VERSION)
+	dh_installdeb -p$(p_lib)
+	dh_md5sums -p$(p_lib)
+	dh_builddeb -p$(p_lib)
+
+	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
+
+# ----------------------------------------------------------------------
+$(binary_stamp)-libstdcxx-dev: $(install_stamp) \
+    $(binary_stamp)-libstdcxx
+	dh_testdir
+	dh_testroot
+	mv $(install_stamp) $(install_stamp)-tmp
+
+	rm -rf $(d_dev) $(d_pic)
+	dh_installdirs -p$(p_dev) $(dirs_dev)
+	dh_installdirs -p$(p_pic) $(dirs_pic)
+
+	: # - 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/libstdc++_pic.a $(d)/$(gcc_lib_dir)/
+
+	dh_movefiles -p$(p_dev) $(files_dev)
+	dh_movefiles -p$(p_pic) $(files_pic)
+	dh_movefiles -p$(p_dev) $(files_dbg)
+
+	debian/dh_doclink -p$(p_dev) $(p_lib)
+	debian/dh_doclink -p$(p_pic) $(p_lib)
+	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
+
+ifeq ($(with_cxxdev),yes)
+	debian/dh_rmemptydirs -p$(p_dev)
+	debian/dh_rmemptydirs -p$(p_pic)
+	debian/dh_rmemptydirs -p$(p_dbg)
+endif
+
+	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)
+	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)
+
+	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-libstdcxx.mk gcc-3.2-3.2.3ds0/debian/rules.d/binary-libstdcxx.mk
--- gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-libstdcxx.mk	2003-02-22 13:30:28.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.d/binary-libstdcxx.mk	2003-02-22 18:00:57.000000000 +0100
@@ -17,9 +17,6 @@
 d_dbg	= debian/$(p_dbg)
 d_libd	= debian/$(p_libd)
 
-cxx_inc_dir = c++/$(VER)
-cxx_inc_dir = c++/3.2
-
 dirs_lib = \
 	$(docdir) \
 	$(PF)/lib
@@ -31,10 +28,10 @@
 	$(PF)/share/info \
 	$(PF)/lib \
 	$(gcc_lib_dir)/include \
-	$(PF)/include/$(cxx_inc_dir)
+	$(cxx_inc_dir)
 
 files_dev = \
-	$(PF)/include/$(cxx_inc_dir)/ \
+	$(cxx_inc_dir)/ \
 	$(PF)/$(lib_linkdir)/libstdc++.{a,so} \
 	$(gcc_lib_dir)/libsupc++.a
 # Not yet...
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-nof-cross.mk gcc-3.2-3.2.3ds0/debian/rules.d/binary-nof-cross.mk
--- gcc-3.2-3.2.3ds0.orig/debian/rules.d/binary-nof-cross.mk	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.d/binary-nof-cross.mk	2003-02-22 20:54:24.000000000 +0100
@@ -0,0 +1,46 @@
+arch_binaries  := $(arch_binaries) nof
+
+p_nof  = gcc$(pkg_arch)-nof
+d_nof  = debian/$(p_nof)
+
+dirs_nof = \
+	$(docdir) \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/nof
+ifeq ($(with_cdev),yes)
+  dirs_nof += \
+	$(gcc_lib_dir)/nof
+endif
+
+ifeq ($(with_cdev),yes)
+  files_nof = \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libgcc_s_nof.so.$(GCC_SONAME) \
+	$(gcc_lib_dir)/libgcc_s_nof.so \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/nof \
+	$(gcc_lib_dir)/nof
+else
+  files_nof = \
+	lib/libgcc_s_nof.so.$(GCC_SONAME)
+endif
+
+# ----------------------------------------------------------------------
+$(binary_stamp)-nof: $(install_stamp)
+	dh_testdir
+	dh_testroot
+	mv $(install_stamp) $(install_stamp)-tmp
+
+	ln -sf /$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libgcc_s_nof.so.$(GCC_SONAME) \
+		$(d)/$(gcc_lib_dir)/libgcc_s_nof.so
+
+	rm -rf $(d_nof)
+	dh_installdirs -p$(p_nof) $(dirs_nof)
+	dh_movefiles -p$(p_nof) $(files_nof)
+	debian/dh_doclink -p$(p_nof) $(p_base)
+	dh_strip -p$(p_nof)
+	dh_compress -p$(p_nof)
+	dh_fixperms -p$(p_nof)
+	dh_gencontrol -p$(p_nof) -u-v$(DEB_VERSION)
+	dh_installdeb -p$(p_nof)
+	dh_md5sums -p$(p_nof)
+	dh_builddeb -p$(p_nof)
+
+	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.defs gcc-3.2-3.2.3ds0/debian/rules.defs
--- gcc-3.2-3.2.3ds0.orig/debian/rules.defs	2003-02-22 13:30:27.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.defs	2003-02-23 08:45:16.000000000 +0100
@@ -10,12 +10,17 @@
 lib64		= lib64
 
 # architecture dependent variables
+DEB_BUILD_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
 DEB_HOST_ARCH		:= $(shell dpkg-architecture -qDEB_HOST_ARCH)
 DEB_HOST_GNU_CPU	:= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
 DEB_HOST_GNU_SYSTEM	:= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
 DEB_HOST_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
-DEB_BUILD_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_TARGET_ARCH		:= $(shell dpkg-architecture -f -a$(GCC_TARGET) -qDEB_HOST_ARCH 2>/dev/null)
+DEB_TARGET_GNU_CPU	:= $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) -qDEB_HOST_GNU_CPU 2>/dev/null)
+DEB_TARGET_GNU_SYSTEM	:= $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) -qDEB_HOST_GNU_SYSTEM 2>/dev/null)
+DEB_TARGET_GNU_TYPE	:= $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) -qDEB_HOST_GNU_TYPE 2>/dev/null)
 
 # ---------------------------------------------------------------------------
 # which binary packages are built?
@@ -30,53 +35,34 @@
 # assume Linux.  If it *does* contain a '-', we'll *not* make
 # that assumption, and handle it properly in these rules files.
 
-ifeq ($(GCC_TARGET),)
-  TP =
-  TS =
-  DEB_HOST_ALIAS := $(DEB_HOST_GNU_TYPE)
-else
-  ifeq (-,$(findstring -, $(GCC_TARGET)))
-    ifeq (linux,$(findstring linux, $(GCC_TARGET)))
-      DEB_HOST_ARCH := $(shell echo $(GCC_TARGET) | awk -F- '{print $$1}')
-      DEB_HOST_GNU_SYSTEM := linux
-      DEB_HOST_ALIAS := $(DEB_HOST_ARCH)
-    else
-      DEB_HOST_ARCH := $(word 1, $(subst -, , $(GCC_TARGET)))
-      DEB_HOST_GNU_SYSTEM := $(word 2, $(subst -, , $(GCC_TARGET)))
-      DEB_HOST_ALIAS := $(GCC_TARGET)
-    endif
-  else
-    DEB_HOST_ARCH = $(GCC_TARGET)
-    # assume Linux
-    DEB_HOST_GNU_SYSTEM := linux
-    DEB_HOST_ALIAS := $(DEB_HOST_ARCH)
-  endif
-  DEB_HOST_GNU_TYPE = $(DEB_HOST_ARCH)-$(DEB_HOST_GNU_SYSTEM)
+ifneq ($(DEB_HOST_ARCH),$(DEB_TARGET_ARCH))
+  DEB_CROSS = yes
   # TP: Target Prefix. Used primarily as a prefix for cross tool
   #     names (e.g. powerpc-linux-gcc).
   # TS: Target Suffix. Used primarily at the end of cross compiler
   #     package names (e.g. gcc-powerpc).
-  TP = $(DEB_HOST_GNU_TYPE)-
-  TS = -$(DEB_HOST_ALIAS)
+  TP = $(DEB_TARGET_GNU_TYPE)-
+  TS = -$(DEB_TARGET_ARCH)
 endif
 
 printarch:
-	@echo DEB_HOST_ARCH: $(DEB_HOST_ARCH)
-	@echo DEB_HOST_GNU_SYSTEM: $(DEB_HOST_GNU_SYSTEM)
-	@echo DEB_HOST_ALIAS: $(DEB_HOST_ALIAS)
-	@echo GCC_TARGET: $(GCC_TARGET)
+	@echo DEB_TARGET_ARCH: $(DEB_TARGET_ARCH)
+	@echo DEB_TARGET_GNU_SYSTEM: $(DEB_TARGET_GNU_SYSTEM)
 	@echo TP: $(TP)
 	@echo TS: $(TS)
 
 # The name of the source package
 PKGSOURCE := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2;exit 0}')
 
-ifeq ($(GCC_TARGET),)
+ifndef DEB_CROSS
   versioned_packages := yes
-  pkg_ver := -3.2
-  gpc_pkg_ver := -2.1$(pkg_ver)
+else
+  pkg_arch := -$(DEB_TARGET_ARCH)
 endif
 
+pkg_ver := -3.2
+gpc_pkg_ver := -2.1$(pkg_ver)
+
 # Configuration of components
 
 # common things --------------------
@@ -95,12 +81,8 @@
 # Build all packages needed for C++ development
 with_cxxdev := yes
 
-ifeq ($(DEB_HOST_ARCH),avr)
-  with_cxx := disabled for architecture $(DEB_HOST_ARCH)
-  with_cxxdev := $(with_cxx)
-endif
-ifneq ($(GCC_TARGET),)
-  with_cxx := disabled for cross compiler package
+ifeq ($(DEB_TARGET_ARCH),avr)
+  with_cxx := disabled for architecture $(DEB_TARGET_ARCH)
   with_cxxdev := $(with_cxx)
 endif
 ifeq ($(with_cxx),yes)
@@ -120,9 +102,9 @@
 with_cxa_atexit := yes
  
 no_cxa_archs := netbsd-i386
-ifneq ($(DEB_HOST_ARCH),i386)
-  ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),$(no_cxa_archs))) 
-    with_cxa_atexit := disabled for architecture $(DEB_HOST_ARCH)
+ifneq ($(DEB_TARGET_ARCH),i386)
+  ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(no_cxa_archs))) 
+    with_cxa_atexit := disabled for architecture $(DEB_TARGET_ARCH)
   endif
 endif
 
@@ -133,13 +115,13 @@
 with_javadev := yes
 
 no_java_archs := hppa hurd-i386 mips mipsel freebsd-i386 netbsd-i386
-ifneq ($(DEB_HOST_ARCH),i386)
-  ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),$(no_java_archs)))
-    with_java := disabled for architecure $(DEB_HOST_ARCH)
+ifneq ($(DEB_TARGET_ARCH),i386)
+  ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(no_java_archs)))
+    with_java := disabled for architecure $(DEB_TARGET_ARCH)
     with_javadev := $(with_java)
   endif
 endif
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
   with_java := disabled for cross compiler package
   with_javadev := $(with_java)
 endif
@@ -149,7 +131,11 @@
 
 # fastjar -------------------
 ifeq ($(with_common_pkgs),yes)
-  with_fastjar := yes
+  ifdef DEB_CROSS
+    with_fastjava := disabled for cross compiler package
+  else
+    with_fastjar := yes
+  endif
 else
   with_fastjar := no
 endif
@@ -159,12 +145,14 @@
   with_ffi := yes
   no_ffi_archs := hppa mips mipsel hurd-i386 freebsd-i386 netbsd-i386
   ifneq ($(with_java),yes)
-    ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),$(no_ffi_archs)))
-      with_ffi := disabled for architecure $(DEB_HOST_ARCH)
+    ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(no_ffi_archs)))
+      with_ffi := disabled for architecure $(DEB_TARGET_ARCH)
     endif
   endif
+  ifdef DEB_CROSS
+    with_ffi := disabled for cross compiler package
+  endif
 else
-  with_ffi := no
 endif
 
 # Fortran --------------------
@@ -172,7 +160,7 @@
 # Build all packages needed for Fortran development
 with_fdev := yes
 
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
   with_fortran := disabled for cross compiler package
   with_fdev := $(with_fortran)
 endif
@@ -183,7 +171,7 @@
 # protoize --------------------
 ifeq ($(with_common_pkgs),yes)
   with_proto := yes
-  ifneq ($(GCC_TARGET),)
+  ifdef DEB_CROSS
     with_proto := disabled for cross compiler package
   endif
 else
@@ -195,7 +183,7 @@
 
 ifeq ($(with_common_pkgs),yes)
   with_fixincl := yes
-  ifneq ($(GCC_TARGET),)
+  ifdef DEB_CROSS
     with_fixincl := disabled for cross compiler package
   endif
 else
@@ -205,10 +193,10 @@
 # Pascal --------------------
 with_pascal := yes
 # if pascal doesn't build on some target, disable it ...
-ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),sparc))
-  with_pascal := disabled for architecture $(DEB_HOST_ARCH)
+ifeq ($(DEB_TARGET_ARCH),$(findstring $(DEB_TARGET_ARCH),sparc))
+  with_pascal := disabled for architecture $(DEB_TARGET_ARCH)
 endif
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
   with_pascal := disabled for cross compiler package
 endif
 ifeq ($(with_pascal),yes)
@@ -224,9 +212,9 @@
 
 # disable ObjC garbage collection library (needs libgc6)
 libgc6_no_archs := avr freebsd-i386
-ifneq ($(DEB_HOST_ARCH),i386)
-  ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),$(libgc6_no_archs)))
-    with_objc_gc := disabled for architecture $(DEB_HOST_ARCH)
+ifneq ($(DEB_TARGET_ARCH),i386)
+  ifeq ($(DEB_TARGET_ARCH),$(findstring $(DEB_TARGET_ARCH),$(libgc6_no_archs)))
+    with_objc_gc := disabled for architecture $(DEB_TARGET_ARCH)
   endif
 endif
 ifeq ($(with_common_pkgs),yes)
@@ -234,9 +222,10 @@
 else
   with_libobjc := no
 endif
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
   with_objc := disabled for cross compiler package
   with_objcdev := $(with_objc)
+  with_libobjc := $(with_objc)
 endif
 ifeq ($(with_objc),yes)
   enabled_languages += objc
@@ -246,13 +235,13 @@
 with_ada := yes
 with_shared_adalib := no
 ada_no_archs := arm hurd-i386 m68k freebsd-i386 netbsd-i386
-ifneq ($(DEB_HOST_ARCH),i386)
-  ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),$(ada_no_archs)))
-    with_ada := disabled for architecure $(DEB_HOST_ARCH)
+ifneq ($(DEB_TARGET_ARCH),i386)
+  ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(ada_no_archs)))
+    with_ada := disabled for architecure $(DEB_TARGET_ARCH)
   endif
 endif
 #with_ada := not enabled by default
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
   with_ada := disabled for cross compiler package
 endif
 ifeq ($(with_ada),yes)
@@ -263,11 +252,11 @@
 with_check := yes
 # If you don't want to run the gcc testsuite, set `with_check' to `no'
 #with_check := disabled by hand
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
   with_check := disabled for cross compiler package
 endif
-ifeq ($(DEB_HOST_ARCH),hurd-i386)
-  with_check :=disabled for $(DEB_HOST_ARCH)
+ifeq ($(DEB_TARGET_ARCH),hurd-i386)
+  with_check :=disabled for $(DEB_TARGET_ARCH)
 endif
 ifneq ($(WITHOUT_CHECK),)
   with_check := disabled by environment
@@ -284,7 +273,7 @@
 
 biarch := no
 # sparc64 build --------------------
-ifeq ($(DEB_HOST_ARCH),sparc)
+ifeq ($(DEB_TARGET_ARCH),sparc)
   with_sparc64 := yes
   biarch := yes
   # DISABLE temporarily!
@@ -295,16 +284,16 @@
 endif
 
 # s390x build --------------------
-ifeq ($(DEB_HOST_ARCH),s390)
+ifeq ($(DEB_TARGET_ARCH),s390)
   biarch := yes
 endif
 
 # GNU locales
 force_gnu_locales := yes
 locale_no_archs := netbsd-i386
-ifneq ($(DEB_HOST_ARCH),i386)
-  ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),$(locale_no_archs)))
-    force_gnu_locales := disabled for $(DEB_HOST_ARCH)
+ifneq ($(DEB_TARGET_ARCH),i386)
+  ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(locale_no_archs)))
+    force_gnu_locales := disabled for $(DEB_TARGET_ARCH)
   endif
 endif
 
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules.patch gcc-3.2-3.2.3ds0/debian/rules.patch
--- gcc-3.2-3.2.3ds0.orig/debian/rules.patch	2003-02-22 13:30:27.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules.patch	2003-02-22 20:55:09.000000000 +0100
@@ -49,42 +49,42 @@
   debian_patches += gpc-3.x gpc-names libgpc-shared
 endif
 
-ifeq ($(DEB_HOST_ARCH),alpha)
+ifeq ($(DEB_TARGET_ARCH),alpha)
   debian_patches += 
 endif
-ifeq ($(DEB_HOST_ARCH),arm)
+ifeq ($(DEB_TARGET_ARCH),arm)
   debian_patches += arm-libstdc++ arm-tune arm-const-double
 endif
-ifeq ($(DEB_HOST_ARCH),hppa)
+ifeq ($(DEB_TARGET_ARCH),hppa)
   debian_patches +=
 endif
-ifeq ($(DEB_HOST_ARCH),hurd-i386)
+ifeq ($(DEB_TARGET_ARCH),hurd-i386)
   debian_patches +=
 endif
-ifeq ($(DEB_HOST_ARCH),ia64)
+ifeq ($(DEB_TARGET_ARCH),ia64)
   debian_patches += 
 endif
-ifeq ($(DEB_HOST_ARCH),m68k)
+ifeq ($(DEB_TARGET_ARCH),m68k)
   debian_patches += m68k-java-build gcc-m68k-config
 endif
-ifeq ($(DEB_HOST_ARCH),s390)
+ifeq ($(DEB_TARGET_ARCH),s390)
   debian_patches += s390-java s390-ada s390-biarch s390-config-ml
 endif
-ifeq ($(DEB_HOST_ARCH),powerpc)
+ifeq ($(DEB_TARGET_ARCH),powerpc)
   debian_patches += 
 endif
-ifeq ($(DEB_HOST_ARCH),sparc)
+ifeq ($(DEB_TARGET_ARCH),sparc)
   debian_patches += # optimization-9279
 endif
 ifeq ($(with_sparc64),yes)
   debian_patches += sparc64-build
 endif
 
-ifeq ($(DEB_HOST_ARCH),freebsd-i386)
+ifeq ($(DEB_TARGET_ARCH),freebsd-i386)
   debian_patches += freebsd-gnu
 endif
 
-ifeq ($(DEB_HOST_ARCH),netbsd-i386) 
+ifeq ($(DEB_TARGET_ARCH),netbsd-i386) 
   debian_patches += netbsd-dynlinker netbsd-gcc-config 
 endif 
 
diff -urN gcc-3.2-3.2.3ds0.orig/debian/rules2 gcc-3.2-3.2.3ds0/debian/rules2
--- gcc-3.2-3.2.3ds0.orig/debian/rules2	2003-02-22 13:30:27.000000000 +0100
+++ gcc-3.2-3.2.3ds0/debian/rules2	2003-02-23 08:42:18.000000000 +0100
@@ -35,7 +35,7 @@
   CC		 = gcc-2.95
 endif
 
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
   CFLAGS	= $(BOOT_CFLAGS)
 endif
 
@@ -54,21 +54,27 @@
 docdir		= usr/share/doc
 
 # lib_linkdir is the directory for the lib{stdc,g}++.{a,so} links
-lib_linkdir	= lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)
+lib_linkdir	= lib/gcc-lib/$(DEB_TARGET_GNU_TYPE)/$(VER)
 
 # PF is the installation prefix for the package without the leading slash.
 # It's "usr" for gcc releases
 PF = usr
 
-LIBBUILDDIR	= $(DEB_HOST_GNU_TYPE)
-gcc_lib_dir	= $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)
+LIBBUILDDIR	= $(DEB_TARGET_GNU_TYPE)
+gcc_lib_dir	= $(PF)/lib/gcc-lib/$(DEB_TARGET_GNU_TYPE)/$(VER)
+
+ifndef DEB_CROSS
+  cxx_inc_dir	= $(PF)/include/c++/3.2
+else
+  cxx_inc_dir	= $(PF)/$(DEB_TARGET_GNU_TYPE)/include/c++/3.2
+endif
 
 CONFARGS = -v \
 	--enable-languages=$(shell echo $(enabled_languages) | tr -s ' ' ',') \
 	--prefix=/$(PF) \
 	--mandir=/$(PF)/share/man \
 	--infodir=/$(PF)/share/info \
-	--with-gxx-include-dir=/$(PF)/include/$(cxx_inc_dir) \
+	--with-gxx-include-dir=/$(cxx_inc_dir) \
 	--enable-shared \
 	--with-system-zlib \
 	--enable-nls \
@@ -102,17 +108,16 @@
   CONFARGS += --enable-objc-gc
 endif
 
-#ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
+#ifeq ($(DEB_TARGET_GNU_TYPE),sparc-linux)
 #  CONFARGS += --with-cpu=v7
 #endif
 
-ifeq ($(GCC_TARGET),)
-  CONFARGS += $(DEB_HOST_GNU_TYPE)
-else
+ifdef DEB_CROSS
   CONFARGS += \
-	--build=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) \
-	--target=$(DEB_HOST_GNU_TYPE) \
-	$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+	--includedir=/$(PF)/$(DEB_TARGET_GNU_TYPE)/include \
+	--build=$(DEB_BUILD_GNU_TYPE) \
+	--host=$(DEB_HOST_GNU_TYPE) \
+	--target=$(DEB_TARGET_GNU_TYPE)
 endif
 
 # see if we can find a tiny mail program to send the success story
@@ -130,11 +135,11 @@
 	@echo "Version: $(VER)"
 	@echo "Base Debian version: $(DPKGVER)"
 	@echo -e "Configured with: $(foreach i,$(CONFARGS),$(i)\n\t)"
-ifneq ($(GCC_TARGET),)
-	@echo "Building cross compiler for $(GCC_TARGET)"
+ifdef DEB_CROSS
+	@echo "Building cross compiler for $(DEB_TARGET_ARCH)"
 endif
 	@echo "Using shell $(SHELL)"
-	@echo "Architecture: $(DEB_HOST_ARCH) (GNU: $(DEB_HOST_GNU_TYPE))"
+	@echo "Architecture: $(DEB_TARGET_ARCH) (GNU: $(DEB_TARGET_GNU_TYPE))"
 	@echo "CPPFLAGS: $(CPPFLAGS)"
 	@echo "CFLAGS: $(CFLAGS)"
 	@echo "LDFLAGS: $(LDFLAGS)"
@@ -202,7 +207,7 @@
 endif
 	@echo "-----------------------------------------------------------------------------"
 	@echo ""
-ifneq ($(GCC_TARGET),)
+ifdef DEB_CROSS
 	: # check for binutils for target
 endif
 	rm -f $(configure_stamp) $(build_stamp)
@@ -227,7 +232,7 @@
 	cd $(srcdir)/gcc/ada && touch treeprs.ads [es]info.h nmake.ad[bs]
 endif
 
-ifeq ($(GCC_TARGET),)
+ifndef DEB_CROSS
   ifneq ($(with_java),yes)
     ifeq ($(with_fastjar),yes)
 	rm -rf $(builddir)/fastjar
@@ -249,7 +254,7 @@
 $(build_stamp): $(configure_stamp)
 	dh_testdir
 	rm -f bootstrap-protocol
-ifeq ($(GCC_TARGET),)
+ifndef DEB_CROSS
 	: # build native compiler
 	( \
 	  set +e; \
@@ -265,12 +270,11 @@
 	$(MAKE) -C $(builddir)/fastjar
   endif
 else
-	: # build cross compiler for $(DEB_HOST_GNU_TYPE)
+	: # build cross compiler for $(DEB_TARGET_GNU_TYPE)
 	( \
 	  set +e; \
 	  PATH=$(PWD)/bin:$$PATH \
 	    $(MAKE) -C $(builddir) \
-		LANGUAGES="$(shell echo $(enabled_languages)|tr -s ' ' ',')" \
 		CC="$(CC)" CFLAGS="$(CFLAGS)" \
 		BOOT_CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(LDFLAGS)" \
 		STAGE1_CFLAGS="$(STAGE1_CFLAGS)"; \
@@ -312,7 +316,7 @@
 	debian/locale-gen
 
 # start the script only on architectures known to be slow ...
-ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),arm m68k))
+ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),arm m68k))
 	: # start logwatch script for regular output during test runs
 	chmod +x debian/logwatch.sh
 	-debian/logwatch.sh -t 1800 -p $(builddir)/logwatch.pid \
@@ -324,7 +328,7 @@
 		&
 endif
 
-ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
+ifeq ($(DEB_TARGET_GNU_SYSTEM),linux)
 	-echo "Running testsuite ..."; \
 	  if [ -e /proc/meminfo ]; then \
 	    m=`awk '/^((Mem|Swap)Free|Cached)/{m+=$$2}END{print int(m*.9)}' \
@@ -434,7 +438,7 @@
 # p_XXX is the package name, d_XXX is the package directory
 # these macros are only used in the binary-* targets.
 
-ifeq ($(GCC_TARGET),)
+ifndef DEB_CROSS
   p_base = gcc$(pkg_ver)-base
   p_gcc  = gcc$(pkg_ver)
   p_cpp  = cpp$(pkg_ver)
@@ -442,7 +446,9 @@
   p_cxx  = g++$(pkg_ver)
   p_doc  = gcc$(pkg_ver)-doc
 else
-  p_gcc  = gcc$(pkg_var)-$(GCC_TARGET)
+  p_gcc  = gcc$(pkg_arch)
+  p_cpp  = cpp$(pkg_arch)
+  p_cxx  = g++$(pkg_arch)
 endif
 
 d	= debian/tmp
@@ -455,7 +461,7 @@
 
 # ---------------------------------------------------------------------------
 
-ifeq ($(GCC_TARGET),)
+ifndef DEB_CROSS
 # ----------------------------------------
 # native target
 
@@ -514,15 +520,10 @@
   include debian/rules.d/binary-pascal.mk
 endif
 
-ifeq ($(DEB_HOST_ARCH),powerpc)
+ifeq ($(DEB_TARGET_ARCH),powerpc)
   include debian/rules.d/binary-nof.mk
 endif
 
-# disabled -- philb 2001-05-06
-#ifeq ($(DEB_HOST_ARCH),arm)
-#  include debian/rules.d/binary-softfloat.mk
-#endif
-
 # gcc must be moved/built after g77 and g++
 ifeq ($(with_cdev),yes)
   include debian/rules.d/binary-gcc.mk
@@ -532,7 +533,25 @@
 # ----------------------------------------
 # cross target
 
-include debian/rules.d/binary-cross.mk
+ifeq ($(with_libgcc),yes)
+  include debian/rules.d/binary-libgcc-cross.mk
+endif
+
+ifeq ($(with_cxxdev),yes)
+  include debian/rules.d/binary-cxx-cross.mk
+endif
+ifeq ($(with_cxx),yes)
+  include debian/rules.d/binary-libstdcxx-cross.mk
+endif
+
+ifeq ($(DEB_TARGET_ARCH),powerpc)
+  include debian/rules.d/binary-nof-cross.mk
+endif
+
+ifeq ($(with_cdev),yes)
+  include debian/rules.d/binary-gcc-cross.mk
+endif
+
 endif
 
 # ----------------------------------------------------------------------
@@ -547,14 +566,14 @@
 
 ifeq ($(with_java),yes)
 	: # a "fix"
-	[ -f $(builddir)/$(DEB_HOST_GNU_TYPE)/boehm-gc/.libs/libgcjgc.lai ] \
+	[ -f $(builddir)/$(DEB_TARGET_GNU_TYPE)/boehm-gc/.libs/libgcjgc.lai ] \
 	  || sed -e 's/^installed=no/installed=yes/' \
-	       $(builddir)/$(DEB_HOST_GNU_TYPE)/boehm-gc/libgcjgc.la \
-	       > $(builddir)/$(DEB_HOST_GNU_TYPE)/boehm-gc/.libs/libgcjgc.lai
-	[ -f $(builddir)/$(DEB_HOST_GNU_TYPE)/libjava/.libs/libgcj.lai ] \
+	       $(builddir)/$(DEB_TARGET_GNU_TYPE)/boehm-gc/libgcjgc.la \
+	       > $(builddir)/$(DEB_TARGET_GNU_TYPE)/boehm-gc/.libs/libgcjgc.lai
+	[ -f $(builddir)/$(DEB_TARGET_GNU_TYPE)/libjava/.libs/libgcj.lai ] \
 	  || sed -e 's/^installed=no/installed=yes/' \
-	       $(builddir)/$(DEB_HOST_GNU_TYPE)/libjava/libgcj.la \
-	       > $(builddir)/$(DEB_HOST_GNU_TYPE)/libjava/.libs/libgcj.lai
+	       $(builddir)/$(DEB_TARGET_GNU_TYPE)/libjava/libgcj.la \
+	       > $(builddir)/$(DEB_TARGET_GNU_TYPE)/libjava/.libs/libgcj.lai
 endif
 
 	: # Install directories
@@ -574,7 +593,7 @@
 	    prefix=$(PWD)/$(d)/$(PF) \
 	    infodir=$(PWD)/$(d)/$(PF)/share/info \
 	    mandir=$(PWD)/$(d)/$(PF)/share/man \
-	    gxx_include_dir=$(PWD)/$(d)/$(PF)/include/$(cxx_inc_dir) \
+	    gxx_include_dir=$(PWD)/$(d)/$(cxx_inc_dir) \
 		install
 
 # wondering, why this is necessary, the installation of the gnat tools
@@ -591,7 +610,7 @@
 	    prefix=$(PWD)/$(d)/$(PF) \
 	    infodir=$(PWD)/$(d)/$(PF)/share/info \
 	    mandir=$(PWD)/$(d)/$(PF)/share/man \
-	    gxx_include_dir=$(PWD)/$(d)/$(PF)/include/$(cxx_inc_dir) \
+	    gxx_include_dir=$(PWD)/$(d)/$(cxx_inc_dir) \
 		ada.install-common
 endif
 
@@ -606,10 +625,6 @@
   endif
 endif
 
-	: # Adjust installation such that we can begin moving things around:
-
-	chmod 755 $(d)/$(PF)/bin/gccbug
-
 ifeq ($(versioned_packages),yes)
 	: # rename files (versioned binaries)
 	for i in cpp gcc gccbug gcov g++; do \

Attachment: pgpp8k45nv1Tp.pgp
Description: PGP signature


Reply to: