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

Bug#251293: Portability fixes.



Package: gcc-3.4
Version: 3.4.0-2
Severity: wishlist
Tags: patch

I'm attaching the fixes required in debian/ directory needed to make this
package portable wrt non-Linux kernels. It splits out every unportable
check into separate checks for _CPU and _SYSTEM, and a few other things.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.26-1-k7
Locale: LANG=C, LC_CTYPE=C
diff -Nur gcc-3.4-3.4.0/debian/control.m4 gcc-3.4-3.4.0+kbsd/debian/control.m4
--- gcc-3.4-3.4.0/debian/control.m4	2004-05-27 15:13:23.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/control.m4	2004-05-27 15:12:46.000000000 +0200
@@ -38,7 +38,7 @@
 ifdef(`TARGET',`dnl cross
 Build-Depends: LIBC_BUILD_DEP, m4, autoconf2.13, automake1.7, libtool, autotools-dev, gawk, dpkg-cross, binutils`'TS
 ',`dnl native
-Build-Depends: LIBC_BUILD_DEP, libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], 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], gcc-2.95 [m68k], procps [check_no_archs], help2man [pascal_no_archs], sharutils, libgtk2.0-dev [java_no_archs], libart-2.0-dev [java_no_archs], g++-3.3, g77-3.3, gobjc-3.3
+Build-Depends: LIBC_BUILD_DEP, libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], m4, autoconf2.13, autoconf, automake1.4, automake1.7, libtool, autotools-dev, gawk, check_no_archs dejagnu (>= 1.4.3), check_no_archs expect (>= 5.38.0), 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_no_archs libgc-dev, xlibs-dev, ada_no_archs gnat-3.3 | gnat-3.4 | gnat [i386 powerpc sparc], pascal_no_archs libncurses5-dev, libgmp3-dev, pascal_no_archs tetex-bin, locale_no_archs locales, gcc-2.95 [m68k], not+linux-gnu | procps, pascal_no_archs help2man, sharutils, java_no_archs libgtk2.0-dev, java_no_archs libart-2.0-dev, g++-3.3, g77-3.3, gobjc-3.3
 Build-Depends-Indep: doxygen (>= 1.3.7)
 ')dnl
 
@@ -113,7 +113,7 @@
 Section: devel
 Priority: ifdef(`TARGET',`extra',`PRI(standard)')
 Depends: gcc`'PV-base, libgcc`'GCC_SO`'LS (>= ifelse(GCC_SO,1,CEV,CV)), ${shlibs:Depends}, ifdef(`TARGET',`',`cpp`'PV (>= CV), cpp`'PV (<< NV)'), binutils`'TS (>= BINUTILSV)
-Recommends: ifdef(`TARGET',`libc6-dev`'LS',`LIBC_DEP')
+Recommends: ifdef(`TARGET',`libc-dev`'LS',`LIBC_DEP')
 Conflicts: gcc-3.2 (<= 1:3.2.3-0pre8)
 Suggests: gcc`'PV-doc (>= CV)
 Provides: c-compiler`'TS
diff -Nur gcc-3.4-3.4.0/debian/rules.conf gcc-3.4-3.4.0+kbsd/debian/rules.conf
--- gcc-3.4-3.4.0/debian/rules.conf	2004-05-27 15:13:23.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules.conf	2004-05-27 15:12:46.000000000 +0200
@@ -15,24 +15,26 @@
 
 # libc-dev dependencies
 libc_ver := 2.3.2.ds1-12
-ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),alpha ia64))
-  LIBC_DEP = libc6.1-dev (>= $(libc_ver))
-else
-  ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
-    LIBC_DEP = libc0.3-dev
+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))
   else
-    ifeq ($(DEB_TARGET_GNU_SYSTEM),freebsd)
-      LIBC_DEP = libc1-dev
-    else
-      ifeq ($(DEB_TARGET_ARCH),netbsd-i386)
-        LIBC_DEP = libc12-dev
-      else
-        LIBC_DEP = libc6-dev (>= $(libc_ver))
-      endif
-    endif
+    LIBC_DEP = libc6-dev (>= $(libc_ver))
   endif
 endif
