libultrahdr: init at 1.4.0 (#451276)

This commit is contained in:
Guillaume Girol
2025-10-24 19:14:55 +00:00
committed by GitHub
3 changed files with 138 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5128335..bacf495 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -536,16 +536,6 @@ if(UHDR_BUILD_TESTS)
set(GTEST_LIB_PREFIX ${GTEST_BINARY_DIR}/lib/)
endif()
set(GTEST_BOTH_LIBRARIES ${GTEST_LIB_PREFIX}${GTEST_LIB} ${GTEST_LIB_PREFIX}${GTEST_LIB_MAIN})
- ExternalProject_Add(${GTEST_TARGET_NAME}
- GIT_REPOSITORY https://github.com/google/googletest
- GIT_TAG v1.14.0
- PREFIX ${GTEST_PREFIX_DIR}
- SOURCE_DIR ${GTEST_SOURCE_DIR}
- BINARY_DIR ${GTEST_BINARY_DIR}
- CMAKE_ARGS ${UHDR_CMAKE_ARGS}
- BUILD_BYPRODUCTS ${GTEST_BOTH_LIBRARIES}
- INSTALL_COMMAND ""
- )
endif()
if(UHDR_BUILD_BENCHMARK)
@@ -675,16 +665,15 @@ endif()
if(UHDR_BUILD_TESTS)
add_executable(ultrahdr_unit_test ${UHDR_TEST_SRCS_LIST})
- add_dependencies(ultrahdr_unit_test ${GTEST_TARGET_NAME} ${UHDR_CORE_LIB_NAME})
target_compile_options(ultrahdr_unit_test PRIVATE ${UHDR_WERROR_FLAGS})
target_include_directories(ultrahdr_unit_test PRIVATE
${PRIVATE_INCLUDE_DIR}
- ${GTEST_INCLUDE_DIRS}
+ @GTEST_INCLUDE_DIRS@
)
if(UHDR_BUILD_FUZZERS)
target_link_options(ultrahdr_unit_test PRIVATE -fsanitize=fuzzer-no-link)
endif()
- target_link_libraries(ultrahdr_unit_test ${UHDR_CORE_LIB_NAME} ${GTEST_BOTH_LIBRARIES})
+ target_link_libraries(ultrahdr_unit_test ${UHDR_CORE_LIB_NAME} -lgtest -lgtest_main)
add_test(NAME UHDRUnitTests, COMMAND ultrahdr_unit_test)
endif()
+97
View File
@@ -0,0 +1,97 @@
{
stdenv,
lib,
fetchFromGitHub,
replaceVars,
cmake,
ninja,
pkg-config,
libjpeg,
gtest,
ctestCheckHook,
versionCheckHook,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
version = "1.4.0";
pname = "libultrahdr";
src = fetchFromGitHub {
owner = "google";
repo = "libultrahdr";
rev = "v${finalAttrs.version}";
hash = "sha256-SLhHiwuyHzVx/Kv+eBy8LzHTnShKXlJoszxZNPATbhs=";
};
outputs = [
"out"
"dev"
];
patches = [
(replaceVars ./gtest.patch {
GTEST_INCLUDE_DIRS = "${lib.getDev gtest}/include";
})
];
# CMake incorrect absolute include/lib paths: https://github.com/NixOS/nixpkgs/issues/144170
postPatch = ''
substituteInPlace cmake/libuhdr.pc.in \
--replace-fail \
'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' \
'libdir=@CMAKE_INSTALL_FULL_LIBDIR@' \
--replace-fail \
'includedir=''${prefix}/@CMAKE_INSTALL_INCLUDEDIR@' \
'includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@'
'';
cmakeFlags = [
(lib.cmakeBool "UHDR_BUILD_TESTS" true)
];
nativeBuildInputs = [
cmake
ninja
pkg-config
libjpeg
gtest
];
nativeCheckInputs = [
ctestCheckHook
];
doCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
passthru.tests = {
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
};
meta = {
description = "Reference codec for the Ultra HDR format";
longDescription = ''
Ultra HDR is a true HDR image format, and is backcompatible. libultrahdr
is the reference codec for the Ultra HDR format. The codecs that support
the format can render the HDR intent of the image on HDR displays; other
codecs can still decode and display the SDR intent of the image.
'';
homepage = "https://developer.android.com/media/platform/hdr-image-format";
changelog = "https://github.com/google/libultrahdr/releases/tag/v${finalAttrs.version}";
pkgConfigModules = [ "libuhdr" ];
maintainers = with lib.maintainers; [
yzx9
];
platforms = lib.platforms.all;
license = with lib.licenses; [
asl20
];
mainProgram = "ultrahdr_app";
};
})
+2
View File
@@ -11,6 +11,7 @@
libwebp,
libjxl,
libheif,
libultrahdr,
opencolorio,
openexr,
openjph,
@@ -53,6 +54,7 @@ stdenv.mkDerivation (finalAttrs: {
libpng
libtiff
libwebp
libultrahdr
opencolorio
openexr
openjph