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 [
44 cgal
45 gmp
46 mpfr
47 boost
48 zlib
49 tbb
50 eigen
51 ]
52 ++ lib.optionals withLAS [
53 LAStools
54 ];
55
56 dependencies = [
57 numpy
58 ];
59
60 pythonImportsCheck = [ "CGAL" ];
61
62 postFixup = lib.optionalString stdenv.hostPlatform.isElf ''
63 mv $out/${python.sitePackages}/{lib,CGAL/_lib}
64 for file in $out/${python.sitePackages}/CGAL/_*.so; do
65 patchelf "$file" --add-rpath $out/${python.sitePackages}/CGAL/_lib
66 done
67 '';
68
69 checkPhase = ''
70 runHook preCheck
71 (cd examples/python/
72 bash ./test.sh
73 cat error.txt
74 if grep -qi ' run error$' <error.txt; then
75 false
76 fi
77 )
78 runHook postCheck
79 '';
80
81 meta = {
82 description = "CGAL bindings using SWIG";
83 homepage = "https://github.com/CGAL/cgal-swig-bindings";
84 license = lib.licenses.gpl3Plus;
85 maintainers = with lib.maintainers; [ pbsds ];
86 };
87}