2022-01-03 16:56:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2023-10-09 19:29:22 +00:00
|
|
|
, pkgsBuildBuild
|
2022-01-03 16:56:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, fetchpatch
|
|
|
|
, SDL
|
|
|
|
, SDL_image
|
|
|
|
, a52dec
|
|
|
|
, alsa-lib
|
|
|
|
, autoreconfHook
|
|
|
|
, avahi
|
|
|
|
, dbus
|
|
|
|
, faad2
|
2022-02-10 20:34:41 +00:00
|
|
|
, ffmpeg_4
|
2022-01-03 16:56:52 +00:00
|
|
|
, flac
|
|
|
|
, fluidsynth
|
|
|
|
, freefont_ttf
|
2023-07-15 17:15:38 +00:00
|
|
|
, freetype
|
2022-01-03 16:56:52 +00:00
|
|
|
, fribidi
|
|
|
|
, gnutls
|
2023-07-15 17:15:38 +00:00
|
|
|
, libSM
|
|
|
|
, libXext
|
|
|
|
, libXinerama
|
|
|
|
, libXpm
|
|
|
|
, libXv
|
|
|
|
, libXvMC
|
2022-01-03 16:56:52 +00:00
|
|
|
, libarchive
|
|
|
|
, libass
|
|
|
|
, libbluray
|
|
|
|
, libcaca
|
|
|
|
, libcddb
|
|
|
|
, libdc1394
|
|
|
|
, libdvbpsi
|
|
|
|
, libdvdnav
|
|
|
|
, libebml
|
|
|
|
, libgcrypt
|
|
|
|
, libgpg-error
|
|
|
|
, libjack2
|
|
|
|
, libkate
|
|
|
|
, libmad
|
|
|
|
, libmatroska
|
2023-07-15 17:15:38 +00:00
|
|
|
, libmicrodns
|
2022-08-12 12:06:08 +00:00
|
|
|
, libmodplug
|
2022-01-03 16:56:52 +00:00
|
|
|
, libmtp
|
|
|
|
, liboggz
|
|
|
|
, libopus
|
2022-06-26 10:26:21 +00:00
|
|
|
, libplacebo
|
2022-01-03 16:56:52 +00:00
|
|
|
, libpulseaudio
|
|
|
|
, libraw1394
|
|
|
|
, librsvg
|
|
|
|
, libsamplerate
|
|
|
|
, libspatialaudio
|
|
|
|
, libssh2
|
|
|
|
, libtheora
|
|
|
|
, libtiger
|
|
|
|
, libupnp
|
|
|
|
, libv4l
|
|
|
|
, libva
|
|
|
|
, libvdpau
|
|
|
|
, libvorbis
|
|
|
|
, libxml2
|
|
|
|
, live555
|
|
|
|
, lua5
|
|
|
|
, mpeg2dec
|
|
|
|
, ncurses
|
|
|
|
, perl
|
|
|
|
, pkg-config
|
2023-07-15 17:15:38 +00:00
|
|
|
, protobuf
|
|
|
|
, qtbase
|
|
|
|
, qtsvg
|
|
|
|
, qtwayland
|
|
|
|
, qtx11extras
|
2022-01-03 16:56:52 +00:00
|
|
|
, removeReferencesTo
|
|
|
|
, samba
|
|
|
|
, schroedinger
|
|
|
|
, speex
|
|
|
|
, srt
|
|
|
|
, systemd
|
|
|
|
, taglib
|
|
|
|
, unzip
|
2023-07-15 17:15:38 +00:00
|
|
|
, wayland
|
|
|
|
, wayland-protocols
|
|
|
|
, wrapGAppsHook
|
|
|
|
, wrapQtAppsHook
|
|
|
|
, xcbutilkeysyms
|
2022-01-03 16:56:52 +00:00
|
|
|
, zlib
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
, chromecastSupport ? true
|
2020-04-24 23:36:52 +00:00
|
|
|
, jackSupport ? false
|
2022-01-03 16:56:52 +00:00
|
|
|
, onlyLibVLC ? false
|
2023-07-15 17:15:38 +00:00
|
|
|
, skins2Support ? !onlyLibVLC
|
|
|
|
, waylandSupport ? true
|
|
|
|
, withQt5 ? true
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
# 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 ];
|
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
let
|
|
|
|
inherit (lib) optionalString optional optionals;
|
|
|
|
in
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-10-07 09:15:18 +00:00
|
|
|
pname = "${optionalString onlyLibVLC "lib"}vlc";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "3.0.20";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-07-15 17:15:38 +00:00
|
|
|
url = "http://get.videolan.org/vlc/${finalAttrs.version}/vlc-${finalAttrs.version}.tar.xz";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-rccoW00nIc3fQOtScMraKqoQozTLVG/VWgY1NEe6KbU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
2023-10-09 19:29:22 +00:00
|
|
|
lua5
|
2023-07-15 17:15:38 +00:00
|
|
|
perl
|
|
|
|
pkg-config
|
|
|
|
removeReferencesTo
|
|
|
|
unzip
|
|
|
|
wrapGAppsHook
|
|
|
|
]
|
2023-10-09 19:29:22 +00:00
|
|
|
++ optional chromecastSupport protobuf
|
2023-07-15 17:15:38 +00:00
|
|
|
++ optionals withQt5 [ wrapQtAppsHook ]
|
|
|
|
++ optionals waylandSupport [
|
|
|
|
wayland
|
|
|
|
wayland-protocols
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +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 = [
|
2022-01-03 16:56:52 +00:00
|
|
|
SDL
|
|
|
|
SDL_image
|
|
|
|
a52dec
|
|
|
|
alsa-lib
|
|
|
|
avahi
|
|
|
|
dbus
|
|
|
|
faad2
|
2022-02-10 20:34:41 +00:00
|
|
|
ffmpeg_4
|
2022-01-03 16:56:52 +00:00
|
|
|
flac
|
|
|
|
fluidsynth
|
|
|
|
fribidi
|
|
|
|
gnutls
|
2023-07-15 17:15:38 +00:00
|
|
|
libSM
|
|
|
|
libXpm
|
|
|
|
libXv
|
|
|
|
libXvMC
|
2022-01-03 16:56:52 +00:00
|
|
|
libarchive
|
|
|
|
libass
|
|
|
|
libbluray
|
|
|
|
libcaca
|
|
|
|
libcddb
|
|
|
|
libdc1394
|
|
|
|
libdvbpsi
|
|
|
|
libdvdnav
|
|
|
|
libdvdnav.libdvdread
|
|
|
|
libebml
|
|
|
|
libgcrypt
|
|
|
|
libgpg-error
|
|
|
|
libkate
|
|
|
|
libmad
|
|
|
|
libmatroska
|
2022-08-12 12:06:08 +00:00
|
|
|
libmodplug
|
2023-07-15 17:15:38 +00:00
|
|
|
libmtp
|
2022-01-03 16:56:52 +00:00
|
|
|
liboggz
|
|
|
|
libopus
|
2022-06-26 10:26:21 +00:00
|
|
|
libplacebo
|
2022-01-03 16:56:52 +00:00
|
|
|
libpulseaudio
|
|
|
|
libraw1394
|
|
|
|
librsvg
|
|
|
|
libsamplerate
|
|
|
|
libspatialaudio
|
|
|
|
libssh2
|
|
|
|
libtheora
|
|
|
|
libtiger
|
|
|
|
libupnp
|
|
|
|
libv4l
|
|
|
|
libva
|
|
|
|
libvdpau
|
|
|
|
libvorbis
|
|
|
|
libxml2
|
|
|
|
lua5
|
|
|
|
mpeg2dec
|
|
|
|
ncurses
|
|
|
|
samba
|
|
|
|
schroedinger
|
|
|
|
speex
|
|
|
|
srt
|
|
|
|
systemd
|
|
|
|
taglib
|
2023-07-15 17:15:38 +00:00
|
|
|
xcbutilkeysyms
|
2022-01-03 16:56:52 +00:00
|
|
|
zlib
|
|
|
|
]
|
2022-08-12 12:06:08 +00:00
|
|
|
++ optional (!stdenv.hostPlatform.isAarch && !onlyLibVLC) live555
|
2022-01-03 16:56:52 +00:00
|
|
|
++ optional jackSupport libjack2
|
|
|
|
++ optionals chromecastSupport [ libmicrodns protobuf ]
|
2023-07-15 17:15:38 +00:00
|
|
|
++ optionals skins2Support [
|
2022-01-25 03:21:06 +00:00
|
|
|
freetype
|
|
|
|
libXext
|
|
|
|
libXinerama
|
|
|
|
libXpm
|
2023-07-15 17:15:38 +00:00
|
|
|
]
|
2022-01-25 03:21:06 +00:00
|
|
|
++ optionals waylandSupport [ wayland wayland-protocols ]
|
|
|
|
++ optionals withQt5 [ qtbase qtsvg qtx11extras ]
|
|
|
|
++ optional (waylandSupport && withQt5) qtwayland;
|
2022-01-03 16:56:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
env = {
|
|
|
|
# vlc depends on a c11-gcc wrapper script which we don't have so we need to
|
|
|
|
# set the path to the compiler
|
2023-10-09 19:29:22 +00:00
|
|
|
BUILDCC = "${pkgsBuildBuild.stdenv.cc}/bin/gcc";
|
|
|
|
PKG_CONFIG_WAYLAND_SCANNER_WAYLAND_SCANNER = "wayland-scanner";
|
2023-07-15 17:15:38 +00:00
|
|
|
} // lib.optionalAttrs (!stdenv.hostPlatform.isAarch) {
|
|
|
|
LIVE555_PREFIX = live555;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
patches = [
|
2022-12-17 10:02:37 +00:00
|
|
|
# patch to build with recent live555
|
2022-01-27 00:19:43 +00:00
|
|
|
# upstream issue: https://code.videolan.org/videolan/vlc/-/issues/25473
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://code.videolan.org/videolan/vlc/uploads/eb1c313d2d499b8a777314f789794f9d/0001-Add-lssl-and-lcrypto-to-liblive555_plugin_la_LIBADD.patch";
|
|
|
|
sha256 = "0kyi8q2zn2ww148ngbia9c7qjgdrijf4jlvxyxgrj29cb5iy1kda";
|
|
|
|
})
|
2021-08-05 21:33:18 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace modules/text_renderer/freetype/platform_fonts.h --replace \
|
|
|
|
/usr/share/fonts/truetype/freefont ${freefont_ttf}/share/fonts/truetype
|
2023-10-09 19:29:22 +00:00
|
|
|
'' + lib.optionalString (!stdenv.hostPlatform.canExecute stdenv.buildPlatform) ''
|
|
|
|
# Upstream luac can't cross compile, so we have to install the lua
|
|
|
|
# sources, not bytecode:
|
|
|
|
# https://www.lua.org/wshop13/Jericke.pdf#page=39
|
|
|
|
substituteInPlace share/Makefile.am --replace $'.luac \\\n' $'.lua \\\n'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
enableParallelBuilding = true;
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
dontWrapGApps = true; # to prevent double wrapping of Qtwrap and Gwrap
|
2023-04-29 16:46:19 +00:00
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# - 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)
|
2023-10-09 19:29:22 +00:00
|
|
|
#
|
|
|
|
# pkgsBuildBuild is used here because buildPackages.libvlc somehow
|
|
|
|
# depends on a qt5.qttranslations that doesn't build, even though it
|
|
|
|
# should be the same as pkgsBuildBuild.qt5.qttranslations.
|
2020-04-24 23:36:52 +00:00
|
|
|
postFixup = ''
|
|
|
|
find $out/lib/vlc/plugins -exec touch -d @1 '{}' ';'
|
2023-10-09 19:29:22 +00:00
|
|
|
${if stdenv.buildPlatform.canExecute stdenv.hostPlatform then "$out" else pkgsBuildBuild.libvlc}/lib/vlc/vlc-cache-gen $out/vlc/plugins
|
2020-04-24 23:36:52 +00:00
|
|
|
'' + optionalString withQt5 ''
|
|
|
|
remove-references-to -t "${qtbase.dev}" $out/lib/vlc/plugins/gui/libqt_plugin.so
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Most of the libraries are auto-detected so we don't need to set a bunch of
|
|
|
|
# "--enable-foo" flags here
|
|
|
|
configureFlags = [
|
2021-08-05 21:33:18 +00:00
|
|
|
"--enable-srt" # Explicit enable srt to ensure the patch is applied.
|
2022-01-03 16:56:52 +00:00
|
|
|
"--with-kde-solid=$out/share/apps/solid/actions"
|
2022-01-25 03:21:06 +00:00
|
|
|
]
|
|
|
|
++ optional onlyLibVLC "--disable-vlc"
|
|
|
|
++ optional skins2Support "--enable-skins2"
|
|
|
|
++ optional waylandSupport "--enable-wayland"
|
|
|
|
++ optionals chromecastSupport [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--enable-sout"
|
|
|
|
"--enable-chromecast"
|
|
|
|
"--enable-microdns"
|
|
|
|
];
|
|
|
|
|
|
|
|
# Remove runtime dependencies on libraries
|
|
|
|
postConfigure = ''
|
|
|
|
sed -i 's|^#define CONFIGURE_LINE.*$|#define CONFIGURE_LINE "<removed>"|g' config.h
|
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# fails on high core machines
|
|
|
|
# ld: cannot find -lvlc_vdpau: No such file or directory
|
|
|
|
# https://code.videolan.org/videolan/vlc/-/issues/27338
|
|
|
|
enableParallelInstalling = false;
|
|
|
|
|
2021-12-21 02:18:32 +00:00
|
|
|
# Add missing SOFA files
|
|
|
|
# Given in EXTRA_DIST, but not in install-data target
|
|
|
|
postInstall = ''
|
|
|
|
cp -R share/hrtfs $out/share/vlc
|
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
meta = {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Cross-platform media player and streaming server";
|
|
|
|
homepage = "http://www.videolan.org/vlc/";
|
2023-07-15 17:15:38 +00:00
|
|
|
license = lib.licenses.lgpl21Plus;
|
|
|
|
maintainers = with lib.maintainers; [ AndersonTorres ];
|
|
|
|
platforms = lib.platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|