diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-05 00:48:30 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-05 14:24:43 +0000 |
commit | 5bde5d9b39ea67f19a1a6aedd0c08c6cfedcbe5f (patch) | |
tree | 0dd4a18f59565236a07548ddba67d9cc52b5de07 /meta | |
parent | a67654e06ec8b0bda8fe953e1b5357e2d297c375 (diff) | |
download | poky-5bde5d9b39ea67f19a1a6aedd0c08c6cfedcbe5f.tar.gz |
gcc: Allow fortran to build successfully in 4.8
gcc 4.8 fortran presents some challenges:
* libquadmath headers need to be in the libexec include dir. It turns out
to be easiest just to manually do this.
* libgfortran configure needs libquadmath to be compiled. This means
a separate recipe is needed (the alternative is gross hacks)
* the libtool uses to link libgfortran doesn't have our improved rpath
handling and puts bogus RPATHS into the libraries. We can avoid this
by tweaking libtool with sed.
This patch resolves those issues. Any user of fortran does need to DEPEND
on libgfortran in order to trigger it to build but this shouldn't be a major
issue.
(From OE-Core rev: a5e7ee5770b9e0cf719c573efffd874440f74289)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-cross.inc | 5 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-runtime.inc | 2 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/libgfortran.inc | 75 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/libgfortran_4.8.bb | 3 |
4 files changed, 84 insertions, 1 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc index 25a3142261..5c4319fb32 100644 --- a/meta/recipes-devtools/gcc/gcc-cross.inc +++ b/meta/recipes-devtools/gcc/gcc-cross.inc | |||
@@ -165,6 +165,11 @@ do_install () { | |||
165 | rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d | 165 | rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d |
166 | done | 166 | done |
167 | 167 | ||
168 | # libquadmath headers need to be available in the gcc libexec dir | ||
169 | install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
170 | cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
171 | cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
172 | |||
168 | # We use libiberty from binutils | 173 | # We use libiberty from binutils |
169 | find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f | 174 | find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f |
170 | find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f | 175 | find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f |
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc index 2599760569..d3b11a759f 100644 --- a/meta/recipes-devtools/gcc/gcc-runtime.inc +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc | |||
@@ -16,7 +16,7 @@ RUNTIMETARGET = "libssp libstdc++-v3 libgomp" | |||
16 | # ? | 16 | # ? |
17 | # libiberty | 17 | # libiberty |
18 | # libmudflap | 18 | # libmudflap |
19 | # libgfortran | 19 | # libgfortran needs separate recipe due to libquadmath dependency |
20 | 20 | ||
21 | do_configure () { | 21 | do_configure () { |
22 | export CXX="${CXX} -nostdinc++ -nostdlib++" | 22 | export CXX="${CXX} -nostdinc++ -nostdlib++" |
diff --git a/meta/recipes-devtools/gcc/libgfortran.inc b/meta/recipes-devtools/gcc/libgfortran.inc new file mode 100644 index 0000000000..3ae063279e --- /dev/null +++ b/meta/recipes-devtools/gcc/libgfortran.inc | |||
@@ -0,0 +1,75 @@ | |||
1 | require gcc-configure-common.inc | ||
2 | |||
3 | EXTRA_OECONF_PATHS = " \ | ||
4 | --with-sysroot=${STAGING_DIR_TARGET} \ | ||
5 | --with-build-sysroot=${STAGING_DIR_TARGET}" | ||
6 | |||
7 | do_configure () { | ||
8 | mtarget=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##` | ||
9 | target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##` | ||
10 | #cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/* ${B} | ||
11 | (cd ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/; find . -print0 | cpio --null -pdlu ${B}) | ||
12 | (cd ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/; find . -type l -print0 | cpio -pd0mLu --no-preserve-owner ${B}) | ||
13 | |||
14 | echo "Configuring libgfortran" | ||
15 | rm -rf ${B}/$target/libgfortran/ | ||
16 | mkdir -p ${B}/$target/libgfortran/ | ||
17 | cd ${B}/$target/libgfortran/ | ||
18 | chmod a+x ${S}/libgfortran/configure | ||
19 | ${S}/libgfortran/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} | ||
20 | # Easiest way to stop bad RPATHs getting into the library since we have a | ||
21 | # broken libtool here | ||
22 | sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/$target/libgfortran/libtool | ||
23 | } | ||
24 | |||
25 | do_compile () { | ||
26 | target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##` | ||
27 | cd ${B}/$target/libgfortran/ | ||
28 | oe_runmake MULTIBUILDTOP=${B}/$target/libgfortran/ | ||
29 | } | ||
30 | |||
31 | do_install () { | ||
32 | target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##` | ||
33 | cd ${B}/$target/libgfortran/ | ||
34 | oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/libgfortran/ install | ||
35 | if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then | ||
36 | rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude | ||
37 | fi | ||
38 | if [ -d ${D}${infodir} ]; then | ||
39 | rmdir --ignore-fail-on-non-empty -p ${D}${infodir} | ||
40 | fi | ||
41 | chown -R root:root ${D} | ||
42 | } | ||
43 | |||
44 | INHIBIT_DEFAULT_DEPS = "1" | ||
45 | DEPENDS = "gcc-runtime" | ||
46 | |||
47 | BBCLASSEXTEND = "nativesdk" | ||
48 | |||
49 | PACKAGES = "\ | ||
50 | ${PN}-dbg \ | ||
51 | libgfortran \ | ||
52 | libgfortran-dev \ | ||
53 | libgfortran-staticdev \ | ||
54 | " | ||
55 | FILES_${PN} = "${libdir}/libgfortran.so.*" | ||
56 | FILES_${PN}-dev = " \ | ||
57 | ${libdir}/libgfortran*.so \ | ||
58 | ${libdir}/libgfortran.spec \ | ||
59 | ${libdir}/libgfortran.la \ | ||
60 | ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \ | ||
61 | ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single*" | ||
62 | FILES_${PN}-staticdev = " \ | ||
63 | ${libdir}/libgfortran.a" | ||
64 | |||
65 | INSANE_SKIP_${MLPREFIX}libgfortran-dev = "staticdev" | ||
66 | |||
67 | do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata" | ||
68 | do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata" | ||
69 | do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata" | ||
70 | |||
71 | python __anonymous () { | ||
72 | f = d.getVar("FORTRAN", True) | ||
73 | if "fortran" not in f: | ||
74 | raise bb.parse.SkipPackage("libgfortran needs fortran support to be enabled in the compiler") | ||
75 | } | ||
diff --git a/meta/recipes-devtools/gcc/libgfortran_4.8.bb b/meta/recipes-devtools/gcc/libgfortran_4.8.bb new file mode 100644 index 0000000000..71dd8b4bdc --- /dev/null +++ b/meta/recipes-devtools/gcc/libgfortran_4.8.bb | |||
@@ -0,0 +1,3 @@ | |||
1 | require recipes-devtools/gcc/gcc-${PV}.inc | ||
2 | require libgfortran.inc | ||
3 | |||