From 898c5fa4f1a22a909b898dd018b1d19e8f7b3db4 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Thu, 17 Jan 2008 14:05:03 +0000 Subject: * Use static linking for mpfr/gmp instead of the rpath. This avoid the layering violation and makes sure that gcc-cross-sdk will build as well. * For gcc4.3 we need to look at the gmp/mpfr again as they will be required for everything and not just gfortran * Apply a patch to gcc_4.2.2 but only if we want to build gcc. We want to be able to use arm-angstrom-linux-gnueabi-gfortran and the GF="$(GFORTRAN)" would have set the fortran to 'gfortran' and we ended up with a build error. Some more experiments with GFORTRAN_FOR_TARGET are needed. --- .../gcc/gcc-4.2.2/fortran-cross-compile-hack.patch | 30 ++++++++++++++ .../fortran-libs-rpath-to-staging-hack.patch | 48 ---------------------- .../gcc/gcc-4.2.2/fortran-static-linking.patch | 48 ++++++++++++++++++++++ packages/gcc/gcc-cross-sdk_4.2.2.bb | 7 +++- packages/gcc/gcc-cross_4.2.2.bb | 1 - packages/gcc/gcc_4.2.2.bb | 9 ++++ 6 files changed, 93 insertions(+), 50 deletions(-) create mode 100644 packages/gcc/gcc-4.2.2/fortran-cross-compile-hack.patch delete mode 100644 packages/gcc/gcc-4.2.2/fortran-libs-rpath-to-staging-hack.patch create mode 100644 packages/gcc/gcc-4.2.2/fortran-static-linking.patch (limited to 'packages/gcc') diff --git a/packages/gcc/gcc-4.2.2/fortran-cross-compile-hack.patch b/packages/gcc/gcc-4.2.2/fortran-cross-compile-hack.patch new file mode 100644 index 0000000000..b3d38ad983 --- /dev/null +++ b/packages/gcc/gcc-4.2.2/fortran-cross-compile-hack.patch @@ -0,0 +1,30 @@ +* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used + used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross + directory. + +diff --git a/libgfortran/configure b/libgfortran/configure +index f7d86fb..d0966ec 100755 +--- a/libgfortran/configure ++++ b/libgfortran/configure +@@ -4475,6 +4475,6 @@ exec 5>>./config.log + + # We need gfortran to compile parts of the library + #AC_PROG_FC(gfortran) +-FC="$GFORTRAN" ++#FC="$GFORTRAN" + ac_ext=${FC_SRCEXT-f} + ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' +\ No newline at end of file +diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac +index 4661306..9f83e55 100644 +--- a/libgfortran/configure.ac ++++ b/libgfortran/configure.ac +@@ -140,7 +140,7 @@ AC_SUBST(enable_static) + + # We need gfortran to compile parts of the library + #AC_PROG_FC(gfortran) +-FC="$GFORTRAN" ++#FC="$GFORTRAN" + AC_PROG_FC(gfortran) + + # extra LD Flags which are required for targets diff --git a/packages/gcc/gcc-4.2.2/fortran-libs-rpath-to-staging-hack.patch b/packages/gcc/gcc-4.2.2/fortran-libs-rpath-to-staging-hack.patch deleted file mode 100644 index bf319f8b0a..0000000000 --- a/packages/gcc/gcc-4.2.2/fortran-libs-rpath-to-staging-hack.patch +++ /dev/null @@ -1,48 +0,0 @@ -f951 (fortran) links to MPFR and GMP of our staging area but when executing -the command the libs can not be found. Use rpath like all the other apps in -our staging bin/ directory. - -Patch the configure to avoid the regeneration... - -Index: gcc-4.2.2/configure -=================================================================== ---- gcc-4.2.2.orig/configure 2008-01-15 23:23:41.000000000 +0100 -+++ gcc-4.2.2/configure 2008-01-15 23:25:20.000000000 +0100 -@@ -2278,14 +2278,14 @@ - - - if test "x$with_mpfr" != x; then -- gmplibs="-L$with_mpfr/lib $gmplibs" -+ gmplibs="-Wl,-rpath,$with_mpfr/lib -L$with_mpfr/lib $gmplibs" - gmpinc="-I$with_mpfr/include" - fi - if test "x$with_mpfr_include" != x; then - gmpinc="-I$with_mpfr_include" - fi - if test "x$with_mpfr_lib" != x; then -- gmplibs="-L$with_mpfr_lib $gmplibs" -+ gmplibs="-Wl,-rpath,$with_mpfr_lib -L$with_mpfr_lib $gmplibs" - fi - - # Specify a location for gmp -Index: gcc-4.2.2/configure.in -=================================================================== ---- gcc-4.2.2.orig/configure.in 2008-01-15 23:23:41.000000000 +0100 -+++ gcc-4.2.2/configure.in 2008-01-15 23:24:36.000000000 +0100 -@@ -1066,14 +1066,14 @@ - AC_ARG_WITH(mpfr_lib, [ --with-mpfr-lib=PATH Specify the directory for the installed MPFR library]) - - if test "x$with_mpfr" != x; then -- gmplibs="-L$with_mpfr/lib $gmplibs" -+ gmplibs="-Wl,-rpath,$with_mpfr/lib -L$with_mpfr/lib $gmplibs" - gmpinc="-I$with_mpfr/include" - fi - if test "x$with_mpfr_include" != x; then - gmpinc="-I$with_mpfr_include" - fi - if test "x$with_mpfr_lib" != x; then -- gmplibs="-L$with_mpfr_lib $gmplibs" -+ gmplibs="-Wl,-rpath,$with_mpfr_lib -L$with_mpfr_lib $gmplibs" - fi - - # Specify a location for gmp diff --git a/packages/gcc/gcc-4.2.2/fortran-static-linking.patch b/packages/gcc/gcc-4.2.2/fortran-static-linking.patch new file mode 100644 index 0000000000..3dd6321dc3 --- /dev/null +++ b/packages/gcc/gcc-4.2.2/fortran-static-linking.patch @@ -0,0 +1,48 @@ +f951 (fortran) links to MPFR and GMP of our staging area but when executing +the command the libs can not be found. Use rpath like all the other apps in +our staging bin/ directory. + +Patch the configure to avoid the regeneration... + +Index: gcc-4.2.2/configure +=================================================================== +--- gcc-4.2.2.orig/configure 2008-01-15 23:23:41.000000000 +0100 ++++ gcc-4.2.2/configure 2008-01-15 23:25:20.000000000 +0100 +@@ -2278,14 +2278,14 @@ + + + if test "x$with_mpfr" != x; then +- gmplibs="-L$with_mpfr/lib $gmplibs" ++ gmplibs="-static -L$with_mpfr/lib $gmplibs" + gmpinc="-I$with_mpfr/include" + fi + if test "x$with_mpfr_include" != x; then + gmpinc="-I$with_mpfr_include" + fi + if test "x$with_mpfr_lib" != x; then +- gmplibs="-L$with_mpfr_lib $gmplibs" ++ gmplibs="-static -L$with_mpfr_lib $gmplibs" + fi + + # Specify a location for gmp +Index: gcc-4.2.2/configure.in +=================================================================== +--- gcc-4.2.2.orig/configure.in 2008-01-15 23:23:41.000000000 +0100 ++++ gcc-4.2.2/configure.in 2008-01-15 23:24:36.000000000 +0100 +@@ -1066,14 +1066,14 @@ + AC_ARG_WITH(mpfr_lib, [ --with-mpfr-lib=PATH Specify the directory for the installed MPFR library]) + + if test "x$with_mpfr" != x; then +- gmplibs="-L$with_mpfr/lib $gmplibs" ++ gmplibs="-static -L$with_mpfr/lib $gmplibs" + gmpinc="-I$with_mpfr/include" + fi + if test "x$with_mpfr_include" != x; then + gmpinc="-I$with_mpfr_include" + fi + if test "x$with_mpfr_lib" != x; then +- gmplibs="-L$with_mpfr_lib $gmplibs" ++ gmplibs="-static -L$with_mpfr_lib $gmplibs" + fi + + # Specify a location for gmp diff --git a/packages/gcc/gcc-cross-sdk_4.2.2.bb b/packages/gcc/gcc-cross-sdk_4.2.2.bb index dea1819cdb..2fdaa7dc27 100644 --- a/packages/gcc/gcc-cross-sdk_4.2.2.bb +++ b/packages/gcc/gcc-cross-sdk_4.2.2.bb @@ -8,9 +8,14 @@ inherit sdk FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}" -DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc mpfr" PACKAGES = "${PN}" require gcc_${PV}.bb require gcc4-build-sdk.inc require gcc-package-sdk.inc + +DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc gmp-native mpfr-native" + +EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \ + --disable-libgomp --disable-libmudflap \ + --with-mpfr=${STAGING_DIR_NATIVE}${layout_exec_prefix}" diff --git a/packages/gcc/gcc-cross_4.2.2.bb b/packages/gcc/gcc-cross_4.2.2.bb index fdb6d0e30d..daf0e65003 100644 --- a/packages/gcc/gcc-cross_4.2.2.bb +++ b/packages/gcc/gcc-cross_4.2.2.bb @@ -15,7 +15,6 @@ require gcc3-build-cross.inc # cross packaging require gcc-package-cross.inc SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch;patch=1 " -SRC_URI_append = " file://fortran-libs-rpath-to-staging-hack.patch;patch=1 " # Do not build libssp libmudflap and libgomp # We might need them for some beefy targets EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \ diff --git a/packages/gcc/gcc_4.2.2.bb b/packages/gcc/gcc_4.2.2.bb index 91f4691208..15a25c9c6a 100644 --- a/packages/gcc/gcc_4.2.2.bb +++ b/packages/gcc/gcc_4.2.2.bb @@ -41,6 +41,7 @@ SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \ file://gfortran.patch;patch=1 \ file://gcc-4.0.2-e300c2c3.patch;patch=1 \ file://pr34130.patch;patch=1 \ + file://fortran-static-linking.patch;patch=1 \ " SRC_URI_append_ep93xx = " \ @@ -72,6 +73,8 @@ SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 " FORTRAN = "" FORTRAN_linux-gnueabi = ",fortran" +DEPENDS += " gmp mpfr " + #Set the java bits JAVA = "" JAVA_arm = "" @@ -83,3 +86,9 @@ ARCH_FLAGS_FOR_TARGET=-isystem${STAGING_INCDIR} EXTRA_OECONF += " --disable-libssp --disable-bootstrap " +# We know some one is including us, but we only want to apply this fortran hack for the real gcc +python __anonymous () { + import bb + if bb.data.getVar('PN', d, True) == "gcc": + bb.data.setVar('SRC_URI_append', ' file://fortran-cross-compile-hack.patch;patch=1', d) +} -- cgit v1.2.3