-LIBC_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))
+ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
+  LIBC_DEP = libc0.3-dev
+endif
+ifeq ($(DEB_TARGET_GNU_SYSTEM),kfreebsd-gnu)
+  LIBC_DEP = libc0.1-dev
+endif
+ifeq ($(DEB_TARGET_GNU_SYSTEM),knetbsd-gnu)
+  LIBC_DEP = libc0.1-dev
+endif
+ifeq ($(DEB_TARGET_GNU_SYSTEM),netbsd-elf-gnu)
+  LIBC_DEP = libc12-dev
+endif
+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))
 
 SOURCE_VERSION := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$NF}')
 DEB_VERSION := $(shell echo $(SOURCE_VERSION) \
@@ -61,7 +63,7 @@
 DEB_STDCXX_SOVERSION := $(DEB_SOVERSION)
 
 # manual ...
-ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),hppa m68k))
+ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),hppa m68k))
   GCC_SONAME := 2
   DEB_LIBGCC_SOVERSION := $(DEB_SOVERSION)
   DEB_LIBGCC_VERSION := $(DEB_VERSION)
@@ -158,12 +160,12 @@
 	  -DGNAT_V=$(GNAT_VERSION) \
 	  -DFFI_SO=$(FFI_SONAME) \
 	  -Denabled_languages="$(languages) $(addons)" \
-	  -Dada_no_archs="$(foreach arch,$(ada_no_archs),!$(arch))" \
-	  -Djava_no_archs="$(foreach arch,$(java_no_archs),!$(arch))" \
-	  -Dpascal_no_archs="$(foreach arch,$(pascal_no_archs),!$(arch))" \
-	  -Dlibgc_no_archs="$(foreach arch,$(libgc_no_archs),!$(arch))" \
-	  -Dcheck_no_archs="$(foreach arch,$(check_no_archs),!$(arch))" \
-	  -Dlocale_no_archs="$(foreach arch,$(locale_no_archs) $(check_no_archs),!$(arch))" \
+	  -Dada_no_archs="$(foreach arch,$(ada_no_cpus) $(ada_no_systems),$(arch)|)" \
+	  -Djava_no_archs="$(foreach arch,$(java_no_cpus) $(java_no_systems),$(arch)|)" \
+	  -Dpascal_no_archs="$(foreach arch,$(pascal_no_cpus) $(pascal_no_systems),$(arch)|)" \
+	  -Dlibgc_no_archs="$(foreach arch,$(libgc_no_cpus) $(libgc_no_systems),$(arch)|)" \
+	  -Dcheck_no_archs="$(foreach arch,$(check_no_cpus) $(check_no_systems),$(arch)|)" \
+	  -Dlocale_no_archs="$(foreach arch,$(locale_no_cpus) $(locale_no_systems),$(arch)|)" \
 		debian/control.m4 > debian/control.tmp2
 	uniq debian/control.tmp2 > debian/control.tmp
 	rm -f debian/control.tmp2
diff -Nur gcc-3.4-3.4.0/debian/rules.d/binary-ada.mk gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-ada.mk
--- gcc-3.4-3.4.0/debian/rules.d/binary-ada.mk	2004-05-27 15:13:20.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-ada.mk	2004-05-27 15:12:43.000000000 +0200
@@ -17,7 +17,7 @@
 
 GNAT_TOOLS = gnat gnatbind gnatbl gnatchop gnatfind gnatkr gnatlink \
 		gnatls gnatmake gnatname gnatprep gnatxref
-#ifneq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),mips mipsel))
+#ifneq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),mips mipsel))
 #  GNAT_TOOLS += gnatpsta
 #endif
 
diff -Nur gcc-3.4-3.4.0/debian/rules.d/binary-fortran.mk gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-fortran.mk
--- gcc-3.4-3.4.0/debian/rules.d/binary-fortran.mk	2004-05-27 15:13:20.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-fortran.mk	2004-05-27 15:12:43.000000000 +0200
@@ -100,7 +100,7 @@
 #	mv $(d)/$(PF)/lib/libfrtbegin.a $(d)/$(gcc_lib_dir)/
 
 #ifeq ($(biarch),yes)
-#  ifeq ($(DEB_TARGET_ARCH),i386)
+#  ifeq ($(DEB_TARGET_GNU_CPU),i386)
 #	mv $(d)/$(PF)/$(lib64)/libg2c.{a,la,so} $(d)/$(gcc_lib_dir)/64
 #	ln -sf ../../../../lib64/libg2c.so.$(F77_SONAME) \
 #		$(d)/$(gcc_lib_dir)/64/libg2c.so
diff -Nur gcc-3.4-3.4.0/debian/rules.d/binary-gcc-cross.mk gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-gcc-cross.mk
--- gcc-3.4-3.4.0/debian/rules.d/binary-gcc-cross.mk	2004-05-27 15:13:20.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-gcc-cross.mk	2004-05-27 15:12:43.000000000 +0200
@@ -25,23 +25,19 @@
 	$(shell test -e $(d)/$(gcc_lib_dir)/SYSCALLS.c.X \
 		&& echo $(gcc_lib_dir)/SYSCALLS.c.X)
 
