blob: 7543585e6ee91019cb2c4f55fc7526386b3291b3 [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 Bishop316dfdd2018-06-25 12:45:53 -04009 for target in libbacktrace libgfortran
10 do
11 rm -rf ${B}/${TARGET_SYS}/$target/
12 mkdir -p ${B}/${TARGET_SYS}/$target/
13 cd ${B}/${TARGET_SYS}/$target/
14 chmod a+x ${S}/$target/configure
15 relpath=${@os.path.relpath("${S}", "${B}/${TARGET_SYS}")}
16 ../$relpath/$target/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
17 # Easiest way to stop bad RPATHs getting into the library since we have a
18 # broken libtool here
19 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/$target/libtool
20 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022EXTRACONFFUNCS += "extract_stashed_builddir"
23do_configure[depends] += "${COMPILERDEP}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024
25do_compile () {
Brad Bishop316dfdd2018-06-25 12:45:53 -040026 for target in libbacktrace libgfortran
27 do
28 cd ${B}/${TARGET_SYS}/$target/
29 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$target/
30 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031}
32
33do_install () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 cd ${B}/${TARGET_SYS}/libgfortran/
35 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/ install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
37 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
38 fi
39 if [ -d ${D}${infodir} ]; then
40 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
41 fi
42 chown -R root:root ${D}
43}
44
45INHIBIT_DEFAULT_DEPS = "1"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050046DEPENDS = "gcc-runtime gcc-cross-${TARGET_ARCH}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047
48BBCLASSEXTEND = "nativesdk"
49
50PACKAGES = "\
51 ${PN}-dbg \
52 libgfortran \
53 libgfortran-dev \
54 libgfortran-staticdev \
55"
Brad Bishop19323692019-04-05 15:28:33 -040056
57LICENSE_${PN} = "GPL-3.0-with-GCC-exception"
58LICENSE_${PN}-dev = "GPL-3.0-with-GCC-exception"
59LICENSE_${PN}-dbg = "GPL-3.0-with-GCC-exception"
60
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061FILES_${PN} = "${libdir}/libgfortran.so.*"
62FILES_${PN}-dev = "\
63 ${libdir}/libgfortran*.so \
64 ${libdir}/libgfortran.spec \
65 ${libdir}/libgfortran.la \
66 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
67 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single* \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050068 ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude/ \
Brad Bishopc342db32019-05-15 21:57:59 -040069 ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070"
71FILES_${PN}-staticdev = "${libdir}/libgfortran.a"
72
73INSANE_SKIP_${MLPREFIX}libgfortran-dev = "staticdev"
74
75do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
76do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
77do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
78
79python __anonymous () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050080 f = d.getVar("FORTRAN")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081 if "fortran" not in f:
Brad Bishop316dfdd2018-06-25 12:45:53 -040082 raise bb.parse.SkipRecipe("libgfortran needs fortran support to be enabled in the compiler")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050083}