3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/video/vlc/default.nix

93 lines
3.6 KiB
Nix
Raw Normal View History

2018-04-16 10:34:07 +01: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 10:34:07 +01:00
, libvorbis, libtheora, speex, lua5, libgcrypt, libgpgerror, libupnp
, libcaca, libpulseaudio, flac, schroedinger, libxml2, librsvg
2018-04-16 10:34:07 +01:00
, mpeg2dec, systemd, gnutls, avahi, libcddb, libjack2, SDL, SDL_image
, libmtp, unzip, taglib, libkate, libtiger, libv4l, samba, liboggz
, libass, libva, libdvbpsi, libdc1394, libraw1394, libopus
2018-04-16 10:34:07 +01:00
, libvdpau, libsamplerate, live555, fluidsynth, wayland, wayland-protocols
, onlyLibVLC ? false
, withQt5 ? true, qtbase ? null, qtsvg ? null, qtx11extras ? null
, jackSupport ? false
2017-10-02 16:42:54 +01:00
, fetchpatch
, removeReferencesTo
}:
2014-11-18 01:33:10 +00:00
with stdenv.lib;
2018-04-16 10:34:07 +01:00
assert (withQt5 -> qtbase != null && qtsvg != null && qtx11extras != null);
2014-11-18 01:33:10 +00:00
stdenv.mkDerivation rec {
2013-09-26 15:37:49 +01:00
name = "vlc-${version}";
version = "3.0.5";
src = fetchurl {
url = "http://get.videolan.org/vlc/${version}/${name}.tar.xz";
sha256 = "1nvj00khy08sing0mdnw6virmiq579mrk5rvpx9710nlxggqgh7m";
};
2018-04-16 10:34:07 +01: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
2018-04-16 10:34:07 +01: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 10:34:07 +01: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;
nativeBuildInputs = [ autoreconfHook perl pkgconfig removeReferencesTo ];
2018-04-16 10:34:07 +01: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 10:34:07 +01: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 02:28:08 +01:00
2018-04-16 10:34:07 +01:00
postPatch = ''
substituteInPlace configure \
--replace /bin/echo echo
2018-04-16 10:34:07 +01: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 10:34:07 +01: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 10:34:07 +01: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";
# 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 10:34:07 +01:00
platforms = platforms.linux;
};
}