libgfortran.inc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. require gcc-configure-common.inc
  2. EXTRA_OECONF_PATHS = "\
  3. --with-sysroot=/not/exist \
  4. --with-build-sysroot=${STAGING_DIR_TARGET} \
  5. "
  6. # An arm hard float target like raspberrypi4 won't build
  7. # as CFLAGS don't make it to the fortran compiler otherwise
  8. # (the configure script sets FC to $GFORTRAN unconditionally)
  9. export GFORTRAN = "${FC}"
  10. do_configure () {
  11. for target in libbacktrace libgfortran
  12. do
  13. rm -rf ${B}/${TARGET_SYS}/$target/
  14. mkdir -p ${B}/${TARGET_SYS}/$target/
  15. cd ${B}/${TARGET_SYS}/$target/
  16. chmod a+x ${S}/$target/configure
  17. relpath=${@os.path.relpath("${S}", "${B}/${TARGET_SYS}")}
  18. ../$relpath/$target/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
  19. # Easiest way to stop bad RPATHs getting into the library since we have a
  20. # broken libtool here
  21. sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/$target/libtool
  22. done
  23. }
  24. EXTRACONFFUNCS += "extract_stashed_builddir"
  25. do_configure[depends] += "${COMPILERDEP}"
  26. do_compile () {
  27. for target in libbacktrace libgfortran
  28. do
  29. cd ${B}/${TARGET_SYS}/$target/
  30. oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$target/
  31. done
  32. }
  33. do_install () {
  34. cd ${B}/${TARGET_SYS}/libgfortran/
  35. oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/ install
  36. 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. INHIBIT_DEFAULT_DEPS = "1"
  45. DEPENDS = "gcc-runtime gcc-cross-${TARGET_ARCH}"
  46. BBCLASSEXTEND = "nativesdk"
  47. PACKAGES = "\
  48. ${PN}-dbg \
  49. libgfortran \
  50. libgfortran-dev \
  51. libgfortran-staticdev \
  52. "
  53. LICENSE:${PN} = "GPL-3.0-with-GCC-exception"
  54. LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception"
  55. LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception"
  56. FILES:${PN} = "${libdir}/libgfortran.so.*"
  57. FILES:${PN}-dev = "\
  58. ${libdir}/libgfortran*.so \
  59. ${libdir}/libgfortran.spec \
  60. ${libdir}/libgfortran.la \
  61. ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
  62. ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single* \
  63. ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude/ \
  64. ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ \
  65. "
  66. FILES:${PN}-staticdev = "${libdir}/libgfortran.a"
  67. INSANE_SKIP:${MLPREFIX}libgfortran-dev = "staticdev"
  68. do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
  69. do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
  70. do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
  71. python __anonymous () {
  72. f = d.getVar("FORTRAN")
  73. if "fortran" not in f:
  74. raise bb.parse.SkipRecipe("libgfortran needs fortran support to be enabled in the compiler")
  75. }