Source-Changes-HG archive

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

[src/trunk]: src/tools/gcc initial port to HAVE_GCC = 45. mknative-gcc parts...



details:   https://anonhg.NetBSD.org/src/rev/75e2c398cbbc
branches:  trunk
changeset: 766350:75e2c398cbbc
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Jun 21 04:11:12 2011 +0000

description:
initial port to HAVE_GCC = 45.  mknative-gcc parts are from me
and are largely untested, most of the rest is from chuq.

diffstat:

 tools/gcc/Makefile        |   45 ++++++++++++---
 tools/gcc/README.mknative |    9 +-
 tools/gcc/mknative-gcc    |  130 +++++++++++++++++++++------------------------
 3 files changed, 101 insertions(+), 83 deletions(-)

diffs (truncated from 417 to 300 lines):

diff -r ee971daba818 -r 75e2c398cbbc tools/gcc/Makefile
--- a/tools/gcc/Makefile        Tue Jun 21 04:04:13 2011 +0000
+++ b/tools/gcc/Makefile        Tue Jun 21 04:11:12 2011 +0000
@@ -1,10 +1,15 @@
-#      $NetBSD: Makefile,v 1.36 2011/06/10 16:31:18 matt Exp $
+#      $NetBSD: Makefile,v 1.37 2011/06/21 04:11:12 mrg Exp $
 
 .include <bsd.own.mk>
 
 GCC_LANGUAGES=c c++ objc
 MODULE=                        gcc4
+.if ${HAVE_GCC} == 45
+MKNATIVE_TARGET=       gcc45
+GNUHOSTDIST=           ${.CURDIR}/../../external/gpl3/gcc/dist
+.else
 MKNATIVE_TARGET=       gcc4
+.endif
 MKNATIVE_CONFIG_TARGET_LIBS=
 BINENV=                /usr/bin/env -i
 
@@ -23,6 +28,8 @@
 COMMON_CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} \
                        --enable-long-long \
                        --enable-threads \
+                       --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html \
+                       --with-pkgversion="NetBSD nb1 20110620" \
                        ${VAX_CONFIGURE_ARGS} \
                        --enable-__cxa_atexit
 .if defined(GCC_CONFIG_ARCH.${MACHINE_ARCH})
@@ -32,7 +39,14 @@
 COMMON_CONFIGURE_ARGS+=        --with-tune=${GCC_CONFIG_TUNE.${MACHINE_ARCH}}
 .endif
 
-CONFIGURE_ARGS=        ${COMMON_CONFIGURE_ARGS} \
+CONFIGURE_ARGS=        ${COMMON_CONFIGURE_ARGS}
+.if ${HAVE_GCC} >= 45
+CONFIGURE_ARGS+= \
+               --with-mpc=${TOOLDIR} \
+               --with-mpfr=${TOOLDIR} \
+               --with-gmp=${TOOLDIR}
+.endif
+CONFIGURE_ARGS+= \
                --disable-nls \
                ${MULTILIB_ARGS} \
                ${SOFTFLOAT_ARGS} \
@@ -74,6 +88,16 @@
 .include "${.CURDIR}/../Makefile.gmakehost"
 BUILD_MAKE=${TOOL_GMAKE}
 
+#
+# mknative-gcc specific stuff
+#
+
+.if ${HAVE_GCC} >= 45
+GCCSRCDIR=${.CURDIR}/../../gnu/dist/gcc4
+.else
+GCCSRCDIR=${.CURDIR}/../../external/gpl3/gcc/dist
+.endif
+
 CXXADDFLAGS=   ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++
 CCADDFLAGS=    ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
 
@@ -90,10 +114,17 @@
        @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
                ${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
 
-NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} \
+NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
+.if ${HAVE_GCC} >= 45
+NATIVE_CONFIGURE_ARGS+=        \
+                       --with-mpc=${DESTDIR}/usr \
+                       --with-mpfr=${DESTDIR}/usr \
+                       --with-gmp=${DESTDIR}/usr
+.endif
+NATIVE_CONFIGURE_ARGS+=        \
                        --disable-multilib \
                        --disable-symvers \
