fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
2, hostPlatform
3/*
4 * Licensing options (yes some are listed twice, filters and such are not listed)
5 */
6, gplLicensing ? true # GPL: fdkaac,openssl,frei0r,cdio,samba,utvideo,vidstab,x265,x265,xavs,avid,zvbi,x11grab
7, version3Licensing ? true # (L)GPL3: opencore-amrnb,opencore-amrwb,samba,vo-aacenc,vo-amrwbenc
8, nonfreeLicensing ? false # NONFREE: openssl,fdkaac,blackmagic-design-desktop-video
9/*
10 * Build options
11 */
12, smallBuild ? false # Optimize for size instead of speed
13, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime (disable to compile natively)
14, grayBuild ? true # Full grayscale support
15, swscaleAlphaBuild ? true # Alpha channel support in swscale
16, hardcodedTablesBuild ? true # Hardcode decode tables instead of runtime generation
17, safeBitstreamReaderBuild ? true # Buffer boundary checking in bitreaders
18, multithreadBuild ? true # Multithreading via pthreads/win32 threads
19, networkBuild ? true # Network support
20, pixelutilsBuild ? true # Pixel utils in libavutil
21, enableLto ? false # build with link-time optimization
22/*
23 * Program options
24 */
25, ffmpegProgram ? true # Build ffmpeg executable
26, ffplayProgram ? true # Build ffplay executable
27, ffprobeProgram ? true # Build ffprobe executable
28, ffserverProgram ? true # Build ffserver executable
29, qtFaststartProgram ? true # Build qt-faststart executable
30/*
31 * Library options
32 */
33, avcodecLibrary ? true # Build avcodec library
34, avdeviceLibrary ? true # Build avdevice library
35, avfilterLibrary ? true # Build avfilter library
36, avformatLibrary ? true # Build avformat library
37, avresampleLibrary ? true # Build avresample library
38, avutilLibrary ? true # Build avutil library
39, postprocLibrary ? true # Build postproc library
40, swresampleLibrary ? true # Build swresample library
41, swscaleLibrary ? true # Build swscale library
42/*
43 * Documentation options
44 */
45, htmlpagesDocumentation ? false # HTML documentation pages
46, manpagesDocumentation ? true # Man documentation pages
47, podpagesDocumentation ? false # POD documentation pages
48, txtpagesDocumentation ? false # Text documentation pages
49/*
50 * External libraries options
51 */
52, alsaLib ? null # Alsa in/output support
53#, avisynth ? null # Support for reading AviSynth scripts
54, bzip2 ? null
55, celt ? null # CELT decoder
56#, crystalhd ? null # Broadcom CrystalHD hardware acceleration
57#, decklinkExtlib ? false, blackmagic-design-desktop-video ? null # Blackmagic Design DeckLink I/O support
58, fdkaacExtlib ? false, fdk_aac ? null # Fraunhofer FDK AAC de/encoder
59#, flite ? null # Flite (voice synthesis) support
60, fontconfig ? null # Needed for drawtext filter
61, freetype ? null # Needed for drawtext filter
62, frei0r ? null # frei0r video filtering
63, fribidi ? null # Needed for drawtext filter
64, game-music-emu ? null # Game Music Emulator
65, gnutls ? null
66, gsm ? null # GSM de/encoder
67#, ilbc ? null # iLBC de/encoder
68, libjack2 ? null # Jack audio (only version 2 is supported in this build)
69, ladspaH ? null # LADSPA audio filtering
70, lame ? null # LAME MP3 encoder
71, libass ? null # (Advanced) SubStation Alpha subtitle rendering
72, libbluray ? null # BluRay reading
73, libbs2b ? null # bs2b DSP library
74, libcaca ? null # Textual display (ASCII art)
75#, libcdio-paranoia ? null # Audio CD grabbing
76, libdc1394 ? null, libraw1394 ? null # IIDC-1394 grabbing (ieee 1394)
77, libiconv ? null
78#, libiec61883 ? null, libavc1394 ? null # iec61883 (also uses libraw1394)
79#, libmfx ? null # Hardware acceleration vis libmfx
80, libmodplug ? null # ModPlug support
81#, libnut ? null # NUT (de)muxer, native (de)muser exists
82, libogg ? null # Ogg container used by vorbis & theora
83, libopus ? null # Opus de/encoder
84, libsndio ? null # sndio playback/record support
85, libssh ? null # SFTP protocol
86, libtheora ? null # Theora encoder
87, libv4l ? null # Video 4 Linux support
88, libva ? null # Vaapi hardware acceleration
89, libvdpau ? null # Vdpau hardware acceleration
90, libvorbis ? null # Vorbis de/encoding, native encoder exists
91, libvpx ? null # VP8 & VP9 de/encoding
92, libwebp ? null # WebP encoder
93, libX11 ? null # Xlib support
94, libxcb ? null # X11 grabbing using XCB
95, libxcbshmExtlib ? true # X11 grabbing shm communication
96, libxcbxfixesExtlib ? true # X11 grabbing mouse rendering
97, libxcbshapeExtlib ? true # X11 grabbing shape rendering
98, libXv ? null # Xlib support
99, lzma ? null # xz-utils
100, nvenc ? false, nvidia-video-sdk ? null # NVIDIA NVENC support
101, openal ? null # OpenAL 1.1 capture support
102#, opencl ? null # OpenCL code
103, opencore-amr ? null # AMR-NB de/encoder & AMR-WB decoder
104#, opencv ? null # Video filtering
105, openglExtlib ? false, mesa ? null # OpenGL rendering
106#, openh264 ? null # H.264/AVC encoder
107, openjpeg_1 ? null # JPEG 2000 de/encoder
108, opensslExtlib ? false, openssl ? null
109, libpulseaudio ? null # Pulseaudio input support
110, rtmpdump ? null # RTMP[E] support
111#, libquvi ? null # Quvi input support
112, samba ? null # Samba protocol
113#, schroedinger ? null # Dirac de/encoder
114, SDL2 ? null
115#, shine ? null # Fixed-point MP3 encoder
116, soxr ? null # Resampling via soxr
117, speex ? null # Speex de/encoder
118#, twolame ? null # MP2 encoder
119#, utvideo ? null # Ut Video de/encoder
120, vid-stab ? null # Video stabilization
121#, vo-aacenc ? null # AAC encoder
122#, vo-amrwbenc ? null # AMR-WB encoder
123, wavpack ? null # Wavpack encoder
124, x264 ? null # H.264/AVC encoder
125, x265 ? null # H.265/HEVC encoder
126, xavs ? null # AVS encoder
127, xvidcore ? null # Xvid encoder, native encoder exists
128, zeromq4 ? null # Message passing
129, zlib ? null
130#, zvbi ? null # Teletext support
131/*
132 * Developer options
133 */
134, debugDeveloper ? false
135, optimizationsDeveloper ? true
136, extraWarningsDeveloper ? false
137, strippingDeveloper ? false
138/*
139 * Darwin frameworks
140 */
141, Cocoa, CoreAudio, CoreServices, AVFoundation, MediaToolbox
142, VideoDecodeAcceleration, CF
143}:
144
145/* Maintainer notes:
146 *
147 * Version bumps:
148 * It should always be safe to bump patch releases (e.g. 2.1.x, x being a patch release)
149 * If adding a new branch, note any configure flags that were added, changed, or deprecated/removed
150 * and make the necessary changes.
151 *
152 * Packages with errors:
153 * flite ilbc schroedinger
154 * opencv - circular dependency issue
155 *
156 * Not packaged:
157 * aacplus avisynth cdio-paranoia crystalhd libavc1394 libiec61883
158 * libmxf libnut libquvi nvenc opencl openh264 oss shine twolame
159 * utvideo vo-aacenc vo-amrwbenc xvmc zvbi blackmagic-design-desktop-video
160 *
161 * Need fixes to support Darwin:
162 * frei0r, game-music-emu, gsm, libjack2, libssh, libvpx(stable 1.3.0), openal, openjpeg_1,
163 * pulseaudio, rtmpdump, samba, vid-stab, wavpack, x265. xavs
164 *
165 * Not supported:
166 * stagefright-h264(android only)
167 *
168 * Known issues:
169 * flite: configure fails to find library
170 * Tried modifying ffmpeg's configure script and flite to use pkg-config
171 * Cross-compiling will disable features not present on host OS
172 * (e.g. dxva2 support [DirectX] will not be enabled unless natively compiled on Cygwin)
173 *
174 */
175
176let
177 inherit (stdenv) isCygwin isFreeBSD isLinux;
178 inherit (stdenv.lib) optional optionals optionalString enableFeature;
179in
180
181/*
182 * Licensing dependencies
183 */
184assert version3Licensing -> gplLicensing;
185assert nonfreeLicensing -> gplLicensing && version3Licensing;
186/*
187 * Build dependencies
188 */
189assert networkBuild -> gnutls != null || opensslExtlib;
190assert pixelutilsBuild -> avutilLibrary;
191/*
192 * Program dependencies
193 */
194assert ffmpegProgram -> avcodecLibrary
195 && avfilterLibrary
196 && avformatLibrary
197 && swresampleLibrary;
198assert ffplayProgram -> avcodecLibrary
199 && avformatLibrary
200 && swscaleLibrary
201 && swresampleLibrary
202 && SDL2 != null;
203assert ffprobeProgram -> avcodecLibrary && avformatLibrary;
204assert ffserverProgram -> avformatLibrary;
205/*
206 * Library dependencies
207 */
208assert avcodecLibrary -> avutilLibrary; # configure flag since 0.6
209assert avdeviceLibrary -> avformatLibrary
210 && avcodecLibrary
211 && avutilLibrary; # configure flag since 0.6
212assert avformatLibrary -> avcodecLibrary && avutilLibrary; # configure flag since 0.6
213assert avresampleLibrary -> avutilLibrary;
214assert postprocLibrary -> avutilLibrary;
215assert swresampleLibrary -> soxr != null;
216assert swscaleLibrary -> avutilLibrary;
217/*
218 * External libraries
219 */
220#assert decklinkExtlib -> blackmagic-design-desktop-video != null
221# && !isCygwin && multithreadBuild # POSIX threads required
222# && nonfreeLicensing;
223assert fdkaacExtlib -> fdk_aac != null && nonfreeLicensing;
224assert gnutls != null -> !opensslExtlib;
225assert libxcbshmExtlib -> libxcb != null;
226assert libxcbxfixesExtlib -> libxcb != null;
227assert libxcbshapeExtlib -> libxcb != null;
228assert openglExtlib -> mesa != null;
229assert opensslExtlib -> gnutls == null && openssl != null && nonfreeLicensing;
230assert nvenc -> nvidia-video-sdk != null && nonfreeLicensing;
231
232stdenv.mkDerivation rec {
233 name = "ffmpeg-full-${version}";
234 version = "3.3.3";
235
236 src = fetchurl {
237 url = "https://www.ffmpeg.org/releases/ffmpeg-${version}.tar.xz";
238 sha256 = "07is8msrhxr1dk6vgwa192k2pl2a0in1h9w8f9cknlvbvhn01afj";
239 };
240
241 patchPhase = ''patchShebangs .
242 '' + stdenv.lib.optionalString stdenv.isDarwin ''
243 sed -i 's/#ifndef __MAC_10_11/#if 1/' ./libavcodec/audiotoolboxdec.c
244 '' + stdenv.lib.optionalString (frei0r != null) ''
245 substituteInPlace libavfilter/vf_frei0r.c \
246 --replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
247 substituteInPlace doc/filters.texi \
248 --replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
249 '';
250
251 configureFlags = [
252 /*
253 * Licensing flags
254 */
255 (enableFeature gplLicensing "gpl")
256 (enableFeature version3Licensing "version3")
257 (enableFeature nonfreeLicensing "nonfree")
258 /*
259 * Build flags
260 */
261 # On some ARM platforms --enable-thumb
262 "--enable-shared --disable-static"
263 (enableFeature true "pic")
264 (if stdenv.cc.isClang then "--cc=clang" else null)
265 (enableFeature smallBuild "small")
266 (enableFeature runtimeCpuDetectBuild "runtime-cpudetect")
267 (enableFeature enableLto "lto")
268 (enableFeature grayBuild "gray")
269 (enableFeature swscaleAlphaBuild "swscale-alpha")
270 (enableFeature hardcodedTablesBuild "hardcoded-tables")
271 (enableFeature safeBitstreamReaderBuild "safe-bitstream-reader")
272 (if multithreadBuild then (
273 if isCygwin then
274 "--disable-pthreads --enable-w32threads"
275 else # Use POSIX threads by default
276 "--enable-pthreads --disable-w32threads")
277 else
278 "--disable-pthreads --disable-w32threads")
279 "--disable-os2threads" # We don't support OS/2
280 (enableFeature networkBuild "network")
281 (enableFeature pixelutilsBuild "pixelutils")
282 /*
283 * Program flags
284 */
285 (enableFeature ffmpegProgram "ffmpeg")
286 (enableFeature ffplayProgram "ffplay")
287 (enableFeature ffprobeProgram "ffprobe")
288 (enableFeature ffserverProgram "ffserver")
289 /*
290 * Library flags
291 */
292 (enableFeature avcodecLibrary "avcodec")
293 (enableFeature avdeviceLibrary "avdevice")
294 (enableFeature avfilterLibrary "avfilter")
295 (enableFeature avformatLibrary "avformat")
296 (enableFeature avresampleLibrary "avresample")
297 (enableFeature avutilLibrary "avutil")
298 (enableFeature (postprocLibrary && gplLicensing) "postproc")
299 (enableFeature swresampleLibrary "swresample")
300 (enableFeature swscaleLibrary "swscale")
301 /*
302 * Documentation flags
303 */
304 (enableFeature (htmlpagesDocumentation
305 || manpagesDocumentation
306 || podpagesDocumentation
307 || txtpagesDocumentation) "doc")
308 (enableFeature htmlpagesDocumentation "htmlpages")
309 (enableFeature manpagesDocumentation "manpages")
310 (enableFeature podpagesDocumentation "podpages")
311 (enableFeature txtpagesDocumentation "txtpages")
312 /*
313 * External libraries
314 */
315 #(enableFeature avisynth "avisynth")
316 (enableFeature (bzip2 != null) "bzlib")
317 (enableFeature (celt != null) "libcelt")
318 #(enableFeature crystalhd "crystalhd")
319 #(enableFeature decklinkExtlib "decklink")
320 (enableFeature (fdkaacExtlib && gplLicensing) "libfdk-aac")
321 #(enableFeature (flite != null) "libflite")
322 "--disable-libflite" # Force disable until a solution is found
323 (enableFeature (fontconfig != null) "fontconfig")
324 (enableFeature (freetype != null) "libfreetype")
325 (enableFeature (frei0r != null && gplLicensing) "frei0r")
326 (enableFeature (fribidi != null) "libfribidi")
327 (enableFeature (game-music-emu != null) "libgme")
328 (enableFeature (gnutls != null) "gnutls")
329 (enableFeature (gsm != null) "libgsm")
330 #(enableFeature (ilbc != null) "libilbc")
331 (enableFeature (ladspaH !=null) "ladspa")
332 (enableFeature (lame != null) "libmp3lame")
333 (enableFeature (libass != null) "libass")
334 #(enableFeature (libavc1394 != null) null null)
335 (enableFeature (libbluray != null) "libbluray")
336 (enableFeature (libbs2b != null) "libbs2b")
337 #(enableFeature (libcaca != null) "libcaca")
338 #(enableFeature (cdio-paranoia != null && gplLicensing) "libcdio")
339 (enableFeature (if isLinux then libdc1394 != null && libraw1394 != null else false) "libdc1394")
340 (enableFeature (libiconv != null) "iconv")
341 #(enableFeature (if isLinux then libiec61883 != null && libavc1394 != null && libraw1394 != null else false) "libiec61883")
342 #(enableFeature (libmfx != null) "libmfx")
343 (enableFeature (libmodplug != null) "libmodplug")
344 #(enableFeature (libnut != null) "libnut")
345 (enableFeature (libopus != null) "libopus")
346 (enableFeature (libssh != null) "libssh")
347 (enableFeature (libtheora != null) "libtheora")
348 (enableFeature (if isLinux then libv4l != null else false) "libv4l2")
349 (enableFeature ((isLinux || isFreeBSD) && libva != null) "vaapi")
350 (enableFeature (libvdpau != null) "vdpau")
351 (enableFeature (libvorbis != null) "libvorbis")
352 (enableFeature (libvpx != null) "libvpx")
353 (enableFeature (libwebp != null) "libwebp")
354 (enableFeature (libX11 != null && libXv != null) "xlib")
355 (enableFeature (libxcb != null) "libxcb")
356 (enableFeature libxcbshmExtlib "libxcb-shm")
357 (enableFeature libxcbxfixesExtlib "libxcb-xfixes")
358 (enableFeature libxcbshapeExtlib "libxcb-shape")
359 (enableFeature (lzma != null) "lzma")
360 (enableFeature nvenc "nvenc")
361 (enableFeature (openal != null) "openal")
362 #(enableFeature opencl "opencl")
363 (enableFeature (opencore-amr != null && version3Licensing) "libopencore-amrnb")
364 #(enableFeature (opencv != null) "libopencv")
365 (enableFeature openglExtlib "opengl")
366 #(enableFeature (openh264 != null) "openh264")
367 (enableFeature (openjpeg_1 != null) "libopenjpeg")
368 (enableFeature (opensslExtlib && gplLicensing) "openssl")
369 (enableFeature (libpulseaudio != null) "libpulse")
370 #(enableFeature quvi "libquvi")
371 (enableFeature (rtmpdump != null) "librtmp")
372 #(enableFeature (schroedinger != null) "libschroedinger")
373 #(enableFeature (shine != null) "libshine")
374 (enableFeature (samba != null && gplLicensing && version3Licensing) "libsmbclient")
375 (enableFeature (SDL2 != null) "sdl2")
376 (enableFeature (soxr != null) "libsoxr")
377 (enableFeature (speex != null) "libspeex")
378 #(enableFeature (twolame != null) "libtwolame")
379 #(enableFeature (utvideo != null && gplLicensing) "libutvideo")
380 (enableFeature (vid-stab != null && gplLicensing) "libvidstab") # Actual min. version 2.0
381 #(enableFeature (vo-aacenc != null && version3Licensing) "libvo-aacenc")
382 #(enableFeature (vo-amrwbenc != null && version3Licensing) "libvo-amrwbenc")
383 (enableFeature (wavpack != null) "libwavpack")
384 (enableFeature (x264 != null && gplLicensing) "libx264")
385 (enableFeature (x265 != null && gplLicensing) "libx265")
386 (enableFeature (xavs != null && gplLicensing) "libxavs")
387 (enableFeature (xvidcore != null && gplLicensing) "libxvid")
388 (enableFeature (zeromq4 != null) "libzmq")
389 (enableFeature (zlib != null) "zlib")
390 #(enableFeature (zvbi != null && gplLicensing) "libzvbi")
391 /*
392 * Developer flags
393 */
394 (enableFeature debugDeveloper "debug")
395 (enableFeature optimizationsDeveloper "optimizations")
396 (enableFeature extraWarningsDeveloper "extra-warnings")
397 (enableFeature strippingDeveloper "stripping")
398 ];
399
400 nativeBuildInputs = [ perl pkgconfig texinfo yasm ];
401
402 buildInputs = [
403 bzip2 celt fontconfig freetype frei0r fribidi game-music-emu gnutls gsm
404 libjack2 ladspaH lame libass libbluray libbs2b libcaca libdc1394 libmodplug
405 libogg libopus libssh libtheora libvdpau libvorbis libvpx libwebp libX11
406 libxcb libXv lzma openal openjpeg_1 libpulseaudio rtmpdump opencore-amr
407 samba SDL2 soxr speex vid-stab wavpack x264 x265 xavs xvidcore zeromq4 zlib
408 ] ++ optional openglExtlib mesa
409 ++ optionals nonfreeLicensing [ fdk_aac openssl ]
410 ++ optional ((isLinux || isFreeBSD) && libva != null) libva
411 ++ optionals isLinux [ alsaLib libraw1394 libv4l ]
412 ++ optionals nvenc [ nvidia-video-sdk ]
413 ++ optionals stdenv.isDarwin [ Cocoa CoreServices CoreAudio AVFoundation
414 MediaToolbox VideoDecodeAcceleration ];
415
416 # Build qt-faststart executable
417 buildPhase = optional qtFaststartProgram ''make tools/qt-faststart'';
418
419 # Hacky framework patching technique borrowed from the phantomjs2 package
420 postInstall = optionalString qtFaststartProgram ''
421 cp -a tools/qt-faststart $out/bin/
422 '' + optionalString stdenv.isDarwin ''
423 FILES=($(ls $out/bin/*))
424 FILES+=($(ls $out/lib/*.dylib))
425 for f in ''${FILES[@]}; do
426 if [ ! -h "$f" ]; then
427 install_name_tool -change ${CF}/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation "$f"
428 fi
429 done
430 '';
431
432
433 enableParallelBuilding = true;
434
435 /* Cross-compilation is untested, consider this an outline, more work
436 needs to be done to portions of the build to get it to work correctly */
437 crossAttrs = {
438 configurePlatforms = [];
439 configureFlags = configureFlags ++ [
440 "--cross-prefix=${stdenv.cc.prefix}"
441 "--enable-cross-compile"
442 "--target_os=${hostPlatform.parsed.kernel.name}"
443 "--arch=${hostPlatform.arch}"
444 ];
445 };
446
447 meta = with stdenv.lib; {
448 description = "A complete, cross-platform solution to record, convert and stream audio and video";
449 homepage = https://www.ffmpeg.org/;
450 longDescription = ''
451 FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
452 mux, demux, stream, filter and play pretty much anything that humans and machines
453 have created. It supports the most obscure ancient formats up to the cutting edge.
454 No matter if they were designed by some standards committee, the community or
455 a corporation.
456 '';
457 license = (
458 if nonfreeLicensing then
459 licenses.unfreeRedistributable
460 else if version3Licensing then
461 licenses.gpl3
462 else if gplLicensing then
463 licenses.gpl2Plus
464 else
465 licenses.lgpl21Plus
466 );
467 platforms = platforms.all;
468 maintainers = with maintainers; [ codyopel fuuzetsu ];
469 };
470}