-ifeq ($(DEB_TARGET_ARCH),ia64)
+ifeq ($(DEB_TARGET_GNU_CPU),ia64)
     files_gcc += $(gcc_lib_dir)/include/ia64intrin.h
 endif
 
-ifeq ($(DEB_TARGET_ARCH),i386)
+ifeq ($(DEB_TARGET_GNU_CPU),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)
+ifeq ($(DEB_TARGET_GNU_CPU),m68k)
     files_gcc += $(gcc_lib_dir)/include/math-68881.h
 endif
 
-ifeq ($(DEB_TARGET_ARCH),powerpc)
+ifeq ($(DEB_TARGET_GNU_CPU),powerpc)
     files_gcc += $(gcc_lib_dir)/include/{altivec.h,ppc-asm.h}
 endif
 
diff -Nur gcc-3.4-3.4.0/debian/rules.d/binary-libgcc.mk gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-libgcc.mk
--- gcc-3.4-3.4.0/debian/rules.d/binary-libgcc.mk	2004-05-27 15:13:20.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-libgcc.mk	2004-05-27 15:12:43.000000000 +0200
@@ -88,7 +88,7 @@
 # this does not work ... shlibs.local doesn't distinguish 32/64 bit libs
 #	cat debian/$(p_l64gcc)/DEBIAN/shlibs >> debian/shlibs.local
 endif
-ifeq ($(DEB_TARGET_ARCH),s390)
+ifeq ($(DEB_TARGET_GNU_CPU),s390)
 #	dh_shlibdeps -p$(p_l64gcc)
 #/usr/bin/ldd: line 1: /lib/ld64.so.1: cannot execute binary file
 #dpkg-shlibdeps: failure: ldd on `debian/lib64gcc1/lib64/libgcc_s.so.1' gave error exit status 1
diff -Nur gcc-3.4-3.4.0/debian/rules.d/binary-libstdcxx.mk gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-libstdcxx.mk
--- gcc-3.4-3.4.0/debian/rules.d/binary-libstdcxx.mk	2004-05-27 15:13:20.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules.d/binary-libstdcxx.mk	2004-05-27 15:12:43.000000000 +0200
@@ -172,7 +172,7 @@
 	DH_COMPAT=3 dh_makeshlibs -p$(p_lib64) \
 		-V '$(p_lib64) (>= $(DEB_STDCXX_SOVERSION))'
 # pass explicit dependencies to dh_shlibdeps
-ifeq ($(DEB_TARGET_ARCH),s390)
+ifeq ($(DEB_TARGET_GNU_CPU),s390)
 #	dh_shlibdeps -p$(p_lib64) -L $(p_l64gcc) -l $(d_l64gcc)/lib
 #/usr/bin/ldd: line 1: /lib/ld64.so.1: cannot execute binary file
 #dpkg-shlibdeps: failure: ldd on `debian/lib64gcc1/lib64/libgcc_s.so.1' gave error exit status 1
diff -Nur gcc-3.4-3.4.0/debian/rules.defs gcc-3.4-3.4.0+kbsd/debian/rules.defs
--- gcc-3.4-3.4.0/debian/rules.defs	2004-05-27 15:13:23.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules.defs	2004-05-27 15:20:14.000000000 +0200
@@ -32,24 +32,15 @@
 
 # cross compiler support. If GCC_TARGET is set, then it's the architecture
 # we build for.
-#
-# Note: This scheme assumes targets are *-linux.  At some point
-# in the future I'd like to work on generalizing this to allow
-# for non-linux targets.  My thought is that when specifying
-# target names in GCC_TARGET, if it doesn't contain a '-', we'll
-# assume Linux.  If it *does* contain a '-', we'll *not* make
-# that assumption, and handle it properly in these rules files.
 
-ifneq ($(DEB_HOST_ARCH),$(DEB_TARGET_ARCH))
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE))
   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_TARGET_GNU_TYPE)-
-ifeq ($(DEB_TARGET_ALIAS),)
-DEB_TARGET_ALIAS := $(DEB_TARGET_GNU_TYPE)
-endif
+  DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
   TS = -$(DEB_TARGET_ALIAS)
 endif
 
@@ -64,13 +55,16 @@
   ifeq ($(TARGET_ALIAS),i386-gnu)
     TARGET_ALIAS := i586-gnu
   endif
