python_pyo3.bbclass 867 B

123456789101112131415161718192021222324252627282930313233343536
  1. #
  2. # Copyright OpenEmbedded Contributors
  3. #
  4. # SPDX-License-Identifier: MIT
  5. #
  6. #
  7. # This class helps make sure that Python extensions built with PyO3
  8. # and setuptools_rust properly set up the environment for cross compilation
  9. #
  10. inherit cargo python3-dir siteinfo
  11. export PYO3_CROSS = "1"
  12. export PYO3_CROSS_PYTHON_VERSION = "${PYTHON_BASEVERSION}"
  13. export PYO3_CROSS_LIB_DIR = "${STAGING_LIBDIR}"
  14. export CARGO_BUILD_TARGET = "${RUST_HOST_SYS}"
  15. export RUSTFLAGS
  16. export PYO3_PYTHON = "${PYTHON}"
  17. export PYO3_CONFIG_FILE = "${WORKDIR}/pyo3.config"
  18. python_pyo3_do_configure () {
  19. cat > ${WORKDIR}/pyo3.config << EOF
  20. implementation=CPython
  21. version=${PYTHON_BASEVERSION}
  22. shared=true
  23. abi3=false
  24. lib_name=${PYTHON_DIR}
  25. lib_dir=${STAGING_LIBDIR}
  26. pointer_width=${SITEINFO_BITS}
  27. build_flags=WITH_THREAD
  28. suppress_build_script_link_lines=false
  29. EOF
  30. }
  31. EXPORT_FUNCTIONS do_configure