From da7ae1dd1fccb6b3c0e4763ab983ad96d57bf463 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 20 Apr 2024 12:05:24 +0100 Subject: gentoo auto-resync : 20:04:2024 - 12:05:23 --- eclass/distutils-r1.eclass | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'eclass/distutils-r1.eclass') diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 7a314673a90b..a67122a59a33 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -448,6 +448,15 @@ unset -f _distutils_set_globals # An array containing options to be passed to the build system. # Supported by a subset of build systems used by the eclass. # +# For maturin, the arguments will be passed as `maturin build` +# arguments. +# +# For meson-python, the arguments will be passed as `meson setup` +# arguments. +# +# For scikit-build-core, the arguments will be passed as `cmake` +# options (e.g. `-DFOO=BAR` form should be used). +# # For setuptools, the arguments will be passed as first parameters # to setup.py invocations (via esetup.py), as well as to the PEP517 # backend. For future compatibility, only global options should be used @@ -1406,6 +1415,46 @@ distutils_pep517_install() { EOF ) ;; + scikit-build-core) + # TODO: split out the config/toolchain logic from cmake.eclass + # for now, we copy the most important bits + local CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-RelWithDebInfo} + cat >> "${BUILD_DIR}"/config.cmake <<- _EOF_ || die + set(CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + set(CMAKE_ASM-ATT_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + set(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + set(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + set(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + set(CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + set(CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + set(CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + set(CMAKE_STATIC_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + _EOF_ + + # hack around CMake ignoring CPPFLAGS + local -x CFLAGS="${CFLAGS} ${CPPFLAGS}" + local -x CXXFLAGS="${CXXFLAGS} ${CPPFLAGS}" + + local cmake_args=( + "-C${BUILD_DIR}/config.cmake" + "${DISTUTILS_ARGS[@]}" + ) + + # NB: we need to pass strings for boolean fields + # https://github.com/scikit-build/scikit-build-core/issues/707 + config_settings=$( + "${EPYTHON}" - "${cmake_args[@]}" <<-EOF || die + import json + import sys + print(json.dumps({ + "cmake.args": ";".join(sys.argv[1:]), + "cmake.build-type": "${CMAKE_BUILD_TYPE}", + "cmake.verbose": "true", + "install.strip": "false", + })) + EOF + ) + ;; setuptools) if in_iuse debug && use debug; then local -x SETUPTOOLS_RUST_CARGO_PROFILE=dev -- cgit v1.2.3