-  ifeq ($(TARGET_ALIAS),i386-freebsd-gnu)
-    TARGET_ALIAS := i486-freebsd-gnu
+  ifeq ($(TARGET_ALIAS),i386-kfreebsd-gnu)
+    TARGET_ALIAS := i486-kfreebsd-gnu
+  endif
+  ifeq ($(TARGET_ALIAS),i386-knetbsd-gnu)
+    TARGET_ALIAS := i486-knetbsd-gnu
   endif
 endif
 
 printarch:
-	@echo DEB_TARGET_ARCH: $(DEB_TARGET_ARCH)
+	@echo DEB_TARGET_GNU_CPU: $(DEB_TARGET_GNU_CPU)
 	@echo DEB_TARGET_GNU_SYSTEM: $(DEB_TARGET_GNU_SYSTEM)
 	@echo GCC_TARGET: $(GCC_TARGET)
 	@echo TP: $(TP)
@@ -102,15 +96,15 @@
 with_common_libs := yes
 
 #no_common_libs := s390
-#ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(no_common_libs)))
+#ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(no_common_libs)))
 #  with_common_libs := no
 #endif
 
 with_dev := yes
 
-#no_dummy_archs := ia64 i386 hppa s390 sparc
+#no_dummy_cpus := ia64 i386 hppa s390 sparc
 #with_base_only := yes
-#ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(no_dummy_archs)))
+#ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(no_dummy_cpus)))
 #  with_base_only := no
 #  with_common_libs := yes
 #  with_common_pkgs := yes
@@ -139,9 +133,9 @@
 else
   with_cxx := yes
 endif
-no_cxx_archs := avr
-ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(no_cxx_archs)))
-  with_cxx := disabled for architecture $(DEB_TARGET_ARCH)
+no_cxx_cpus := avr
+ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(no_cxx_cpus)))
+  with_cxx := disabled for architecture $(DEB_TARGET_GNU_CPU)
 endif
 ifeq (c++, $(findstring c++,$(WITHOUT_LANG)))
   with_cxx := disabled by environment
@@ -159,7 +153,7 @@
 
 ifeq ($(with_common_pkgs)-$(with_cxx),yes-yes)
   with_libcxx := yes
-#  ifeq ($(DEB_TARGET_ARCH),arm)
+#  ifeq ($(DEB_TARGET_GNU_CPU),arm)
 #    with_libcxx := no
 #  endif
 else
@@ -172,9 +166,9 @@
 else
   with_debug := no
 endif
-debug_no_archs :=
-ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(debug_no_archs)))
-    with_debug := disabled for architecure $(DEB_TARGET_ARCH)
+debug_no_cpus :=
+ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(debug_no_cpus)))
+    with_debug := disabled for architecure $(DEB_TARGET_GNU_CPU)
 endif
 
 
@@ -182,11 +176,9 @@
 # The __cxa_atexit API does not exist in some libc version (NetBSD)
 with_cxa_atexit := yes
 
-no_cxa_archs := netbsd-i386
-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
+no_cxa_systems := netbsd-elf-gnu
+ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(no_cxa_systems)))
+  with_cxa_atexit := disabled for $(DEB_TARGET_GNU_SYSTEM)
 endif
 
 # Java --------------------
@@ -197,11 +189,9 @@
   with_java := yes
 endif
 
-java_no_archs := hurd-i386 freebsd-i386 netbsd-i386
-ifneq ($(DEB_TARGET_ARCH),i386)
-  ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(java_no_archs)))
-    with_java := disabled for architecure $(DEB_TARGET_ARCH)
-  endif
+java_no_systems := gnu kfreebsd-gnu knetbsd-gnu netbsd-elf-gnu
+ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(java_no_systems)))
+  with_java := disabled for $(DEB_TARGET_GNU_SYSTEM)
 endif
 ifdef DEB_CROSS
   with_java := disabled for cross compiler package
@@ -230,7 +220,7 @@
 endif
 
 # fastjar -------------------
-ifeq ($(with_common_pkgs),yes)
+ifeq ($(with_common_pkgs)-$(with_java),yes-yes)
   ifdef DEB_CROSS
     with_fastjar := disabled for cross compiler package
   else
@@ -243,10 +233,14 @@
 # libffi -------------------
 ifeq ($(with_common_libs),yes)
   with_libffi := yes
-  no_ffi_archs := mips mipsel hurd-i386 freebsd-i386 netbsd-i386
+  no_ffi_cpus := mips mipsel
+  no_ffi_systems := gnu kfreebsd-gnu knetbsd-gnu netbsd-elf-gnu
   ifneq ($(with_java),yes)
-    ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(no_ffi_archs)))
-      with_libffi := disabled for architecure $(DEB_TARGET_ARCH)
+    ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(no_ffi_cpus)))
+      with_libffi := disabled for architecure $(DEB_TARGET_GNU_CPU)
+    endif
+    ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(no_ffi_systems)))
+      with_libffi := disabled for $(DEB_TARGET_GNU_SYSTEM)
     endif
     endif
   ifdef DEB_CROSS
