blob: e810146d4d1eb146889521e825b60020a44781b0 [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
Andrew Geissler595f6302022-01-24 19:11:47 +00008# An arm hard float target like raspberrypi4 won't build
9# as CFLAGS don't make it to the fortran compiler otherwise
10# (the configure script sets FC to $GFORTRAN unconditionally)
11export GFORTRAN = "${FC}"
12
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013do_configure () {
Brad Bishop316dfdd2018-06-25 12:45:53 -040014 for target in libbacktrace libgfortran
15 do
16 rm -rf ${B}/${TARGET_SYS}/$target/
17 mkdir -p ${B}/${TARGET_SYS}/$target/
18 cd ${B}/${TARGET_SYS}/$target/
19 chmod a+x ${S}/$target/configure
20 relpath=${@os.path.relpath("${S}", "${B}/${TARGET_SYS}")}
21 ../$relpath/$target/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
22 # Easiest way to stop bad RPATHs getting into the library since we have a
23 # broken libtool here
24 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/$target/libtool
25 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027EXTRACONFFUNCS += "extract_stashed_builddir"
28do_configure[depends] += "${COMPILERDEP}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029
30do_compile () {
Brad Bishop316dfdd2018-06-25 12:45:53 -040031 for target in libbacktrace libgfortran
32 do
33 cd ${B}/${TARGET_SYS}/$target/
34 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$target/
35 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036}
37
38do_install () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050039 cd ${B}/${TARGET_SYS}/libgfortran/
40 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/ install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
42 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
43 fi
44 if [ -d ${D}${infodir} ]; then
45 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
46 fi
47 chown -R root:root ${D}
48}
49
50INHIBIT_DEFAULT_DEPS = "1"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050051DEPENDS = "gcc-runtime gcc-cross-${TARGET_ARCH}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052
53BBCLASSEXTEND = "nativesdk"
54
55PACKAGES = "\
56 ${PN}-dbg \
57 libgfortran \
58 libgfortran-dev \
59 libgfortran-staticdev \
60"
Brad Bishop19323692019-04-05 15:28:33 -040061
Patrick Williams213cb262021-08-07 19:21:33 -050062LICENSE:${PN} = "GPL-3.0-with-GCC-exception"
63LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception"
64LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception"
Brad Bishop19323692019-04-05 15:28:33 -040065
Patrick Williams213cb262021-08-07 19:21:33 -050066FILES:${PN} = "${libdir}/libgfortran.so.*"
67FILES:${PN}-dev = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 ${libdir}/libgfortran*.so \
69 ${libdir}/libgfortran.spec \
70 ${libdir}/libgfortran.la \
71 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
72 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single* \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050073 ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude/ \
Brad Bishopc342db32019-05-15 21:57:59 -040074 ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075"
Patrick Williams213cb262021-08-07 19:21:33 -050076FILES:${PN}-staticdev = "${libdir}/libgfortran.a"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077
Patrick Williams213cb262021-08-07 19:21:33 -050078INSANE_SKIP:${MLPREFIX}libgfortran-dev = "staticdev"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079
80do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
81do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
82do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
83
84python __anonymous () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050085 f = d.getVar("FORTRAN")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086 if "fortran" not in f:
Brad Bishop316dfdd2018-06-25 12:45:53 -040087 raise bb.parse.SkipRecipe("libgfortran needs fortran support to be enabled in the compiler")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088}