1{
2 lib,
3 stdenv,
4 python,
5 buildPythonPackage,
6 fetchFromGitHub,
7 setuptools,
8 boost,
9 cgal,
10 cmake,
11 gmp,
12 tbb,
13 LAStools,
14 eigen,
15 mpfr,
16 numpy,
17 swig,
18 zlib,
19 withLAS ? false, # unfree
20}:
21
22buildPythonPackage rec {
23 pname = "cgal";
24 version = "6.0.1.post202410241521";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "CGAL";
29 repo = "cgal-swig-bindings";
30 tag = "v${version}";
31 hash = "sha256-MnUsl4ozMamKcQ13TV6mtoG7VKq8BuiDSIVq1RPn2rs=";
32 };
33
34 dontUseCmakeConfigure = true;
35
36 build-system = [
37 setuptools
38 cmake
39 swig
40 ];
41
42 buildInputs = [
43 cgal
44 gmp
45 mpfr
46 boost
47 zlib
48 tbb
49 eigen
50 ]
51 ++ lib.optionals withLAS [
52 LAStools
53 ];
54
55 dependencies = [
56 numpy
57 ];
58
59 pythonImportsCheck = [ "CGAL" ];
60
61 postFixup = lib.optionalString stdenv.hostPlatform.isElf ''
62 mv $out/${python.sitePackages}/{lib,CGAL/_lib}
63 for file in $out/${python.sitePackages}/CGAL/_*.so; do
64 patchelf "$file" --add-rpath $out/${python.sitePackages}/CGAL/_lib
65 done
66 '';
67
68 checkPhase = ''
69 runHook preCheck
70 (cd examples/python/
71 bash ./test.sh
72 cat error.txt
73 if grep -qi ' run error$' <error.txt; then
74 false
75 fi
76 )
77 runHook postCheck
78 '';
79
80 meta = {
81 description = "CGAL bindings using SWIG";
82 homepage = "https://github.com/CGAL/cgal-swig-bindings";
83 license = lib.licenses.gpl3Plus;
84 maintainers = with lib.maintainers; [ pbsds ];
85 };
86}