@@ -314,15 +308,13 @@
   with_pascal := no
 endif
 
-pascal_no_archs := netbsd-i386
-ifneq ($(DEB_TARGET_ARCH),i386)
-  ifeq ($(DEB_TARGET_ARCH),$(findstring $(DEB_TARGET_ARCH),$(pascal_no_archs)))
-    with_pascal := disabled for architecture $(DEB_TARGET_ARCH)
-  endif
+pascal_no_systems := netbsd-elf-gnu
+ifeq ($(DEB_TARGET_GNU_SYSTEM),$(findstring $(DEB_TARGET_GNU_SYSTEM),$(pascal_no_systems)))
+  with_pascal := disabled for $(DEB_TARGET_GNU_SYSTEM)
 endif
 with_gpidump := yes
-ifeq ($(DEB_TARGET_ARCH),$(findstring $(DEB_TARGET_ARCH),mips mipsel))
-  with_gpidump := disabled for architecture $(DEB_TARGET_ARCH)
+ifeq ($(DEB_TARGET_GNU_CPU),$(findstring $(DEB_TARGET_GNU_CPU),mips mipsel))
+  with_gpidump := disabled for architecture $(DEB_TARGET_GNU_CPU)
 endif
 pascal_version := 20030830
 ifeq (pascal, $(findstring pascal,$(WITHOUT_LANG)))
@@ -345,11 +337,13 @@
 with_objc_gc := yes
 
 # disable ObjC garbage collection library (needs libgc)
-libgc_no_archs := avr freebsd-i386
-ifneq ($(DEB_TARGET_ARCH),i386)
-  ifeq ($(DEB_TARGET_ARCH),$(findstring $(DEB_TARGET_ARCH),$(libgc_no_archs)))
-    with_objc_gc := disabled for architecture $(DEB_TARGET_ARCH)
-  endif
+libgc_no_cpus := avr
+libgc_no_systems := kfreebsd-gnu knetbsd-gnu
+ifeq ($(DEB_TARGET_GNU_CPU),$(findstring $(DEB_TARGET_GNU_CPU),$(libgc_no_cpus)))
+  with_objc_gc := disabled for architecture $(DEB_TARGET_GNU_CPU)
+endif
+ifeq ($(DEB_TARGET_GNU_SYSTEM),$(findstring $(DEB_TARGET_GNU_SYSTEM),$(libgc_no_systems)))
+  with_objc_gc := disabled for $(DEB_TARGET_GNU_SYSTEM)
 endif
 with_objc_gc := disabled for gcc-3.4
 ifdef DEB_CROSS
@@ -386,11 +380,13 @@
 endif
 
 with_libgnat := yes
-ada_no_archs := amd64 arm hurd-i386 m68k freebsd-i386 netbsd-i386
-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
+ada_no_cpus := x86_64 arm m68k
+ada_no_systems := gnu kfreebsd-gnu knetbsd-gnu netbsd-elf-gnu
+ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(ada_no_cpus)))
+  with_ada := disabled for architecure $(DEB_TARGET_GNU_CPU)
+endif
+ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(ada_no_systems)))
+  with_ada := disabled for $(DEB_TARGET_GNU_SYSTEM)
 endif
 ifeq (ada, $(findstring ada,$(WITHOUT_LANG)))
   with_ada := disabled by environment
@@ -400,15 +396,15 @@
 endif
 
 # needed for 3.4 on alpha and hppa, but not for release tarballs
-#ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),alpha hppa))
+#ifeq ($(DEB_HOST_GNU_CPU),$(findstring $(DEB_HOST_GNU_CPU),alpha hppa))
 #  with_ada_bootstrap_workaround := yes
 #endif
 
 ifeq ($(with_ada),yes)
   enabled_languages += ada
-  libada_no_archs := alpha mips mipsel powerpc s390 sparc
-  ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(libada_no_archs)))
-    with_libgnat := disabled for architecure $(DEB_TARGET_ARCH)
+  libada_no_cpus := alpha mips mipsel powerpc s390 sparc
+  ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(libada_no_cpus)))
+    with_libgnat := disabled for architecure $(DEB_TARGET_GNU_CPU)
   endif
 else
   with_libgnat := $(with_ada)
@@ -424,9 +420,9 @@
     with_treelang := no
   endif
 endif
