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

102 lines
4.1 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, autoreconfHook
2018-04-16 09:34:07 +00:00
, libarchive, perl, xorg, libdvdnav, libbluray
2021-02-11 06:23:06 +00:00
, zlib, a52dec, libmad, faad2, ffmpeg, alsaLib
, pkg-config, 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
2021-01-17 12:56:15 +00:00
, withQt5 ? true, qtbase, qtsvg, qtx11extras, wrapQtAppsHook
, jackSupport ? false
2021-01-17 12:56:15 +00:00
, skins2Support ? !onlyLibVLC, freetype
, 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 ];
2021-01-15 05:42:41 +00:00
with lib;
2014-11-18 01:33:10 +00:00
stdenv.mkDerivation rec {
pname = "${optionalString onlyLibVLC "lib"}vlc";
2021-01-21 19:04:20 +00:00
version = "3.0.12";
src = fetchurl {
2020-10-02 05:50:51 +00:00
url = "http://get.videolan.org/vlc/${version}/vlc-${version}.tar.xz";
2021-01-21 19:04:20 +00:00
sha256 = "0ygqihw2c5vvzv8950dlf7rdwz1cpz1668jgyja604ljibrmix7g";
};
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 = [
2021-02-11 06:23:06 +00:00
zlib a52dec libmad faad2 ffmpeg 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 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 ]
2021-01-17 12:56:15 +00:00
++ optionals skins2Support (with xorg; [ libXpm freetype libXext libXinerama ])
++ optional jackSupport libjack2
++ optionals chromecastSupport [ protobuf libmicrodns ];
nativeBuildInputs = [ autoreconfHook perl pkg-config removeReferencesTo unzip ]
2019-07-28 18:19:11 +00:00
++ 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 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"
2021-01-17 12:56:15 +00:00
++ optional skins2Support "--enable-skins2"
++ 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
'';
meta = with 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;
};
}