-                       --build=`${.CURDIR}/../../gnu/dist/${MODULE}/config.guess` \
+                       --build=`${GCCSRCDIR}/config.guess` \
                        --host=${MACHINE_GNU_PLATFORM}
 
 .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
@@ -103,7 +134,6 @@
                        ${HOST_SH} ${GNUHOSTDIST}/configure \
                        ${NATIVE_CONFIGURE_ARGS}) && \
                (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty)
-.if ${HAVE_GCC} == 4
        PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
                (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp) && \
                (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty)
@@ -112,11 +142,6 @@
                        ${TOOL_SED} -e 's/\(maybe-all-gcc:\) all-gcc/\1/' \
                                < Makefile.config > Makefile) && \
                (cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h)
-.else
-       PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
-               (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-libiberty) && \
-               (cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} tree-check.h config.h)
-.endif
        PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
                (cd .native && touch gcc/cc1obj gcc/cc1plus gcc/f771 gcc/libgcc.a gcc/libgcc_s.so && \
                        ${MKNATIVE_ENV} ${BUILD_MAKE} configure-target-libiberty \
diff -r ee971daba818 -r 75e2c398cbbc tools/gcc/README.mknative
--- a/tools/gcc/README.mknative Tue Jun 21 04:04:13 2011 +0000
+++ b/tools/gcc/README.mknative Tue Jun 21 04:11:12 2011 +0000
@@ -1,4 +1,4 @@
-$NetBSD: README.mknative,v 1.7 2009/09/08 07:08:03 skrll Exp $
+$NetBSD: README.mknative,v 1.8 2011/06/21 04:11:12 mrg Exp $
 
 This file describes how to bootstrap the native toolchain on a new NetBSD
 platform (and how to update the new toolchain files, if needed).  These
@@ -36,10 +36,11 @@
 
 5. In src/gnu/lib/libgcc4, do "nbmake-MACHINE obj includes".
 
-6. In src/gnu/lib/crtstuff4 do "nbmake-MACHINE depend all install"
+6. If the platform sets USE_COMPILERCRTSTUFF=yes, then in src/gnu/lib/crtstuff4
+   do "nbmake-MACHINE dependall install"
 
-7. In each of src/lib/csu, src/gnu/lib/libgcc4, src/lib/libdes, and src/lib,
-   do "nbmake-MACHINE all install".
+7. In each of src/lib/csu, src/gnu/lib/libgcc4, and src/lib,
+   do "nbmake-MACHINE dependall install".
 
    Optionally, all of the following may be set in the environment to reduce
    the amount of code needed to build at this step.  Basically, it must be
diff -r ee971daba818 -r 75e2c398cbbc tools/gcc/mknative-gcc
--- a/tools/gcc/mknative-gcc    Tue Jun 21 04:04:13 2011 +0000
+++ b/tools/gcc/mknative-gcc    Tue Jun 21 04:11:12 2011 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-#      $NetBSD: mknative-gcc,v 1.45 2009/12/17 15:48:13 uebayasi Exp $
+#      $NetBSD: mknative-gcc,v 1.46 2011/06/21 04:11:12 mrg Exp $
 #
 # Shell script for generating all the constants needed for a native
 # platform build of src/gnu/dist/gcc.
@@ -16,25 +16,29 @@
 
 . $_TOP/tools/gcc/mknative.common
 
+# default to GCC 4.1 for now
+_OUTDIR="$_TOP/gnu"
+_OUTDIRBASE="gnu"
+
 ##### gnu/lib/crtstuff #####
 
 get_crtstuff () {
        _subdir="$1"
-       mkdir -p $_TOP/gnu/lib/$_subdir/arch
+       mkdir -p $_OUTDIR/lib/$_subdir/arch
 
        getvars gcc/Makefile \
                INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS \
                tm_defines xm_file xm_defines \
-               | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH.mk
+               | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH.mk
 }
 
 ##### gnu/lib/libg2c #####
 
 get_libg2c () {
-       mkdir -p $_TOP/gnu/lib/libg2c3/arch/$MACHINE_ARCH
+       mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH
 
-       write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h
-       write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h
+       write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h
+       write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h
 
        {
                getvars $_PLATFORM/libf2c/Makefile \
@@ -45,7 +49,7 @@
                        ALL_CFLAGS OBJS | sed 's,=,+=,'
                getvars $_PLATFORM/libf2c/libU77/Makefile \
                        ALL_CFLAGS OBJS | sed 's,=,+=,'
-       } | write_mk gnu/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk
+       } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk
 }
 
 ##### gnu/lib/libgcc #####