-tl_no_archs := powerpc
-ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(tl_no_archs)))
-    with_treelang := disabled for architecure $(DEB_TARGET_ARCH)
+tl_no_cpus := powerpc
+ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(tl_no_cpus)))
+    with_treelang := disabled for architecure $(DEB_TARGET_GNU_CPU)
 endif
 ifdef DEB_CROSS
   with_treelang := disabled for cross compiler package
@@ -459,11 +455,9 @@
 ifdef DEB_CROSS
   with_check := disabled for cross compiler package
 endif
-check_no_archs := hurd-i386
-ifneq ($(DEB_TARGET_ARCH),i386)
-  ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(check_no_archs)))
-    with_check :=disabled for $(DEB_TARGET_ARCH)
-  endif
+check_no_systems := gnu kfreebsd-gnu knetbsd-gnu
+ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems)))
+  with_check := disabled for $(DEB_TARGET_GNU_SYSTEM)
 endif
 ifneq ($(WITHOUT_CHECK),)
   with_check := disabled by environment
@@ -482,7 +476,7 @@
 with_lib64g2c	:= no
 
 # i386/x86_64 build
-ifeq ($(DEB_TARGET_ARCH),XXXi386-XXX)
+ifeq ($(DEB_TARGET_GNU_CPU),XXXi386-XXX)
   biarch := yes
   with_lib64gcc	:= yes
   with_lib64cxx	:= yes
@@ -490,19 +484,19 @@
 
 # hppa64 build --------------------
 with_hppa64 := no
-ifeq ($(DEB_TARGET_ARCH),hppa)
+ifeq ($(DEB_TARGET_GNU_CPU),hppa)
   with_hppa64 := yes
 endif
 
 # sparc64 build --------------------
-#ifeq ($(DEB_TARGET_ARCH),sparc)
+#ifeq ($(DEB_TARGET_GNU_CPU),sparc)
 #  biarch := yes
 #  with_lib64gcc	:= yes
 #  with_lib64cxx	:= yes
 #endif
 
 # s390x build --------------------
-ifeq ($(DEB_TARGET_ARCH),s390)
+ifeq ($(DEB_TARGET_GNU_CPU),s390)
   biarch := yes
   with_lib64gcc	:= yes
   with_lib64cxx	:= yes
@@ -510,11 +504,9 @@
 
 # GNU locales
 force_gnu_locales := yes
-locale_no_archs := netbsd-i386
-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
+locale_no_systems := kfreebsd-gnu knetbsd-gnu netbsd-elf-gnu
+ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(locale_no_systems)))
+  force_gnu_locales := disabled for $(DEB_TARGET_GNU_SYSTEM)
 endif
 
 unpack_stamp		:= $(stampdir)/01-unpack-stamp
diff -Nur gcc-3.4-3.4.0/debian/rules.patch gcc-3.4-3.4.0+kbsd/debian/rules.patch
--- gcc-3.4-3.4.0/debian/rules.patch	2004-05-27 15:13:23.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules.patch	2004-05-27 15:12:46.000000000 +0200
@@ -57,44 +57,49 @@
   endif
 endif
 
-ifeq ($(DEB_TARGET_ARCH),alpha)
-  debian_patches += # alpha-ieee
+ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
+  debian_patches += hurd-changes
 endif
-ifneq (,$(findstring $(DEB_TARGET_ARCH),i386))
-  debian_patches += cpu-default-i486
+
+ifeq ($(DEB_TARGET_GNU_CPU),alpha)
+  debian_patches += # alpha-ieee
 endif
-ifeq ($(DEB_TARGET_ARCH),hurd-i386)
-  debian_patches += hurd-changes cpu-default-i586
+ifeq ($(DEB_TARGET_GNU_CPU),i386)
+  ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
+    debian_patches += cpu-default-i586
+  else
+    debian_patches += cpu-default-i486
+  endif
 endif
-ifeq ($(DEB_TARGET_ARCH),ia64)
+ifeq ($(DEB_TARGET_GNU_CPU),ia64)
   debian_patches +=
 endif
-ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),mips mipsel))
+ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),mips mipsel))
   debian_patches += libffi-mips libjava-mips
 endif
-ifeq ($(DEB_TARGET_ARCH)-$(biarch),i386-yes)
+ifeq ($(DEB_TARGET_GNU_CPU)-$(biarch),i386-yes)
   debian_patches += # i386-biarch
 endif
-ifeq ($(DEB_TARGET_ARCH),powerpc)
+ifeq ($(DEB_TARGET_GNU_CPU),powerpc)
   debian_patches += #powerpc-biarch
 endif
-ifeq ($(DEB_TARGET_ARCH)-$(biarch),s390-yes)
+ifeq ($(DEB_TARGET_GNU_CPU)-$(biarch),s390-yes)
   debian_patches += s390-biarch s390-config-ml #s390-nonlocal-goto s390-ifcvt
 endif
