Still need to fix the dependencies, but as I'll go enjoy the sun now I'm sending it the way it is.
diff -Naur debian.orig2/rules2 debian/rules2 --- debian.orig2/rules2 2007-07-13 15:51:55.000000000 +0200 +++ debian/rules2 2007-07-15 11:26:17.000000000 +0200 @@ -144,16 +144,28 @@ CONFARGS = -v \ --enable-languages=$(shell echo $(enabled_languages) | tr -s ' ' ',') \ --prefix=/$(PF) \ - --enable-shared \ - --with-system-zlib \ + --with-system-zlib +ifneq ($(DEB_CROSS_BOOTSTRAP),yes) + CONFARGS += \ + --enable-shared +else + CONFARGS += \ + --disable-shared +endif ifeq ($(PKGSOURCE),gcc-snapshot) with_nls := no else CONFARGS += \ --libexecdir=/$(libexecdir) \ - --without-included-gettext \ - --enable-threads=posix + --without-included-gettext + ifneq ($(DEB_CROSS_BOOTSTRAP),yes) + CONFARGS += \ + --enable-threads=posix + else + CONFARGS += \ + --disable-threads + endif endif ifeq ($(with_nls),yes) @@ -544,6 +556,22 @@ # DEB_CROSS is never set if REVERSE_CROSS is set and vice-versa. # DEB_CROSS build ifeq ($(DEB_CROSS),yes) + ifeq ($(DEB_CROSS_BOOTSTRAP),yes) + : # build cross compiler for $(TARGET_ALIAS) + ( \ + set +e; \ + PATH=$(PWD)/bin:$$PATH \ + $(SET_LOCPATH) \ + $(MAKE) -C $(builddir) $(NJOBS) \ + CC="$(CC)" \ + CFLAGS="$(CFLAGS)" \ + BOOT_CFLAGS="$(BOOT_CFLAGS)" \ + LDFLAGS="$(LDFLAGS)" \ + all-gcc ; \ + echo $$? > status; \ + ) 2>&1 | tee bootstrap-protocol + s=`cat status`; rm -f status; test $$s -eq 0 + else : # build cross compiler for $(TARGET_ALIAS) ( \ set +e; \ @@ -558,6 +586,7 @@ echo $$? > status; \ ) 2>&1 | tee bootstrap-protocol s=`cat status`; rm -f status; test $$s -eq 0 + endif else # REVERSE_CROSS build ifeq ($(REVERSE_CROSS),yes) @@ -1071,6 +1100,11 @@ p_cpp = cpp$(pkg_ver)$(cross_bin_arch) p_gcc = gcc$(pkg_ver)$(cross_bin_arch) p_cxx = g++$(pkg_ver)$(cross_bin_arch) + ifeq ($(DEB_CROSS_BOOTSTRAP),yes) + p_cpp = cpp$(pkg_ver)-bootstrap$(cross_bin_arch) + p_gcc = gcc$(pkg_ver)-bootstrap$(cross_bin_arch) + p_base = gcc$(pkg_ver)-bootstrap$(cross_bin_arch)-base + endif endif p_hppa64 = gcc$(pkg_ver)-hppa64 @@ -1379,6 +1413,7 @@ ln -s $(libdir) $(d)/$(PF)/lib64 endif +ifneq ($(DEB_CROSS_BOOTSTRAP),yes) : # Install everything PATH=$(PWD)/bin:$$PATH \ $(SET_SHELL) \ @@ -1390,6 +1425,19 @@ infodir=/$(PF)/share/info \ mandir=/$(PF)/share/man \ install +else + : # Install everything + PATH=$(PWD)/bin:$$PATH \ + $(SET_SHELL) \ + $(MAKE) -C $(builddir) \ + CFLAGS="$(CFLAGS)" \ + LDFLAGS="$(LDFLAGS)" \ + BOOT_CFLAGS="$(BOOT_CFLAGS)" \ + DESTDIR=$(PWD)/$(d) \ + infodir=/$(PF)/share/info \ + mandir=/$(PF)/share/man \ + install-gcc +endif ifeq ($(with_java),yes) ifneq (,$(filter yes, $(biarch) $(biarch32))) diff -Naur debian.orig2/rules.conf debian/rules.conf --- debian.orig2/rules.conf 2007-07-14 14:09:04.000000000 +0200 +++ debian/rules.conf 2007-07-14 19:05:19.000000000 +0200 @@ -265,7 +265,12 @@ DEB_LIBGCC_VERSION := $(DEB_EVERSION) endif -LIBGCC_DEP := libgcc$(GCC_SONAME)$(LS) (>= $(DEB_LIBGCC_VERSION)) +ifneq ($(DEB_CROSS_BOOTSTRAP),yes) + LIBGCC_DEP := libgcc$(GCC_SONAME)$(LS) (>= $(DEB_LIBGCC_VERSION)) +else + LIBGCC_DEP := +endif + LIBGCC_BIARCH_DEP := ifeq ($(biarch),yes) LIBGCC_BIARCH_DEP := lib64gcc$(GCC_SONAME)$(LS) (>= $(DEB_LIBGCC_VERSION)) diff -Naur debian.orig2/rules.defs debian/rules.defs --- debian.orig2/rules.defs 2007-07-14 15:16:04.000000000 +0200 +++ debian/rules.defs 2007-07-15 10:43:50.000000000 +0200 @@ -106,7 +106,11 @@ # library package names (e.g. libgcc-powerpc-cross). DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE) TP = $(DEB_TARGET_GNU_TYPE)- + ifneq ($(DEB_CROSS_BOOTSTRAP),yes) TS = -$(DEB_TARGET_ALIAS) + else + TS = -bootstrap-$(DEB_TARGET_ALIAS) + endif LS = -$(DEB_TARGET_ARCH)-cross endif @@ -179,7 +183,11 @@ # ... and some libraries, which do not change (libgcc1, libffi2, libg2c, # libmudflap, libssp0). +ifneq ($(DEB_CROSS_BOOTSTRAP),yes) with_common_libs := yes +else +with_common_libs := disabled for the bootstrap compiler +endif #ifeq ($(distribution),Debian) # next_gcc_not_built := alpha m68k mips mipsel hurd-i386 kfreebsd-i386 kfreebsd-amd64 @@ -262,6 +270,9 @@ ifeq (c++, $(findstring c++,$(subst obj-c++,,$(WITHOUT_LANG)))) with_cxx := disabled by environment endif +ifeq ($(DEB_CROSS_BOOTSTRAP),yes) + with_cxx := disabled for the bootstrap compiler +endif # Build all packages needed for C++ development ifeq ($(with_cxx)-$(with_dev),yes-yes) with_cxxdev := yes

