1{
2 lib,
3 stdenv,
4 fetchgit,
5 cmake,
6 libjpeg,
7 gtest,
8}:
9
10stdenv.mkDerivation {
11 pname = "libyuv";
12 version = "1908"; # Defined in: include/libyuv/version.h
13
14 src = fetchgit {
15 url = "https://chromium.googlesource.com/libyuv/libyuv.git";
16 rev = "b7a857659f8485ee3c6769c27a3e74b0af910746"; # upstream does not do tagged releases
17 hash = "sha256-4Irs+hlAvr6v5UKXmKHhg4IK3cTWdsFWxt1QTS0rizU=";
18 };
19
20 nativeBuildInputs = [
21 cmake
22 ];
23
24 cmakeFlags = [
25 "-DUNIT_TEST=ON"
26 ];
27
28 buildInputs = [
29 libjpeg
30 gtest
31 ];
32
33 postPatch = ''
34 mkdir -p $out/lib/pkgconfig
35 cp ${./yuv.pc} $out/lib/pkgconfig/libyuv.pc
36
37 substituteInPlace $out/lib/pkgconfig/libyuv.pc \
38 --replace "@PREFIX@" "$out" \
39 --replace "@VERSION@" "$version"
40 '';
41
42 # [==========] 3454 tests from 8 test suites ran.
43 # [ PASSED ] 3376 tests.
44 # [ FAILED ] 78 tests
45 doCheck = !stdenv.hostPlatform.isLoongArch64;
46
47 checkPhase = ''
48 runHook preCheck
49
50 ./libyuv_unittest
51
52 runHook postCheck
53 '';
54
55 meta = with lib; {
56 homepage = "https://chromium.googlesource.com/libyuv/libyuv";
57 description = "Open source project that includes YUV scaling and conversion functionality";
58 mainProgram = "yuvconvert";
59 platforms = platforms.unix;
60 maintainers = with maintainers; [ leixb ];
61 license = licenses.bsd3;
62 };
63}