1{
2 lib,
3 stdenv,
4 toPythonModule,
5 fetchpatch,
6 cmake,
7 pybind11,
8 orocos-kdl,
9 eigen,
10 python,
11}:
12
13toPythonModule (
14 stdenv.mkDerivation {
15 pname = "pykdl";
16 inherit (orocos-kdl) version src;
17
18 sourceRoot = "${orocos-kdl.src.name}/python_orocos_kdl";
19
20 patches = [
21 # Support system pybind11; the vendored copy doesn't support Python 3.11
22 (fetchpatch {
23 url = "https://github.com/orocos/orocos_kinematics_dynamics/commit/e25a13fc5820dbca6b23d10506407bca9bcdd25f.patch";
24 hash = "sha256-NGMVGEYsa7hVX+SgRZgeSm93BqxFR1uiyFvzyF5H0Y4=";
25 stripLen = 1;
26 })
27 ];
28
29 # Fix hardcoded installation path
30 postPatch = ''
31 substituteInPlace CMakeLists.txt \
32 --replace dist-packages site-packages
33 '';
34
35 nativeBuildInputs = [
36 cmake
37 pybind11
38 ];
39 buildInputs = [
40 orocos-kdl
41 eigen
42 ];
43 propagatedBuildInputs = [ python ];
44
45 cmakeFlags = [ "-DPYTHON_EXECUTABLE=${lib.getExe python.pythonOnBuildForHost}" ];
46
47 meta = with lib; {
48 description = "Kinematics and Dynamics Library (Python bindings)";
49 homepage = "https://www.orocos.org/kdl.html";
50 license = licenses.lgpl21Only;
51 maintainers = with maintainers; [ lopsided98 ];
52 platforms = platforms.all;
53 };
54 }
55)