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 ]
33 ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
34
35 nativeBuildInputs = [
36 cmake
37 ninja
38 ];
39
40 postPatch = ''
41 substituteInPlace pyproject.toml \
42 --replace-fail 'version = "2022.12.18"' 'version = "${version}"'
43 '';
44
45 dontUseCmakeConfigure = true;
46 env.CMAKE_ARGS = "-DVERSION_STRING=${version} -DBoost_USE_STATIC_LIBS=OFF";
47
48 pythonImportsCheck = [ "opencamlib" ];
49
50 checkPhase = ''
51 runHook preCheck
52
53 pushd examples/python
54 # this produces a lot of non-actionalble lines on stdout
55 ${python.interpreter} test.py > /dev/null
56 popd
57
58 runHook postCheck
59 '';
60
61 meta = {
62 homepage = "https://github.com/aewallin/opencamlib";
63 description = "Open source computer aided manufacturing algorithms library";
64 # from src/deb/debian_copyright.txt
65 license = lib.licenses.lgpl21Plus;
66 maintainers = with lib.maintainers; [ tomjnixon ];
67 };
68}