generic-poky/meta/recipes-devtools/gcc/libgfortran.inc
Hongxu Jia b14e2ae9bc gcc: use relative path for configure script
The absolute path (/path/to/configure) caused __FILE__ to be
an absolute path.

If 'assert' invoked, it uses __FILE__, and build path would be in elf files.
In assert.h
...
.# define assert(expr)                                                   \
  ((expr)                                                               \
   ? __ASSERT_VOID_CAST (0)                                             \
   : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))
...

Which triggered buildpaths QA issue:
...
| libgcc-5.3.0: File work/core2-64-poky-linux/libgcc/5.3.0-r0/packages-split/
libgcc-dev/usr/lib64/x86_64-poky-linux/5.3.0/libgcc.a in package contained
reference to tmpdir [buildpaths]
...

Use relative path to run configure can fix the problem.

[YOCTO #7058]

(From OE-Core rev: b806e4c004a7e10461fe7428fc130a5aa2528039)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-28 11:32:58 +00:00

76 lines
2.4 KiB
PHP

require gcc-configure-common.inc
EXTRA_OECONF_PATHS = "\
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
do_configure () {
mtarget=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
hardlinkdir ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget ${B}
echo "Configuring libgfortran"
rm -rf ${B}/$target/libgfortran/
mkdir -p ${B}/$target/libgfortran/
cd ${B}/$target/libgfortran/
chmod a+x ${S}/libgfortran/configure
relpath=${@os.path.relpath("${S}/libgfortran", "${B}/$target/libgfortran")}
$relpath/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")
}