Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 expat,
7 yaml-cpp,
8 pystring,
9 imath,
10 minizip-ng,
11 zlib,
12 # Only required on Linux
13 glew,
14 libglut,
15 # Python bindings
16 pythonBindings ? true, # Python bindings
17 python3Packages,
18 # Build apps
19 buildApps ? true, # Utility applications
20 lcms2,
21 openexr,
22}:
23
24stdenv.mkDerivation rec {
25 pname = "opencolorio";
26 version = "2.4.2";
27
28 src = fetchFromGitHub {
29 owner = "AcademySoftwareFoundation";
30 repo = "OpenColorIO";
31 rev = "v${version}";
32 hash = "sha256-+P7T8UZuQEVmsMykSWtUxg0vC7Sr4fQJpovCU5sKtsA=";
33 };
34
35 patches = [
36 # Fix incorrect line number in test
37 ./line-numbers.patch
38 ];
39
40 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
41 # these tests don't like being run headless on darwin. no builtin
42 # way of skipping tests so this is what we're reduced to.
43 substituteInPlace tests/cpu/Config_tests.cpp \
44 --replace 'OCIO_ADD_TEST(Config, virtual_display)' 'static void _skip_virtual_display()' \
45 --replace 'OCIO_ADD_TEST(Config, virtual_display_with_active_displays)' 'static void _skip_virtual_display_with_active_displays()'
46 '';
47
48 nativeBuildInputs = [ cmake ] ++ lib.optionals pythonBindings [ python3Packages.python ];
49 buildInputs = [
50 expat
51 yaml-cpp
52 pystring
53 imath
54 minizip-ng
55 zlib
56 ]
57 ++ lib.optionals stdenv.hostPlatform.isLinux [
58 glew
59 libglut
60 ]
61 ++ lib.optionals pythonBindings [
62 python3Packages.python
63 python3Packages.pybind11
64 ]
65 ++ lib.optionals buildApps [
66 lcms2
67 openexr
68 ];
69
70 cmakeFlags = [
71 "-DOCIO_INSTALL_EXT_PACKAGES=NONE"
72 "-DOCIO_USE_SSE2NEON=OFF"
73 # GPU test fails with: libglut (GPU tests): failed to open display ''
74 "-DOCIO_BUILD_GPU_TESTS=OFF"
75 "-Dminizip-ng_INCLUDE_DIR=${minizip-ng}/include/minizip-ng"
76 ]
77 ++ lib.optional (!pythonBindings) "-DOCIO_BUILD_PYTHON=OFF"
78 ++ lib.optional (!buildApps) "-DOCIO_BUILD_APPS=OFF";
79
80 # precision issues on non-x86
81 doCheck = stdenv.hostPlatform.isx86_64;
82 # Tends to fail otherwise.
83 enableParallelChecking = false;
84
85 meta = with lib; {
86 homepage = "https://opencolorio.org";
87 description = "Color management framework for visual effects and animation";
88 license = licenses.bsd3;
89 maintainers = [ maintainers.rytone ];
90 platforms = platforms.unix;
91 };
92}