-ifeq ($(DEB_TARGET_ARCH),sparc)
+ifeq ($(DEB_TARGET_GNU_CPU),sparc)
   ifeq ($(biarch),yes)
     debian_patches += sparc64-build sparc-config-ml
   endif
 endif
 
-ifeq ($(DEB_TARGET_ARCH),freebsd-i386)
-  debian_patches += cpu-default-i486
+ifeq ($(DEB_TARGET_GNU_SYSTEM),kfreebsd-gnu)
+  debian_patches += kbsd-gnu
 endif
-ifeq ($(DEB_TARGET_ARCH),freebsd-i386-gnu)
-  debian_patches += cpu-default-i486
+ifeq ($(DEB_TARGET_GNU_SYSTEM),knetbsd-gnu)
+  debian_patches += kbsd-gnu
 endif
 
-ifeq ($(DEB_TARGET_ARCH),netbsd-i386)
+ifeq ($(DEB_TARGET_GNU_SYSTEM),netbsd-elf-gnu)
   debian_patches += # netbsd-all-gcc netbsd-archs-gcc
 endif
 
diff -Nur gcc-3.4-3.4.0/debian/rules2 gcc-3.4-3.4.0+kbsd/debian/rules2
--- gcc-3.4-3.4.0/debian/rules2	2004-05-27 15:13:23.000000000 +0200
+++ gcc-3.4-3.4.0+kbsd/debian/rules2	2004-05-27 15:12:46.000000000 +0200
@@ -20,6 +20,19 @@
 		    else echo 1; fi)
 endif
 
+# kernel-specific ulimit hack
+ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
+ULIMIT =  if [ -e /proc/meminfo ]; then \
+	    m=`awk '/^((Mem|Swap)Free|Cached)/{m+=$$2}END{print int(m*.9)}' \
+		/proc/meminfo`; \
+	  else \
+	    m=`vmstat --free --swap-free --kilobytes|awk '{m+=$$2}END{print int(m*.9)}'`; \
+	  fi; \
+	  ulimit -m $$m; \
+	  echo "Limited memory for test runs to `ulimit -m`kB"
+else
+ULIMIT = true
+endif
 
 # the recipient for the test summaries. Send with: debian/rules mail-summary
 S_EMAIL = gcc@packages.debian.org gcc-testresults@gcc.gnu.org
@@ -42,7 +55,7 @@
 endif
 
 STAGE1_CFLAGS = -g
-ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),mips mipsel))
+ifeq ($(DEB_HOST_GNU_CPU), $(findstring $(DEB_HOST_GNU_CPU),mips mipsel))
   STAGE1_CFLAGS = -g -O2
 endif
 
@@ -114,7 +127,7 @@
   endif
 endif
 
-ifeq ($(DEB_TARGET_ARCH),$(findstring $(DEB_TARGET_ARCH),m68k))
+ifeq ($(DEB_TARGET_GNU_CPU),$(findstring $(DEB_TARGET_GNU_CPU),m68k))
   CONFARGS += --disable-werror
 endif
 
@@ -122,11 +135,11 @@
   CONFARGS += --disable-werror
 endif
 
-ifeq ($(DEB_TARGET_GNU_TYPE)-$(biarch),sparc-linux-yes)
+ifeq ($(DEB_TARGET_GNU_CPU)-$(biarch),sparc-yes)
   CONFARGS += --with-cpu=v7
 endif
 
-ifeq ($(DEB_TARGET_ARCH),amd64)
+ifeq ($(DEB_TARGET_GNU_CPU),x86_64)
   CONFARGS += --disable-multilib
 endif
 
@@ -152,11 +165,14 @@
 endif
 
 # Increase the timeout for one testrun on slow architectures
-ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),arm hppa m68k))
+ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),arm hppa m68k))
   DEJAGNU_TIMEOUT=600
 else
   DEJAGNU_TIMEOUT=450
 endif
+ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
+  DEJAGNU_TIMEOUT=900
+endif
 
 default: build
 
@@ -481,29 +497,12 @@
 		&
 endif
 
-ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
-	-echo "Running testsuite ..."; \
-	  if [ -e /proc/meminfo ]; then \
-	    m=`awk '/^((Mem|Swap)Free|Cached)/{m+=$$2}END{print int(m*.9)}' \
-		/proc/meminfo`; \
-	  else \
-	    m=`vmstat --free --swap-free --kilobytes|awk '{m+=$$2}END{print int(m*.9)}'`; \
-	  fi; \
-	  ulimit -m $$m; \
-	  echo "Limited memory for test runs to `ulimit -m`kB"; \
-	  EXTRA_TEST_PFLAGS=-g0 \
-	  DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
-	  LOCPATH=$(PWD)/locales \
-	  LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc:$(builddir)/gcc/ada/rts \
-		$(MAKE) -C $(builddir) -k check 2>&1 | tee test-protocol
-else
-	-echo "Running testsuite ..."; \
-	  EXTRA_TEST_PFLAGS=-g0 \
-	  DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
-	  LOCPATH=$(PWD)/locales \
-	  LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc:$(builddir)/gcc/ada/rts \
+	echo "Running testsuite ..."
+	-$(ULIMIT) ;  EXTRA_TEST_PFLAGS=-g0 \
+	DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
+	LOCPATH=$(PWD)/locales \
+	LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc:$(builddir)/gcc/ada/rts \
 		$(MAKE) -C $(builddir) -k check 2>&1 | tee test-protocol
-endif
 
 	-ps aux | fgrep logwatch | fgrep -v fgrep
 	if [ -f $(builddir)/logwatch.pid ]; then \
@@ -559,7 +558,13 @@
 	rm -f test-inst-protocol
 
 # start the script only on architectures known to be slow ...
-ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),arm m68k))
+ifeq ($(DEB_HOST_GNU_CPU), $(findstring $(DEB_HOST_GNU_CPU),arm m68k))
+  start_logwatch = yes
+endif
+ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
+  start_logwatch = yes
+endif
+ifeq ($(start_logwatch),yes)
 	: # start logwatch script for regular output during test runs
 	chmod +x debian/logwatch.sh
 	-debian/logwatch.sh -t 900 -p $(builddir)/logwatch-inst.pid \
@@ -572,29 +577,13 @@
 	rm -rf check-inst
 	mkdir check-inst
 
-ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
-	-echo "Running testsuite ..."; \
-	  if [ -e /proc/meminfo ]; then \
-	    m=`awk '/^((Mem|Swap)Free|Cached)/{m+=$$2}END{print int(m*.9)}' \
-		/proc/meminfo`; \
-	  else \
-	    m=`vmstat --free --swap-free --kilobytes|awk '{m+=$$2}END{print int(m*.9)}'`; \
-	  fi; \
-	  ulimit -m $$m; \
-	  echo "Limited memory for test runs to `ulimit -m`kB"; \
-	  DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
-	  LOCPATH=$(PWD)/locales \
-	    cd check-inst && $(srcdir)/contrib/test_installed \
-	      --with-gcc=gcc-3.3 --with-g++=g++-3.3 --with-g77=g77-3.3 \
-		2>&1 | tee test-inst-protocol
-else
-	-echo "Running testsuite ..."; \
-	  DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
-	  LOCPATH=$(PWD)/locales \
-	    cd check-inst && $(srcdir)/contrib/test_installed \
-	      --with-gcc=gcc-3.3 --with-g++=g++-3.3 --with-g77=g77-3.3 \
+	echo "Running testsuite ..."
+	-$(ULIMIT) ; \
+	DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
+	LOCPATH=$(PWD)/locales \
+	  cd check-inst && $(srcdir)/contrib/test_installed \
+	    --with-gcc=gcc-3.3 --with-g++=g++-3.3 --with-g77=g77-3.3 \
 		2>&1 | tee test-inst-protocol
-endif
 
 	-ps aux | fgrep logwatch | fgrep -v fgrep
 	if [ -f $(builddir)/logwatch-inst.pid ]; then \
@@ -761,7 +750,7 @@
 endif
 
 ifeq ($(with_libnof),yes)
-  ifeq ($(DEB_TARGET_ARCH),powerpc)
+  ifeq ($(DEB_TARGET_GNU_CPU),powerpc)
     include debian/rules.d/binary-nof.mk
   endif
 endif
@@ -790,7 +779,7 @@
   include debian/rules.d/binary-libstdcxx-cross.mk
 endif
 
-ifeq ($(DEB_TARGET_ARCH),powerpc)
+ifeq ($(DEB_TARGET_GNU_CPU),powerpc)
   include debian/rules.d/binary-nof-cross.mk
 endif
 
@@ -834,7 +823,7 @@
 	rm -rf $(d)
 	mkdir -p $(d)/lib $(d)/$(PF)
 
-ifeq ($(DEB_TARGET_ARCH),amd64)
+ifeq ($(DEB_TARGET_GNU_CPU),x86_64)
 	: # link lib to lib64 and usr/lib to usr/lib64
 	: # (this works when CONFARGS contains '--disable-multilib')
 	ln -s lib $(d)/lib64

Reply to: