blob: 4846decbb8347de58f4e9799e1fac4b875fbcb07 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require gcc-configure-common.inc
2
3EXTRA_OECONF_PATHS = "\
4 --with-sysroot=/not/exist \
5 --with-build-sysroot=${STAGING_DIR_TARGET} \
6"
7
8do_configure () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009 rm -rf ${B}/${TARGET_SYS}/libgfortran/
10 mkdir -p ${B}/${TARGET_SYS}/libgfortran/
11 cd ${B}/${TARGET_SYS}/libgfortran/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012 chmod a+x ${S}/libgfortran/configure
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013 relpath=${@os.path.relpath("${S}/libgfortran", "${B}/${TARGET_SYS}/libgfortran")}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050014 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015 # Easiest way to stop bad RPATHs getting into the library since we have a
16 # broken libtool here
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libgfortran/libtool
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019EXTRACONFFUNCS += "extract_stashed_builddir"
20do_configure[depends] += "${COMPILERDEP}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021
22do_compile () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023 cd ${B}/${TARGET_SYS}/libgfortran/
24 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025}
26
27do_install () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028 cd ${B}/${TARGET_SYS}/libgfortran/
29 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/ install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
31 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
32 fi
33 if [ -d ${D}${infodir} ]; then
34 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
35 fi
36 chown -R root:root ${D}
37}
38
39INHIBIT_DEFAULT_DEPS = "1"
40DEPENDS = "gcc-runtime"
41
42BBCLASSEXTEND = "nativesdk"
43
44PACKAGES = "\
45 ${PN}-dbg \
46 libgfortran \
47 libgfortran-dev \
48 libgfortran-staticdev \
49"
50FILES_${PN} = "${libdir}/libgfortran.so.*"
51FILES_${PN}-dev = "\
52 ${libdir}/libgfortran*.so \
53 ${libdir}/libgfortran.spec \
54 ${libdir}/libgfortran.la \
55 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
56 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single* \
57"
58FILES_${PN}-staticdev = "${libdir}/libgfortran.a"
59
60INSANE_SKIP_${MLPREFIX}libgfortran-dev = "staticdev"
61
62do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
63do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
64do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
65
66python __anonymous () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050067 f = d.getVar("FORTRAN")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 if "fortran" not in f:
69 raise bb.parse.SkipPackage("libgfortran needs fortran support to be enabled in the compiler")
70}