@@ -337,7 +341,7 @@
 
        # List of generated files.
 
-       _machine_arch_subdir=gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH/$_abi
+       _machine_arch_subdir=$_OUTDIRBASE/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH/$_abi
 
        libgcc_db_funcs=${_machine_arch_subdir}/funcs
        libgcc_db_tmplsrcs=${_machine_arch_subdir}/tmplsrcs
@@ -360,14 +364,10 @@
 
 get_libgcc () {
        _subdir="$1"
-       mkdir -p $_TOP/gnu/lib/lib$_subdir/arch
+       mkdir -p $_OUTDIR/lib/lib$_subdir/arch
 
        case "$_subdir" in
-       gcc3)
-               _extravars="USE_COLLECT2 LIB2FUNCS_1 LIB2FUNCS_2 xm_file"
-               _archsubdir=""
-               ;;
-       gcc4)
+       gcc4|gcc)
                _extravars="COLLECT2 UNWIND_H xm_include_list"
                _archsubdir=""
                ;;
@@ -387,7 +387,7 @@
                        SHLIB_MAPFILES SHLIB_NM_FLAGS \
                        EXTRA_HEADERS xm_defines \
                        tm_defines ${_extravars}
-       } | write_mk gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk
+       } | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk
 
        # Generate new style files.
        if [ -n "${MKNATIVE_LIBGCC_NEW}" ]; then
@@ -400,14 +400,14 @@
 get_libgcov () {
        _subdir="$1"
 
-       mkdir -p $_TOP/gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH
+       mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH
 
        {
                getvars gcc/Makefile \
                        LIBGCOV
-       } | write_mk gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk
+       } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk
 
-       write_c gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \
+       write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \
           <$_TMPDIR/gcc/gcov-iov.h
 
 }
@@ -416,33 +416,32 @@
 
 get_gcc_libiberty () {
        _subdir="$1"
-       mkdir -p $_TOP/gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH
+       case "$_subdir" in
+       gcc4)
+               _libibertydir="usr.bin/$_subdir/libiberty"
+               ;;
+       gcc)
+               _libibertydir="$_subdir/lib/libiberty"
+               ;;
+       esac
+       mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH
 
        getvars libiberty/Makefile \
                ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
-               | write_mk gnu/usr.bin/$_subdir/libiberty/defs.mk
+               | write_mk $_OUTDIRBASE/$_libibertydir/defs.mk
 
-       write_c gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH/config.h \
+       write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \
                <$_TMPDIR/libiberty/config.h
 }
 
 ##### gnu/lib/libobjc #####
 
 get_libobjc () {
-       case "$1" in
-       *4)
-               _subdir="$1/arch/$MACHINE_ARCH"
-               _options="ALL_OPT_FILES"
-               _unwind="UNWIND_H"
-               ;;
-       *)
-               _subdir="$1"
-               _options=""
-               _unwind=""
-               ;;
-       esac
+       _subdir="$1/arch/$MACHINE_ARCH"
+       _options="ALL_OPT_FILES"
+       _unwind="UNWIND_H"
 
-       mkdir -p $_TOP/gnu/lib/$_subdir
+       mkdir -p $_OUTDIR/lib/$_subdir
 
        {
                if [ -n "$_options" ]; then
@@ -454,9 +453,9 @@
                if [ -n "$_unwind" ]; then
                        getvars gcc/Makefile $_unwind
                fi
-       } | write_mk gnu/lib/$_subdir/defs.mk
+       } | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk
 
-       write_c gnu/lib/$_subdir/config.h \
+       write_c $_OUTDIRBASE/lib/$_subdir/config.h \
                <$_TMPDIR/$_PLATFORM/libobjc/config.h
 }
 
@@ -464,32 +463,25 @@
 
 get_libstdcxx_v3 () {
        _subdir="$1"
-       mkdir -p $_TOP/gnu/lib/$_subdir/arch/$MACHINE_ARCH
+       mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH



Home | Main Index | Thread Index | Old Index