# libgfortran needs separate recipe due to libquadmath dependency
 
 # Relative path to be repaced into debug info
-REL_S = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
-
-DEBUG_PREFIX_MAP:class-target = " \
-   -fdebug-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
-   -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
-   -fdebug-prefix-map=${S}=${REL_S} \
-   -fdebug-prefix-map=${S}/include=${REL_S}/libstdc++-v3/../include \
-   -fdebug-prefix-map=${S}/libiberty=${REL_S}/libstdc++-v3/../libiberty \
-   -fdebug-prefix-map=${S}/libgcc=${REL_S}/libstdc++-v3/../libgcc \
-   -fdebug-prefix-map=${B}=${REL_S} \
+DEBUGSOURCE = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
+
+DEBUG_PREFIX_MAP = " \
+   -ffile-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
+   -ffile-prefix-map=${WORKDIR}/recipe-sysroot-native= \
+   -ffile-prefix-map=${B}=${DEBUGSOURCE} \
+   -ffile-prefix-map=${S}=${DEBUGSOURCE} \
+   -fdebug-prefix-map=${B}=${DEBUGSOURCE} \
+   -fdebug-prefix-map=${S}=${DEBUGSOURCE} \
    -ffile-prefix-map=${B}/${HOST_SYS}/libstdc++-v3/include=${includedir}/c++/${BINV} \
    "
 
                mkdir -p ${B}/${TARGET_SYS}/$d/
                cd ${B}/${TARGET_SYS}/$d/
                chmod a+x ${S}/$d/configure
-               relpath=${@os.path.relpath("${S}/$d", "${B}/${TARGET_SYS}/$d")}
-               $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+               ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
                if [ "$d" = "libgcc" ]; then
                        (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
                fi
 
 
 INHIBIT_DEFAULT_DEPS = "1"
 
+DEBUGSOURCE = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
+DEBUG_PREFIX_MAP = " \
+   -fdebug-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
+   -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
+   -fdebug-prefix-map=${B}=${DEBUGSOURCE} \
+   -fdebug-prefix-map=${S}=${DEBUGSOURCE} \
+   "
+
 do_configure () {
        install -d ${D}${base_libdir} ${D}${libdir}
        mkdir -p ${B}/${BPN}
        mkdir -p ${B}/${TARGET_SYS}/${BPN}/
        cd ${B}/${BPN}
        chmod a+x ${S}/${BPN}/configure
-       relpath=${@os.path.relpath("${S}/${BPN}", "${B}/${BPN}")}
-       $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+       ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
 }
 EXTRACONFFUNCS += "extract_stashed_builddir"
 do_configure[depends] += "${COMPILERDEP}"