nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 cmake,
5 fetchFromGitHub,
6 pkg-config,
7
8 bzip2,
9 feather-tk,
10 ffmpeg_7,
11 freetype,
12 glfw,
13 imath,
14 libGL,
15 libjpeg,
16 libtiff,
17 libpng,
18 lunasvg,
19 minizip-ng,
20 nasm,
21 nativefiledialog-extended,
22 nlohmann_json,
23 opencolorio,
24 openexr,
25 openssl,
26 opentimelineio,
27 openusd,
28 plutovg,
29 SDL2,
30 sdl3,
31 xz,
32 zlib,
33 zstd,
34
35 # optional dependencies
36 enableNet ? false,
37 enableOcio ? true,
38 enableSdl2 ? true,
39 enableSdl3 ? false,
40 enableJpeg ? true,
41 enableTiff ? true,
42 enableStb ? true,
43 enablePng ? true,
44 enableOpenexr ? true,
45 enableFfmpeg ? true,
46 enableUsd ? false,
47
48 # build options
49 enableShared ? !stdenv.hostPlatform.isStatic,
50 enableProgram ? true,
51 enableExamples ? false,
52}:
53
54stdenv.mkDerivation (finalAttrs: {
55 pname = "tlrender";
56 version = "0.10.0";
57
58 src = fetchFromGitHub {
59 owner = "darbyjohnston";
60 repo = "tlRender";
61 tag = finalAttrs.version;
62 hash = "sha256-TxiDZtMvNmrV1FKXZnekCZHnr/eCWZlsP6VJRnaoWg4=";
63 };
64
65 patches = [
66 # Minizip-ng 4 support: https://github.com/darbyjohnston/tlRender/pull/145
67 ./minizip-ng-4.patch
68 ];
69
70 postPatch = ''
71 substituteInPlace CMakeLists.txt \
72 --replace-fail "include(Package)" ""
73
74 substituteInPlace lib/tlCore/CMakeLists.txt \
75 --replace-fail "SDL2::SDL2-static" "SDL2::SDL2" \
76 --replace-fail "SDL3::SDL3-static" "SDL3::SDL3" \
77
78 substituteInPlace lib/tlIO/CMakeLists.txt \
79 --replace-fail \
80 "list(APPEND LIBRARIES_PRIVATE libjpeg-turbo::turbojpeg-static)" \
81 "list(APPEND LIBRARIES_PRIVATE libjpeg-turbo::jpeg libjpeg-turbo::turbojpeg)"
82 '';
83
84 nativeBuildInputs = [
85 cmake
86 pkg-config
87 ];
88
89 buildInputs = [
90 bzip2 # required by minizip-ng
91 feather-tk
92 freetype # required by feather-tk
93 glfw
94 libGL
95 lunasvg # required by feather-tk
96 imath
97 minizip-ng
98 nativefiledialog-extended
99 nlohmann_json
100 openssl # required by minizip-ng
101 opentimelineio
102 plutovg # required by feather-tk -> lunasvg
103 xz # libLZMA, required by minizip-ng
104 zlib # required by minizip-ng
105 zstd # required by minizip-ng
106 ]
107 ++ lib.optionals enableNet [ nasm ]
108 ++ lib.optionals enableOcio [ opencolorio ]
109 ++ lib.optionals enableSdl2 [ SDL2 ]
110 ++ lib.optionals enableSdl3 [ sdl3 ]
111 ++ lib.optionals enableJpeg [ libjpeg ]
112 ++ lib.optionals enableTiff [ libtiff ]
113 ++ lib.optionals enablePng [ libpng ]
114 ++ lib.optionals enableOpenexr [ openexr ]
115 ++ lib.optionals enableFfmpeg [ ffmpeg_7 ]
116 ++ lib.optionals enableUsd [ openusd ];
117
118 cmakeFlags = [
119 (lib.cmakeBool "TLRENDER_NET" enableNet)
120 (lib.cmakeBool "TLRENDER_OCIO" enableOcio)
121 (lib.cmakeBool "TLRENDER_SDL2" enableSdl2)
122 (lib.cmakeBool "TLRENDER_SDL3" enableSdl3)
123 (lib.cmakeBool "TLRENDER_JPEG" enableJpeg)
124 (lib.cmakeBool "TLRENDER_TIFF" enableTiff)
125 (lib.cmakeBool "TLRENDER_STB" enableStb)
126 (lib.cmakeBool "TLRENDER_PNG" enablePng)
127 (lib.cmakeBool "TLRENDER_EXR" enableOpenexr)
128 (lib.cmakeBool "TLRENDER_FFMPEG" enableFfmpeg)
129 (lib.cmakeBool "TLRENDER_USD" enableUsd)
130
131 (lib.cmakeBool "BUILD_SHARED_LIBS" enableShared)
132 (lib.cmakeBool "TLRENDER_PROGRAMS" enableProgram)
133 (lib.cmakeBool "TLRENDER_EXAMPLES" enableExamples)
134 (lib.cmakeBool "TLRENDER_TESTS" finalAttrs.finalPackage.doCheck)
135 ];
136
137 # GLFW requires a working X11 session.
138 doCheck = false;
139
140 meta = {
141 description = "Open source library for building playback and review applications";
142 longDescription = ''
143 An open source library for building playback and review applications for
144 visual effects, film, and animation.
145
146 The library can render and playback timelines with multiple video clips,
147 image sequences, audio clips, and transitions. Examples are provided for
148 integrating the library with Qt and OpenGL applications.
149 '';
150 homepage = "https://github.com/darbyjohnston/tlRender";
151 license = lib.licenses.bsd3;
152 maintainers = with lib.maintainers; [ yzx9 ];
153 platforms = with lib.platforms; linux ++ darwin;
154 };
155})