diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/opencolorio')
4 files changed, 177 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/opencolorio/1.x.nix b/nixpkgs/pkgs/development/libraries/opencolorio/1.x.nix new file mode 100644 index 000000000000..0355b9977448 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/opencolorio/1.x.nix @@ -0,0 +1,51 @@ +{ stdenv, lib, fetchFromGitHub, cmake, boost, pkg-config, lcms2, tinyxml, git }: + +stdenv.mkDerivation rec { + pname = "opencolorio"; + version = "1.1.1"; + + src = fetchFromGitHub { + owner = "imageworks"; + repo = "OpenColorIO"; + rev = "v${version}"; + sha256 = "12srvxca51czpfjl0gabpidj9n84mw78ivxy5w75qhq2mmc798sb"; + }; + + outputs = [ "bin" "out" "dev" ]; + + # TODO: Investigate whether git can be dropped: It's only used to apply patches + nativeBuildInputs = [ cmake pkg-config git ]; + + buildInputs = [ lcms2 tinyxml ] ++ lib.optional stdenv.isDarwin boost; + + postPatch = '' + substituteInPlace src/core/CMakeLists.txt --replace "-Werror" "" + substituteInPlace src/pyglue/CMakeLists.txt --replace "-Werror" "" + ''; + + cmakeFlags = [ + "-DUSE_EXTERNAL_LCMS=ON" + "-DUSE_EXTERNAL_TINYXML=ON" + # External yaml-cpp 0.6.* not compatible: https://github.com/imageworks/OpenColorIO/issues/517 + "-DUSE_EXTERNAL_YAML=OFF" + ] ++ lib.optional stdenv.isDarwin "-DOCIO_USE_BOOST_PTR=ON" + ++ lib.optional (!stdenv.hostPlatform.isx86) "-DOCIO_USE_SSE=OFF" + ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) "-DCMAKE_OSX_ARCHITECTURES=arm64"; + + postInstall = '' + moveToOutput bin "$bin" + moveToOutput cmake "$dev" + mv $out/OpenColorIOConfig.cmake $dev/cmake/ + + substituteInPlace "$dev/cmake/OpenColorIO-release.cmake" \ + --replace "$out/bin" "$bin/bin" + ''; + + meta = with lib; { + homepage = "https://opencolorio.org"; + description = "A color management framework for visual effects and animation"; + license = licenses.bsd3; + maintainers = [ maintainers.goibhniu ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/opencolorio/broken-cmake-zlib-version.patch b/nixpkgs/pkgs/development/libraries/opencolorio/broken-cmake-zlib-version.patch new file mode 100644 index 000000000000..e60ebc9e1efe --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/opencolorio/broken-cmake-zlib-version.patch @@ -0,0 +1,17 @@ +diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in +index c122b013..04f36bf0 100644 +--- a/src/cmake/Config.cmake.in ++++ b/src/cmake/Config.cmake.in +@@ -43,11 +43,7 @@ if (NOT @BUILD_SHARED_LIBS@) # NOT @BUILD_SHARED_LIBS@ + # ZLIB_VERSION_STRING is still available for backward compatibility. + # See https://cmake.org/cmake/help/git-stage/module/FindZLIB.html + +- if (@ZLIB_VERSION@) # @ZLIB_VERSION@ +- find_dependency(ZLIB @ZLIB_VERSION@) +- else() +- find_dependency(ZLIB @ZLIB_VERSION_STRING@) +- endif() ++ find_dependency(ZLIB) + endif() + + if (NOT TARGET MINIZIP::minizip-ng) diff --git a/nixpkgs/pkgs/development/libraries/opencolorio/default.nix b/nixpkgs/pkgs/development/libraries/opencolorio/default.nix new file mode 100644 index 000000000000..a5661d6e44e6 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/opencolorio/default.nix @@ -0,0 +1,96 @@ +{ stdenv +, lib +, fetchFromGitHub +, fetchpatch +, cmake +, expat +, yaml-cpp +, pystring +, imath +, minizip-ng +# Only required on Linux +, glew +, freeglut +# Only required on Darwin +, Carbon +, GLUT +, Cocoa +# Python bindings +, pythonBindings ? true # Python bindings +, python3Packages +# Build apps +, buildApps ? true # Utility applications +, lcms2 +, openexr_3 +}: + +stdenv.mkDerivation rec { + pname = "opencolorio"; + version = "2.3.0"; + + src = fetchFromGitHub { + owner = "AcademySoftwareFoundation"; + repo = "OpenColorIO"; + rev = "v${version}"; + sha256 = "sha256-E4TmMEFzI3nKqiDFaAkNx44uo84sacvZqjbfWe3A8fE="; + }; + + patches = [ + (fetchpatch { + # Taken from https://github.com/AcademySoftwareFoundation/OpenColorIO/pull/1891. + name = "opencolorio-yaml-cpp-8.0-compat.patch"; + url = "https://github.com/AcademySoftwareFoundation/OpenColorIO/commit/e99b4afcf0408d8ec56fdf2b9380327c9284db00.patch"; + sha256 = "sha256-7eIvVWKcpE0lmuYdNqFQFHkW/sSSzQ//LNIMOC28KZg="; + }) + # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/25200. + # Needed for zlib >= 1.3 && cmake < 3.27.4. + ./broken-cmake-zlib-version.patch + # Fix incorrect line number in test + ./line-numbers.patch + ]; + + postPatch = lib.optionalString stdenv.isDarwin '' + # these tests don't like being run headless on darwin. no builtin + # way of skipping tests so this is what we're reduced to. + substituteInPlace tests/cpu/Config_tests.cpp \ + --replace 'OCIO_ADD_TEST(Config, virtual_display)' 'static void _skip_virtual_display()' \ + --replace 'OCIO_ADD_TEST(Config, virtual_display_with_active_displays)' 'static void _skip_virtual_display_with_active_displays()' + ''; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ + expat + yaml-cpp + pystring + imath + minizip-ng + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ glew freeglut ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ Carbon GLUT Cocoa ] + ++ lib.optionals pythonBindings [ python3Packages.python python3Packages.pybind11 ] + ++ lib.optionals buildApps [ + lcms2 + openexr_3 + ]; + + cmakeFlags = [ + "-DOCIO_INSTALL_EXT_PACKAGES=NONE" + "-DOCIO_USE_SSE2NEON=OFF" + # GPU test fails with: freeglut (GPU tests): failed to open display '' + "-DOCIO_BUILD_GPU_TESTS=OFF" + "-Dminizip-ng_INCLUDE_DIR=${minizip-ng}/include/minizip-ng" + ] ++ lib.optional (!pythonBindings) "-DOCIO_BUILD_PYTHON=OFF" + ++ lib.optional (!buildApps) "-DOCIO_BUILD_APPS=OFF"; + + # precision issues on non-x86 + doCheck = stdenv.isx86_64; + # Tends to fail otherwise. + enableParallelChecking = false; + + meta = with lib; { + homepage = "https://opencolorio.org"; + description = "A color management framework for visual effects and animation"; + license = licenses.bsd3; + maintainers = [ maintainers.rytone ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/opencolorio/line-numbers.patch b/nixpkgs/pkgs/development/libraries/opencolorio/line-numbers.patch new file mode 100644 index 000000000000..21b6820b4f86 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/opencolorio/line-numbers.patch @@ -0,0 +1,13 @@ +diff --git a/tests/cpu/fileformats/FileFormatCTF_tests.cpp b/tests/cpu/fileformats/FileFormatCTF_tests.cpp +index 7a7ab67b..18c1f55e 100644 +--- a/tests/cpu/fileformats/FileFormatCTF_tests.cpp ++++ b/tests/cpu/fileformats/FileFormatCTF_tests.cpp +@@ -1416,7 +1416,7 @@ OCIO_ADD_TEST(FileFormatCTF, difficult_xml_unknown_elements) + "(37): Unrecognized element 'just_ignore' where its parent is 'ProcessList' (8): Unknown element", + "(69): Unrecognized element 'just_ignore' where its parent is 'Description' (66)", + "(70): Unrecognized element 'just_ignore' where its parent is 'just_ignore' (69)", +- "(75): Unrecognized element 'Matrix' where its parent is 'LUT1D' (43): 'Matrix' not allowed in this element", ++ "(75): Unrecognized element 'Matrix' where its parent is 'LUT1D' (46): 'Matrix' not allowed in this element", + "(76): Unrecognized element 'Description' where its parent is 'Matrix' (75)", + "(77): Unrecognized element 'Array' where its parent is 'Matrix' (75)" + }; |