python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / opencolorio / default.nix
blob53a37da01fd63f056949a0052491f9d47ea91ce8
1 { stdenv
2 , lib
3 , fetchFromGitHub
4 , fetchpatch
5 , cmake
6 , expat
7 , libyamlcpp
8 , ilmbase
9 , pystring
10 , imath
11 # Only required on Linux
12 , glew
13 , freeglut
14 # Only required on Darwin
15 , Carbon
16 , GLUT
17 , Cocoa
18 # Python bindings
19 , pythonBindings ? true # Python bindings
20 , python3Packages
21 # Build apps
22 , buildApps ? true # Utility applications
23 , lcms2
24 , openimageio2
25 , openexr
28 stdenv.mkDerivation rec {
29   pname = "opencolorio";
30   version = "2.1.2";
32   src = fetchFromGitHub {
33     owner = "AcademySoftwareFoundation";
34     repo = "OpenColorIO";
35     rev = "v${version}";
36     sha256 = "sha256-e1PpWjjfSjtgN9Rs/+lsA45Z9S4y4T6nqrJ02DZ4vjs=";
37   };
39   patches = [
40     (fetchpatch {
41       name = "darwin-no-hidden-l.patch";
42       url = "https://github.com/AcademySoftwareFoundation/OpenColorIO/commit/48bab7c643ed8d108524d718e5038d836f906682.patch";
43       revert = true;
44       sha256 = "sha256-0DF+lwi2nfkUFG0wYvL3HYbhZS6SqGtPWoOabrFS1Eo=";
45     })
46   ];
48   nativeBuildInputs = [ cmake ];
49   buildInputs = [
50     expat
51     libyamlcpp
52     ilmbase
53     pystring
54     imath
55   ] ++ lib.optionals stdenv.hostPlatform.isLinux [ glew freeglut ]
56     ++ lib.optionals stdenv.hostPlatform.isDarwin [ Carbon GLUT Cocoa ]
57     ++ lib.optionals pythonBindings [ python3Packages.python python3Packages.pybind11 ]
58     ++ lib.optionals buildApps [ lcms2 openimageio2 openexr ];
60     cmakeFlags = [
61       "-DOCIO_INSTALL_EXT_PACKAGES=NONE"
62     ] ++ lib.optional (!pythonBindings) "-DOCIO_BUILD_PYTHON=OFF"
63       ++ lib.optional (!buildApps) "-DOCIO_BUILD_APPS=OFF";
65   # TODO Investigate this: Python and GPU tests fail to load libOpenColorIO.so.2.0
66   # doCheck = true;
68   # https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/1649
69   postPatch = ''
70     substituteInPlace src/OpenColorIO/CMakeLists.txt \
71       --replace '\$'{exec_prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR} \
72       --replace '\$'{exec_prefix}/'$'{CMAKE_INSTALL_LIBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR}
73   '';
75   meta = with lib; {
76     homepage = "https://opencolorio.org";
77     description = "A color management framework for visual effects and animation";
78     license = licenses.bsd3;
79     maintainers = [ maintainers.rytone ];
80     platforms = platforms.unix;
81   };