diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/opencolorio')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/opencolorio/1.x.nix | 51 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/opencolorio/default.nix | 100 |
2 files changed, 151 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/default.nix b/nixpkgs/pkgs/development/libraries/opencolorio/default.nix new file mode 100644 index 000000000000..40a64077acc9 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/opencolorio/default.nix @@ -0,0 +1,100 @@ +{ stdenv +, lib +, fetchFromGitHub +, fetchpatch +, cmake +, expat +, yaml-cpp +, ilmbase +, 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.2.0"; + + src = fetchFromGitHub { + owner = "AcademySoftwareFoundation"; + repo = "OpenColorIO"; + rev = "v${version}"; + sha256 = "sha256-l5UUysHdP/gb4Mn5A64XEoHOkthl6Mlb95CuI0l4vXQ="; + }; + + patches = [ + (fetchpatch { + name = "darwin-no-hidden-l.patch"; + url = "https://github.com/AcademySoftwareFoundation/OpenColorIO/commit/48bab7c643ed8d108524d718e5038d836f906682.patch"; + revert = true; + sha256 = "sha256-0DF+lwi2nfkUFG0wYvL3HYbhZS6SqGtPWoOabrFS1Eo="; + }) + (fetchpatch { + name = "pkg-config-absolute-path.patch"; + url = "https://github.com/AcademySoftwareFoundation/OpenColorIO/commit/332462e7f5051b7e26ee3d8c22890cd5e71e7c30.patch"; + sha256 = "sha256-7xHALhnOkKszgFBgPIbiZQaORnEJ+1M6RyoZdFgjElM="; + }) + (fetchpatch { + name = "minizip-ng-4.patch"; + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/opencolorio/-/raw/5fc40f42f5c05d905793610c37b46ca3649245f3/minizip-ng-4.patch"; + hash = "sha256-B+dbBVRn0EuGtJaWxz5ah9el0RN7cLb81hgqnKkvhew="; + }) + ]; + + 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 + ilmbase + 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" + # GPU test fails with: freeglut (GPU tests): failed to open display '' + "-DOCIO_BUILD_GPU_TESTS=OFF" + "-Dminizip-ng_INCLUDE_DIR=${minizip-ng}/include" + ] ++ lib.optional (!pythonBindings) "-DOCIO_BUILD_PYTHON=OFF" + ++ lib.optional (!buildApps) "-DOCIO_BUILD_APPS=OFF"; + + # precision issues on non-x86 + doCheck = stdenv.isx86_64; + + 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; + }; +} |