1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 scikit-build-core,
6 cmake,
7 ninja,
8 stdenv,
9 llvmPackages,
10 boost,
11 python,
12}:
13
14buildPythonPackage rec {
15 pname = "opencamlib";
16 version = "2023.01.11";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "aewallin";
21 repo = "opencamlib";
22 tag = version;
23 hash = "sha256-pUj71PdWo902dqF9O6SLnpvFooFU2OfLBv8hAVsH/iA=";
24 };
25
26 build-system = [
27 scikit-build-core
28 ];
29
30 buildInputs = [
31 boost
32 ] ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
33
34 nativeBuildInputs = [
35 cmake
36 ninja
37 ];
38
39 postPatch = ''
40 substituteInPlace pyproject.toml \
41 --replace-fail 'version = "2022.12.18"' 'version = "${version}"'
42 '';
43
44 dontUseCmakeConfigure = true;
45 env.CMAKE_ARGS = "-DVERSION_STRING=${version} -DBoost_USE_STATIC_LIBS=OFF";
46
47 pythonImportsCheck = [ "opencamlib" ];
48
49 checkPhase = ''
50 runHook preCheck
51
52 pushd examples/python
53 # this produces a lot of non-actionalble lines on stdout
54 ${python.interpreter} test.py > /dev/null
55 popd
56
57 runHook postCheck
58 '';
59
60 meta = {
61 homepage = "https://github.com/aewallin/opencamlib";
62 description = "Open source computer aided manufacturing algorithms library";
63 # from src/deb/debian_copyright.txt
64 license = lib.licenses.lgpl21Plus;
65 maintainers = with lib.maintainers; [ tomjnixon ];
66 };
67}