nixpkgs/pkgs/applications/video/vlc/default.nix

94 lines
3.5 KiB
Nix
Raw Normal View History

2018-04-16 09:34:07 +00:00
{ stdenv, fetchurl, autoreconfHook
, libarchive, perl, xorg, libdvdnav, libbluray
, zlib, a52dec, libmad, faad2, ffmpeg, alsaLib
2014-11-18 01:33:10 +00:00
, pkgconfig, dbus, fribidi, freefont_ttf, libebml, libmatroska
2018-04-16 09:34:07 +00:00
, libvorbis, libtheora, speex, lua5, libgcrypt, libgpgerror, libupnp
, libcaca, libpulseaudio, flac, schroedinger, libxml2, librsvg
2018-04-16 09:34:07 +00:00
, mpeg2dec, systemd, gnutls, avahi, libcddb, libjack2, SDL, SDL_image
, libmtp, unzip, taglib, libkate, libtiger, libv4l, samba, liboggz
2018-04-16 09:34:07 +00:00
, libass, libva-full, libdvbpsi, libdc1394, libraw1394, libopus
, libvdpau, libsamplerate, live555, fluidsynth, wayland, wayland-protocols
, onlyLibVLC ? false
, withQt5 ? true, qtbase ? null, qtsvg ? null, qtx11extras ? null
, jackSupport ? false
2017-10-02 15:42:54 +00:00
, fetchpatch
}:
2014-11-18 01:33:10 +00:00
with stdenv.lib;
2018-04-16 09:34:07 +00:00
assert (withQt5 -> qtbase != null && qtsvg != null && qtx11extras != null);
2014-11-18 01:33:10 +00:00
stdenv.mkDerivation rec {
2013-09-26 14:37:49 +00:00
name = "vlc-${version}";
version = "3.0.3";
src = fetchurl {
url = "http://get.videolan.org/vlc/${version}/${name}.tar.xz";
sha256 = "0lavzly8l0ll1d9iris9cnirgcs77g48lxj14058dxqkvd5v1a4v";
};
2018-04-16 09:34:07 +00:00
# VLC uses a *ton* of libraries for various pieces of functionality, many of
# which are not included here for no other reason that nobody has mentioned
# needing them
buildInputs = [
zlib a52dec libmad faad2 ffmpeg alsaLib libdvdnav libdvdnav.libdvdread
libbluray dbus fribidi libvorbis libtheora speex lua5 libgcrypt libgpgerror
libupnp libcaca libpulseaudio flac schroedinger libxml2 librsvg mpeg2dec
systemd gnutls avahi libcddb SDL SDL_image libmtp unzip taglib libarchive
libkate libtiger libv4l samba liboggz libass libdvbpsi libva-full
xorg.xlibsWrapper xorg.libXv xorg.libXvMC xorg.libXpm xorg.xcbutilkeysyms
libdc1394 libraw1394 libopus libebml libmatroska libvdpau libsamplerate live555
fluidsynth wayland wayland-protocols
] ++ optionals withQt5 [ qtbase qtsvg qtx11extras ]
++ optional jackSupport libjack2;
2018-04-16 09:34:07 +00:00
nativeBuildInputs = [ autoreconfHook perl pkgconfig ];
enableParallelBuilding = true;
2015-10-26 13:40:23 +00:00
LIVE555_PREFIX = live555;
2018-04-16 09:34:07 +00:00
# vlc depends on a c11-gcc wrapper script which we don't have so we need to
# set the path to the compiler
BUILDCC = "${stdenv.cc}/bin/gcc";
vlc: Fix build for Qt >= 5.7.0 This basically does something similar than the AUR build: https://aur.archlinux.org/packages/vlc-qt5/ On our side, all there is to do is to force compiling using C++11 mode and use a patch that the AUR package took from the following upstream patchwork URL: https://patches.videolan.org/patch/14061/ Instead of passing CXXFLAGS to the configure script, I'm using sed here to make sure we don't override flags figured out by configure. For example if ./configure is used with CXXFLAGS=-std=c++11 appended or prepended, we have something like: ... -I../include -std=c++11 -Wall -Wextra -Wsign-compare ... While if we don't do that at all, we have something like: ... -I../include -g -O2 -Wall -Wextra -Wsign-compare ... Another way would be to use NIX_CFLAGS_COMPILE, but that would affect even compilation of C code and thus resulting in a bunch of warnings like this: cc1: warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C So with our approach the flags during build look much better: ... -I../include -std=c++11 -g -O2 -Wall -Wextra -Wsign-compare ... Another thing I've changed is that the vlc_qt5 attribute in all-packages.nix now uses the latest Qt 5 version, because the build for Qt >= 5.7.0 is now no longer broken. I've also ordered the preConfigure attribute before the configureFlags attribute, because it makes more sense in terms of context (pre -> configure -> post). Tested by building on x86_64-linux with libsForQt56.vlc, libsForQt58.vlc and vlc (the Qt 4 version, just to be sure I didn't accidentally break it). Signed-off-by: aszlig <aszlig@redmoonstudios.org> Cc: @ttuegel
2017-04-19 01:28:08 +00:00
patches = [
(fetchpatch {
name = "vlc-qt5.11.patch";
url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/vlc-qt5.11.patch?h=packages/vlc";
sha256 = "0yh65bhhaz876cazhagnafs1dr61184lpj3y0m3y7k37bswykj8p";
})
(fetchpatch {
url = "https://github.com/videolan/vlc/commit/26e2d3906658c30f2f88f4b1bc9630ec43bf5525.patch";
sha256 = "0sm73cbzxva8sww526bh5yin1k2pdkvj826wdlmqnj7xf0f3mki4";
})
];
2018-04-16 09:34:07 +00:00
postPatch = ''
substituteInPlace configure \
--replace /bin/echo echo
2018-04-16 09:34:07 +00:00
substituteInPlace modules/text_renderer/freetype/platform_fonts.h --replace \
/usr/share/fonts/truetype/freefont ${freefont_ttf}/share/fonts/truetype
'';
2018-04-16 09:34:07 +00:00
# https://github.com/NixOS/nixpkgs/pull/35124#issuecomment-370552830
postFixup = ''
find $out/lib/vlc/plugins -exec touch -d @1 '{}' ';'
$out/lib/vlc/vlc-cache-gen $out/vlc/plugins
'';
2018-04-16 09:34:07 +00:00
# Most of the libraries are auto-detected so we don't need to set a bunch of
# "--enable-foo" flags here
configureFlags = [
"--with-kde-solid=$out/share/apps/solid/actions"
] ++ optional onlyLibVLC "--disable-vlc";
2013-12-08 18:19:11 +00:00
meta = with stdenv.lib; {
description = "Cross-platform media player and streaming server";
homepage = http://www.videolan.org/vlc/;
2014-02-16 15:30:30 +00:00
license = licenses.lgpl21Plus;
2018-04-16 09:34:07 +00:00
platforms = platforms.linux;
};
}