1{
2 lib,
3 stdenv,
4 python,
5 fetchFromGitHub,
6 cmake,
7 Cocoa,
8 fontconfig,
9 freetype,
10 libGL,
11 libGLU,
12 libX11,
13 libXext,
14 libXi,
15 libXmu,
16 opencascade-occt,
17 rapidjson,
18 swig4,
19}:
20
21stdenv.mkDerivation rec {
22 pname = "pythonocc-core";
23 version = "7.6.2";
24
25 src = fetchFromGitHub {
26 owner = "tpaviot";
27 repo = "pythonocc-core";
28 rev = "refs/tags/${version}";
29 hash = "sha256-45pqPQ07KYlpFwJSAYVHbzuqDQTbAvPpxReal52DCzU=";
30 };
31
32 postPatch = ''
33 substituteInPlace CMakeLists.txt \
34 --replace "/usr/X11R6/lib/libGL.dylib" "${libGL}/lib/libGL.dylib" \
35 --replace "/usr/X11R6/lib/libGLU.dylib" "${libGLU}/lib/libGLU.dylib"
36 '';
37
38 nativeBuildInputs = [
39 cmake
40 swig4
41 ];
42 buildInputs = [
43 python
44 opencascade-occt
45 freetype
46 libGL
47 libGLU
48 libX11
49 libXext
50 libXmu
51 libXi
52 fontconfig
53 rapidjson
54 ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
55
56 cmakeFlags = [
57 "-Wno-dev"
58 "-DPYTHONOCC_INSTALL_DIRECTORY=${placeholder "out"}/${python.sitePackages}/OCC"
59 ];
60
61 passthru = {
62 # `python3Packages.pythonocc-core` must be updated in tandem with
63 # `opencascade-occt`, and including it in the bulk updates often breaks it.
64 skipBulkUpdate = true;
65 };
66
67 meta = with lib; {
68 description = "Python wrapper for the OpenCASCADE 3D modeling kernel";
69 homepage = "https://github.com/tpaviot/pythonocc-core";
70 changelog = "https://github.com/tpaviot/pythonocc-core/releases/tag/${version}";
71 license = licenses.lgpl3;
72 platforms = platforms.unix;
73 maintainers = with maintainers; [ gebner ];
74 };
75}