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

105 lines
4.2 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_3, 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, libssh2, liboggz
, libass, libva, libdvbpsi, libdc1394, libraw1394, libopus
2018-04-16 09:34:07 +00:00
, libvdpau, libsamplerate, live555, fluidsynth, wayland, wayland-protocols
, onlyLibVLC ? false
2019-07-28 18:19:11 +00:00
, withQt5 ? true, qtbase ? null, qtsvg ? null, qtx11extras ? null, wrapQtAppsHook ? null
, jackSupport ? false
, removeReferencesTo
, chromecastSupport ? true, protobuf, libmicrodns
}:
# chromecastSupport requires TCP port 8010 to be open for it to work.
# If your firewall is enabled, make sure to have something like:
# networking.firewall.allowedTCPPorts = [ 8010 ];
2014-11-18 01:33:10 +00:00
with stdenv.lib;
2019-07-28 18:19:11 +00:00
assert (withQt5 -> qtbase != null && qtsvg != null && qtx11extras != null && wrapQtAppsHook != null);
2014-11-18 01:33:10 +00:00
stdenv.mkDerivation rec {
pname = "vlc";
2020-07-30 15:28:24 +00:00
version = "3.0.11.1";
src = fetchurl {
url = "http://get.videolan.org/vlc/${version}/${pname}-${version}.tar.xz";
2020-07-30 15:28:24 +00:00
sha256 = "1f46h0hv7fk35zg4iczlp7ib7h2jmh8m4r5klw3g2558ib9134qq";
};
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_3 alsaLib libdvdnav libdvdnav.libdvdread
2018-04-16 09:34:07 +00:00
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 libssh2 liboggz libass libdvbpsi libva
2018-04-16 09:34:07 +00:00
xorg.xlibsWrapper xorg.libXv xorg.libXvMC xorg.libXpm xorg.xcbutilkeysyms
2018-11-18 16:50:27 +00:00
libdc1394 libraw1394 libopus libebml libmatroska libvdpau libsamplerate
2018-04-16 09:34:07 +00:00
fluidsynth wayland wayland-protocols
2018-11-18 16:50:27 +00:00
] ++ optional (!stdenv.hostPlatform.isAarch64) live555
++ optionals withQt5 [ qtbase qtsvg qtx11extras ]
++ optional jackSupport libjack2
++ optionals chromecastSupport [ protobuf libmicrodns ];
2019-07-28 18:19:11 +00:00
nativeBuildInputs = [ autoreconfHook perl pkgconfig removeReferencesTo ]
++ optionals withQt5 [ wrapQtAppsHook ];
2018-04-16 09:34:07 +00:00
enableParallelBuilding = true;
2018-11-18 16:50:27 +00:00
LIVE555_PREFIX = if (!stdenv.hostPlatform.isAarch64) then live555 else null;
2015-10-26 13:40:23 +00:00
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
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
'';
# - Touch plugins (plugins cache keyed off mtime and file size:
# https://github.com/NixOS/nixpkgs/pull/35124#issuecomment-370552830
# - Remove references to the Qt development headers (used in error messages)
2018-04-16 09:34:07 +00:00
postFixup = ''
find $out/lib/vlc/plugins -exec touch -d @1 '{}' ';'
$out/lib/vlc/vlc-cache-gen $out/vlc/plugins
2018-11-17 10:16:36 +00:00
'' + optionalString withQt5 ''
remove-references-to -t "${qtbase.dev}" $out/lib/vlc/plugins/gui/libqt_plugin.so
'';
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"
++ optionals chromecastSupport [
"--enable-sout"
"--enable-chromecast"
"--enable-microdns"
];
2018-04-16 09:34:07 +00:00
# Remove runtime dependencies on libraries
postConfigure = ''
sed -i 's|^#define CONFIGURE_LINE.*$|#define CONFIGURE_LINE "<removed>"|g' config.h
'';
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;
2020-09-26 11:32:35 +00:00
broken = if qtbase != null then versionAtLeast qtbase.version "5.15" else false;
};
}