aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/libgfortran.inc
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-05 00:48:30 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-05 14:24:43 +0000
commit5bde5d9b39ea67f19a1a6aedd0c08c6cfedcbe5f (patch)
tree0dd4a18f59565236a07548ddba67d9cc52b5de07 /meta/recipes-devtools/gcc/libgfortran.inc
parenta67654e06ec8b0bda8fe953e1b5357e2d297c375 (diff)
downloadopenembedded-core-contrib-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/recipes-devtools/gcc/libgfortran.inc')
-rw-r--r--meta/recipes-devtools/gcc/libgfortran.inc75
1 files changed, 75 insertions, 0 deletions
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 @@
+require gcc-configure-common.inc
+
+EXTRA_OECONF_PATHS = " \
+ --with-sysroot=${STAGING_DIR_TARGET} \
+ --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+do_configure () {
+ mtarget=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
+ target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
+ #cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/* ${B}
+ (cd ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/; find . -print0 | cpio --null -pdlu ${B})
+ (cd ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/; find . -type l -print0 | cpio -pd0mLu --no-preserve-owner ${B})
+
+ echo "Configuring libgfortran"
+ rm -rf ${B}/$target/libgfortran/
+ mkdir -p ${B}/$target/libgfortran/
+ cd ${B}/$target/libgfortran/
+ chmod a+x ${S}/libgfortran/configure
+ ${S}/libgfortran/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+ # Easiest way to stop bad RPATHs getting into the library since we have a
+ # broken libtool here
+ sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/$target/libgfortran/libtool
+}
+
+do_compile () {
+ target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
+ cd ${B}/$target/libgfortran/
+ oe_runmake MULTIBUILDTOP=${B}/$target/libgfortran/
+}
+
+do_install () {
+ target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
+ cd ${B}/$target/libgfortran/
+ oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/libgfortran/ install
+ if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
+ rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
+ fi
+ if [ -d ${D}${infodir} ]; then
+ rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
+ fi
+ chown -R root:root ${D}
+}
+
+INHIBIT_DEFAULT_DEPS = "1"
+DEPENDS = "gcc-runtime"
+
+BBCLASSEXTEND = "nativesdk"
+
+PACKAGES = "\
+ ${PN}-dbg \
+ libgfortran \
+ libgfortran-dev \
+ libgfortran-staticdev \
+"
+FILES_${PN} = "${libdir}/libgfortran.so.*"
+FILES_${PN}-dev = " \
+ ${libdir}/libgfortran*.so \
+ ${libdir}/libgfortran.spec \
+ ${libdir}/libgfortran.la \
+ ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
+ ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single*"
+FILES_${PN}-staticdev = " \
+ ${libdir}/libgfortran.a"
+
+INSANE_SKIP_${MLPREFIX}libgfortran-dev = "staticdev"
+
+do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+
+python __anonymous () {
+ f = d.getVar("FORTRAN", True)
+ if "fortran" not in f:
+ raise bb.parse.SkipPackage("libgfortran needs fortran support to be enabled in the compiler")
+}