about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libav
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/libav
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libav')
-rw-r--r--nixpkgs/pkgs/development/libraries/libav/default.nix131
-rw-r--r--nixpkgs/pkgs/development/libraries/libav/vpxenc-0.8.17-libvpx-1.5.patch22
2 files changed, 153 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libav/default.nix b/nixpkgs/pkgs/development/libraries/libav/default.nix
new file mode 100644
index 000000000000..1ef453f24cdb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libav/default.nix
@@ -0,0 +1,131 @@
+{ stdenv, fetchurl, pkgconfig, yasm, bzip2, zlib, perl, bash
+, mp3Support    ? true,   lame      ? null
+, speexSupport  ? true,   speex     ? null
+, theoraSupport ? true,   libtheora ? null
+, vorbisSupport ? true,   libvorbis ? null
+, vpxSupport    ? true,   libvpx    ? null
+, x264Support   ? false,  x264      ? null
+, xvidSupport   ? true,   xvidcore  ? null
+, faacSupport   ? false,  faac      ? null
+, vaapiSupport  ? true,   libva     ? null
+, vdpauSupport  ? true,   libvdpau  ? null
+, freetypeSupport ? true, freetype  ? null # it's small and almost everywhere
+, SDL # only for avplay in $bin, adds nontrivial closure to it
+, enableGPL ? true # ToDo: some additional default stuff may need GPL
+, enableUnfree ? faacSupport
+}:
+
+assert faacSupport -> enableUnfree;
+
+let inherit (stdenv.lib) optional hasPrefix enableFeature; in
+
+/* ToDo:
+    - more deps, inspiration: https://packages.ubuntu.com/raring/libav-tools
+    - maybe do some more splitting into outputs
+*/
+
+let
+  result = {
+    # e.g. https://libav.org/releases/libav-11.11.tar.xz.sha1
+    libav_0_8 = libavFun "0.8.21" "d858f65128dad0bac1a8c3a51e5cbb27a7c79b3f";
+    libav_11  = libavFun "11.12"  "61d5dcab5fde349834af193a572b12a5fd6a4d42";
+    libav_12  = libavFun "12.3"   "386c18c8b857f23dfcf456ce40370716130211d9";
+  };
+
+  libavFun = version : sha1 : stdenv.mkDerivation rec {
+    name = "libav-${version}";
+
+    src = fetchurl {
+      url = "${meta.homepage}/releases/${name}.tar.xz";
+      inherit sha1; # upstream directly provides sha1 of releases over https
+    };
+
+    patches = []
+      ++ optional (vpxSupport && hasPrefix "0.8." version) ./vpxenc-0.8.17-libvpx-1.5.patch
+      ;
+
+    postPatch = ''
+      patchShebangs .
+      # another shebang was hidden in a here document text
+      substituteInPlace ./configure --replace "#! /bin/sh" "#!${bash}/bin/sh"
+    '';
+
+    configurePlatforms = [];
+    configureFlags = assert stdenv.lib.all (x: x!=null) buildInputs; [
+      "--arch=${stdenv.hostPlatform.parsed.cpu.name}"
+      "--target_os=${stdenv.hostPlatform.parsed.kernel.name}"
+      #"--enable-postproc" # it's now a separate package in upstream
+      "--disable-avserver" # upstream says it's in a bad state
+      "--enable-avplay"
+      "--enable-shared"
+      "--enable-runtime-cpudetect"
+      "--cc=cc"
+      (enableFeature enableGPL "gpl")
+      (enableFeature enableGPL "swscale")
+      (enableFeature mp3Support "libmp3lame")
+      (enableFeature mp3Support "libmp3lame")
+      (enableFeature speexSupport "libspeex")
+      (enableFeature theoraSupport "libtheora")
+      (enableFeature vorbisSupport "libvorbis")
+      (enableFeature vpxSupport "libvpx")
+      (enableFeature x264Support "libx264")
+      (enableFeature xvidSupport "libxvid")
+      (enableFeature faacSupport "libfaac")
+      (enableFeature faacSupport "nonfree")
+      (enableFeature vaapiSupport "vaapi")
+      (enableFeature vdpauSupport "vdpau")
+      (enableFeature freetypeSupport "libfreetype")
+    ] ++ optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+      "--cross-prefix=${stdenv.cc.targetPrefix}"
+      "--enable-cross-compile"
+    ];
+
+  nativeBuildInputs = [ pkgconfig perl ];
+    buildInputs = [ lame yasm zlib bzip2 SDL bash ]
+      ++ [ perl ] # for install-man target
+      ++ optional mp3Support lame
+      ++ optional speexSupport speex
+      ++ optional theoraSupport libtheora
+      ++ optional vorbisSupport libvorbis
+      ++ optional vpxSupport libvpx
+      ++ optional x264Support x264
+      ++ optional xvidSupport xvidcore
+      ++ optional faacSupport faac
+      ++ optional vaapiSupport libva
+      ++ optional vdpauSupport libvdpau
+      ++ optional freetypeSupport freetype
+      ;
+
+    enableParallelBuilding = true;
+
+    outputs = [ "bin" "dev" "out" ];
+    setOutputFlags = false;
+
+    # alltools to build smaller tools, incl. aviocat, ismindex, qt-faststart, etc.
+    buildFlags = "all alltools install-man";
+
+
+    postInstall = ''
+      moveToOutput bin "$bin"
+      # alltools target compiles an executable in tools/ for every C
+      # source file in tools/, so move those to $out
+      for tool in $(find tools -type f -executable); do
+        mv "$tool" "$bin/bin/"
+      done
+    '';
+
+    doInstallCheck = false; # fails randomly
+    installCheckTarget = "check"; # tests need to be run *after* installation
+
+    passthru = { inherit vdpauSupport; };
+
+    meta = with stdenv.lib; {
+      homepage = https://libav.org/;
+      description = "A complete, cross-platform solution to record, convert and stream audio and video (fork of ffmpeg)";
+      license = with licenses; if enableUnfree then unfree #ToDo: redistributable or not?
+        else if enableGPL then gpl2Plus else lgpl21Plus;
+      platforms = with platforms; linux ++ darwin;
+    };
+  }; # libavFun
+
+in result
diff --git a/nixpkgs/pkgs/development/libraries/libav/vpxenc-0.8.17-libvpx-1.5.patch b/nixpkgs/pkgs/development/libraries/libav/vpxenc-0.8.17-libvpx-1.5.patch
new file mode 100644
index 000000000000..456828c025ef
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libav/vpxenc-0.8.17-libvpx-1.5.patch
@@ -0,0 +1,22 @@
+--- a/libavcodec/libvpxenc.c	2016-05-01 17:57:16.753852614 +0200
++++ b/libavcodec/libvpxenc.c	2016-05-01 18:01:08.252147138 +0200
+@@ -67,19 +67,11 @@
+ 
+ /** String mappings for enum vp8e_enc_control_id */
+ static const char *ctlidstr[] = {
+-    [VP8E_UPD_ENTROPY]           = "VP8E_UPD_ENTROPY",
+-    [VP8E_UPD_REFERENCE]         = "VP8E_UPD_REFERENCE",
+-    [VP8E_USE_REFERENCE]         = "VP8E_USE_REFERENCE",
+-    [VP8E_SET_ROI_MAP]           = "VP8E_SET_ROI_MAP",
+-    [VP8E_SET_ACTIVEMAP]         = "VP8E_SET_ACTIVEMAP",
+-    [VP8E_SET_SCALEMODE]         = "VP8E_SET_SCALEMODE",
+     [VP8E_SET_CPUUSED]           = "VP8E_SET_CPUUSED",
+     [VP8E_SET_ENABLEAUTOALTREF]  = "VP8E_SET_ENABLEAUTOALTREF",
+     [VP8E_SET_NOISE_SENSITIVITY] = "VP8E_SET_NOISE_SENSITIVITY",
+-    [VP8E_SET_SHARPNESS]         = "VP8E_SET_SHARPNESS",
+     [VP8E_SET_STATIC_THRESHOLD]  = "VP8E_SET_STATIC_THRESHOLD",
+     [VP8E_SET_TOKEN_PARTITIONS]  = "VP8E_SET_TOKEN_PARTITIONS",
+-    [VP8E_GET_LAST_QUANTIZER]    = "VP8E_GET_LAST_QUANTIZER",
+     [VP8E_SET_ARNR_MAXFRAMES]    = "VP8E_SET_ARNR_MAXFRAMES",
+     [VP8E_SET_ARNR_STRENGTH]     = "VP8E_SET_ARNR_STRENGTH",
+     [VP8E_SET_ARNR_TYPE]         = "VP8E_SET_ARNR_TYPE",