diff --git a/pkgs/development/python-modules/soxr/cmake-nanobind.patch b/pkgs/development/python-modules/soxr/cmake-nanobind.patch new file mode 100644 index 000000000000..2f527e7a1692 --- /dev/null +++ b/pkgs/development/python-modules/soxr/cmake-nanobind.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index eb701aa..6cb4b02 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,6 +32,11 @@ find_package(Python 3.9 + REQUIRED COMPONENTS Interpreter Development.Module + OPTIONAL_COMPONENTS Development.SABIModule) + ++execute_process( ++ COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir ++ OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE NB_DIR) ++list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}") ++ + find_package(nanobind CONFIG REQUIRED) + + if (USE_SYSTEM_LIBSOXR) diff --git a/pkgs/development/python-modules/soxr/default.nix b/pkgs/development/python-modules/soxr/default.nix index 841ba83259f7..9095dcb7ae7f 100644 --- a/pkgs/development/python-modules/soxr/default.nix +++ b/pkgs/development/python-modules/soxr/default.nix @@ -2,51 +2,68 @@ lib, buildPythonPackage, fetchFromGitHub, + pythonOlder, # build-system - cython, - numpy, - oldest-supported-numpy, + cmake, + nanobind, + ninja, + scikit-build-core, setuptools, setuptools-scm, - gnutar, + typing-extensions, - # native + # native dependencies libsoxr, + # dependencies + numpy, + # tests pytestCheckHook, }: buildPythonPackage rec { pname = "soxr"; - version = "0.3.7"; - format = "pyproject"; + version = "0.5.0.post1"; + pyproject = true; src = fetchFromGitHub { owner = "dofuuz"; repo = "python-soxr"; rev = "refs/tags/v${version}"; fetchSubmodules = true; - hash = "sha256-HGtoMfMQ5/2iEIFtik7mCrSxFnLXkSSx2W8wBul0+jk="; + hash = "sha256-Fpayc+MOpDUCdpoyJaIqSbMzuO0jYb6UN5ARFaxxOHk="; }; - postPatch = '' - substituteInPlace setup.py \ - --replace "SYS_LIBSOXR = False" "SYS_LIBSOXR = True" - ''; + patches = [ ./cmake-nanobind.patch ]; nativeBuildInputs = [ - cython - gnutar - numpy - oldest-supported-numpy - setuptools - setuptools-scm + cmake + ninja ]; + dontUseCmakeConfigure = true; + + pypaBuildFlags = [ + "--config=cmake.define.USE_SYSTEM_LIBSOXR=ON" + ]; + + build-system = + [ + scikit-build-core + nanobind + setuptools + setuptools-scm + ] + ++ lib.optionals (pythonOlder "3.11") [ + typing-extensions + ]; + buildInputs = [ libsoxr ]; + dependencies = [ numpy ]; + pythonImportsCheck = [ "soxr" ]; nativeCheckInputs = [ pytestCheckHook ];