2024-07-13 07:27:32 +00:00
|
|
|
{ config, lib, stdenv, fetchurl, fetchsvn, pkg-config, freetype, yasm, ffmpeg_6
|
2022-05-09 21:58:50 +00:00
|
|
|
, aalibSupport ? true, aalib
|
|
|
|
, fontconfigSupport ? true, fontconfig, freefont_ttf
|
|
|
|
, fribidiSupport ? true, fribidi
|
|
|
|
, x11Support ? true, libX11, libXext, libGLU, libGL
|
|
|
|
, xineramaSupport ? true, libXinerama
|
|
|
|
, xvSupport ? true, libXv
|
|
|
|
, alsaSupport ? stdenv.isLinux, alsa-lib
|
|
|
|
, screenSaverSupport ? true, libXScrnSaver
|
|
|
|
, vdpauSupport ? false, libvdpau
|
|
|
|
, cddaSupport ? !stdenv.isDarwin, cdparanoia
|
|
|
|
, dvdnavSupport ? !stdenv.isDarwin, libdvdnav
|
|
|
|
, dvdreadSupport ? true, libdvdread
|
|
|
|
, bluraySupport ? true, libbluray
|
|
|
|
, amrSupport ? false, amrnb, amrwb
|
|
|
|
, cacaSupport ? true, libcaca
|
|
|
|
, lameSupport ? true, lame
|
|
|
|
, speexSupport ? true, speex
|
|
|
|
, theoraSupport ? true, libtheora
|
|
|
|
, x264Support ? false, x264
|
|
|
|
, jackaudioSupport ? false, libjack2
|
|
|
|
, pulseSupport ? config.pulseaudio or false, libpulseaudio
|
|
|
|
, bs2bSupport ? false, libbs2b
|
|
|
|
, v4lSupport ? false, libv4l
|
2012-11-04 17:58:13 +00:00
|
|
|
# For screenshots
|
2022-05-09 21:58:50 +00:00
|
|
|
, libpngSupport ? true, libpng
|
|
|
|
, libjpegSupport ? true, libjpeg
|
2013-01-14 22:08:27 +00:00
|
|
|
, useUnfreeCodecs ? false
|
2022-05-09 21:58:50 +00:00
|
|
|
, darwin
|
2017-09-05 17:13:02 +00:00
|
|
|
, buildPackages
|
2005-08-24 15:02:30 +00:00
|
|
|
}:
|
2003-11-11 15:01:07 +00:00
|
|
|
|
2022-05-09 21:58:50 +00:00
|
|
|
assert xineramaSupport -> x11Support;
|
|
|
|
assert xvSupport -> x11Support;
|
2003-11-11 15:01:07 +00:00
|
|
|
|
2006-12-05 22:28:45 +00:00
|
|
|
let
|
2003-11-11 15:01:07 +00:00
|
|
|
|
2010-08-20 20:09:22 +00:00
|
|
|
codecs_src =
|
|
|
|
let
|
2020-04-01 01:11:51 +00:00
|
|
|
dir = "http://www.mplayerhq.hu/MPlayer/releases/codecs/";
|
2019-09-03 20:51:04 +00:00
|
|
|
version = "20071007";
|
2010-08-20 20:09:22 +00:00
|
|
|
in
|
2018-08-20 19:11:29 +00:00
|
|
|
if stdenv.hostPlatform.system == "i686-linux" then fetchurl {
|
2019-09-03 20:51:04 +00:00
|
|
|
url = "${dir}/essential-${version}.tar.bz2";
|
2010-08-20 20:09:22 +00:00
|
|
|
sha256 = "18vls12n12rjw0mzw4pkp9vpcfmd1c21rzha19d7zil4hn7fs2ic";
|
2018-08-20 19:11:29 +00:00
|
|
|
} else if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
|
2019-09-03 20:51:04 +00:00
|
|
|
url = "${dir}/essential-amd64-${version}.tar.bz2";
|
2010-08-20 20:09:22 +00:00
|
|
|
sha256 = "13xf5b92w1ra5hw00ck151lypbmnylrnznq9hhb0sj36z5wz290x";
|
2018-08-20 19:11:29 +00:00
|
|
|
} else if stdenv.hostPlatform.system == "powerpc-linux" then fetchurl {
|
2019-09-03 20:51:04 +00:00
|
|
|
url = "${dir}/essential-ppc-${version}.tar.bz2";
|
2010-08-20 20:09:22 +00:00
|
|
|
sha256 = "18mlj8dp4wnz42xbhdk1jlz2ygra6fbln9wyrcyvynxh96g1871z";
|
|
|
|
} else null;
|
|
|
|
|
|
|
|
codecs = if codecs_src != null then stdenv.mkDerivation {
|
2019-09-03 20:51:04 +00:00
|
|
|
pname = "MPlayer-codecs-essential";
|
2011-05-21 07:31:07 +00:00
|
|
|
|
2010-08-20 20:09:22 +00:00
|
|
|
src = codecs_src;
|
2004-04-01 18:06:09 +00:00
|
|
|
|
2010-04-14 12:13:01 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp -prv * $out
|
|
|
|
'';
|
2011-05-21 07:31:07 +00:00
|
|
|
|
2021-01-15 05:42:41 +00:00
|
|
|
meta.license = lib.licenses.unfree;
|
2010-08-20 20:09:22 +00:00
|
|
|
} else null;
|
2012-01-21 21:25:41 +00:00
|
|
|
|
2017-09-05 17:13:02 +00:00
|
|
|
crossBuild = stdenv.hostPlatform != stdenv.buildPlatform;
|
|
|
|
|
2011-05-21 07:31:07 +00:00
|
|
|
in
|
2006-12-05 22:28:45 +00:00
|
|
|
|
2019-09-04 09:02:42 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-09-03 20:51:04 +00:00
|
|
|
pname = "mplayer";
|
2024-07-13 07:27:32 +00:00
|
|
|
version = "1.5-unstable-2024-07-03";
|
2006-12-05 22:28:45 +00:00
|
|
|
|
2022-02-05 10:57:09 +00:00
|
|
|
src = fetchsvn {
|
|
|
|
url = "svn://svn.mplayerhq.hu/mplayer/trunk";
|
2024-07-13 07:27:32 +00:00
|
|
|
rev = "38637";
|
|
|
|
hash = "sha256-9KQOB6QIs1VZhazJqW8dY4ASiMgoxV6davfpKgLPbmE=";
|
2006-12-05 22:28:45 +00:00
|
|
|
};
|
|
|
|
|
2011-04-23 21:06:39 +00:00
|
|
|
prePatch = ''
|
|
|
|
sed -i /^_install_strip/d configure
|
2017-06-14 15:44:33 +00:00
|
|
|
|
|
|
|
rm -rf ffmpeg
|
2011-04-23 21:06:39 +00:00
|
|
|
'';
|
|
|
|
|
2017-06-26 03:10:03 +00:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2021-01-17 02:09:27 +00:00
|
|
|
nativeBuildInputs = [ pkg-config yasm ];
|
2024-08-16 17:29:06 +00:00
|
|
|
buildInputs = [ freetype ffmpeg_6 ]
|
|
|
|
++ lib.optional aalibSupport aalib
|
|
|
|
++ lib.optional fontconfigSupport fontconfig
|
|
|
|
++ lib.optional fribidiSupport fribidi
|
|
|
|
++ lib.optionals x11Support [ libX11 libXext libGLU libGL ]
|
|
|
|
++ lib.optional alsaSupport alsa-lib
|
|
|
|
++ lib.optional xvSupport libXv
|
|
|
|
++ lib.optional theoraSupport libtheora
|
|
|
|
++ lib.optional cacaSupport libcaca
|
|
|
|
++ lib.optional xineramaSupport libXinerama
|
|
|
|
++ lib.optional dvdnavSupport libdvdnav
|
|
|
|
++ lib.optional dvdreadSupport libdvdread
|
|
|
|
++ lib.optional bluraySupport libbluray
|
|
|
|
++ lib.optional cddaSupport cdparanoia
|
|
|
|
++ lib.optional jackaudioSupport libjack2
|
|
|
|
++ lib.optionals amrSupport [ amrnb amrwb ]
|
|
|
|
++ lib.optional x264Support x264
|
|
|
|
++ lib.optional pulseSupport libpulseaudio
|
|
|
|
++ lib.optional screenSaverSupport libXScrnSaver
|
|
|
|
++ lib.optional lameSupport lame
|
|
|
|
++ lib.optional vdpauSupport libvdpau
|
|
|
|
++ lib.optional speexSupport speex
|
|
|
|
++ lib.optional libpngSupport libpng
|
|
|
|
++ lib.optional libjpegSupport libjpeg
|
|
|
|
++ lib.optional bs2bSupport libbs2b
|
|
|
|
++ lib.optional v4lSupport libv4l
|
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.OpenGL ]
|
2012-11-04 17:58:13 +00:00
|
|
|
;
|
2005-08-24 15:02:30 +00:00
|
|
|
|
2017-09-05 17:13:02 +00:00
|
|
|
configurePlatforms = [ ];
|
2024-08-16 17:29:06 +00:00
|
|
|
configureFlags = [
|
2017-09-05 17:13:02 +00:00
|
|
|
"--enable-freetype"
|
|
|
|
(if fontconfigSupport then "--enable-fontconfig" else "--disable-fontconfig")
|
|
|
|
(if x11Support then "--enable-x11 --enable-gl" else "--disable-x11 --disable-gl")
|
|
|
|
(if xineramaSupport then "--enable-xinerama" else "--disable-xinerama")
|
|
|
|
(if xvSupport then "--enable-xv" else "--disable-xv")
|
|
|
|
(if alsaSupport then "--enable-alsa" else "--disable-alsa")
|
|
|
|
(if screenSaverSupport then "--enable-xss" else "--disable-xss")
|
|
|
|
(if vdpauSupport then "--enable-vdpau" else "--disable-vdpau")
|
|
|
|
(if cddaSupport then "--enable-cdparanoia" else "--disable-cdparanoia")
|
|
|
|
(if dvdnavSupport then "--enable-dvdnav" else "--disable-dvdnav")
|
|
|
|
(if bluraySupport then "--enable-bluray" else "--disable-bluray")
|
|
|
|
(if amrSupport then "--enable-libopencore_amrnb" else "--disable-libopencore_amrnb")
|
|
|
|
(if cacaSupport then "--enable-caca" else "--disable-caca")
|
|
|
|
(if lameSupport then "--enable-mp3lame --disable-mp3lame-lavc" else "--disable-mp3lame --enable-mp3lame-lavc")
|
|
|
|
(if speexSupport then "--enable-speex" else "--disable-speex")
|
|
|
|
(if theoraSupport then "--enable-theora" else "--disable-theora")
|
|
|
|
(if x264Support then "--enable-x264 --disable-x264-lavc" else "--disable-x264 --enable-x264-lavc")
|
|
|
|
(if jackaudioSupport then "" else "--disable-jack")
|
|
|
|
(if pulseSupport then "--enable-pulse" else "--disable-pulse")
|
2020-10-01 00:35:05 +00:00
|
|
|
(if v4lSupport then "--enable-v4l2 --enable-tv-v4l2" else "--disable-v4l2 --disable-tv-v4l2")
|
2017-09-05 17:13:02 +00:00
|
|
|
"--disable-xanim"
|
|
|
|
"--disable-xvid --disable-xvid-lavc"
|
|
|
|
"--disable-ossaudio"
|
|
|
|
"--disable-ffmpeg_a"
|
|
|
|
"--yasm=${buildPackages.yasm}/bin/yasm"
|
2024-08-16 17:29:06 +00:00
|
|
|
# Note, the `target` vs `host` confusion is intentional.
|
2017-09-05 17:13:02 +00:00
|
|
|
"--target=${stdenv.hostPlatform.config}"
|
2024-08-16 17:29:06 +00:00
|
|
|
] ++ lib.optional (useUnfreeCodecs && codecs != null && !crossBuild) "--codecsdir=${codecs}"
|
|
|
|
++ lib.optional (stdenv.hostPlatform.isx86 && !crossBuild) "--enable-runtime-cpudetection"
|
|
|
|
++ lib.optional fribidiSupport "--enable-fribidi"
|
|
|
|
++ lib.optional (stdenv.isLinux && !stdenv.isAarch64) "--enable-vidix"
|
|
|
|
++ lib.optional stdenv.isLinux "--enable-fbdev"
|
|
|
|
++ lib.optionals (crossBuild) [
|
2017-09-05 17:13:02 +00:00
|
|
|
"--enable-cross-compile"
|
|
|
|
"--disable-vidix-pcidb"
|
|
|
|
"--with-vidix-drivers=no"
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
configureFlagsArray+=(
|
|
|
|
"--cc=$CC"
|
2020-04-28 04:08:48 +00:00
|
|
|
"--host-cc=$CC_FOR_BUILD"
|
2017-09-05 17:13:02 +00:00
|
|
|
"--as=$AS"
|
|
|
|
"--nm=$NM"
|
|
|
|
"--ar=$AR"
|
|
|
|
"--ranlib=$RANLIB"
|
|
|
|
"--windres=$WINDRES"
|
|
|
|
)
|
|
|
|
'';
|
2010-08-11 20:14:25 +00:00
|
|
|
|
2011-05-20 08:06:02 +00:00
|
|
|
postConfigure = ''
|
|
|
|
echo CONFIG_MPEGAUDIODSP=yes >> config.mak
|
2011-04-23 21:06:39 +00:00
|
|
|
'';
|
|
|
|
|
2024-03-23 13:42:21 +00:00
|
|
|
# Fixes compilation with newer versions of clang that make these warnings errors by default.
|
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-int-conversion -Wno-incompatible-function-pointer-types";
|
|
|
|
|
2024-08-16 17:29:06 +00:00
|
|
|
NIX_LDFLAGS = toString (
|
|
|
|
lib.optional fontconfigSupport "-lfontconfig"
|
|
|
|
++ lib.optional fribidiSupport "-lfribidi"
|
|
|
|
++ lib.optionals x11Support [ "-lX11" "-lXext" ]
|
|
|
|
++ lib.optional x264Support "-lx264"
|
2020-06-12 13:30:41 +00:00
|
|
|
++ [ "-lfreetype" ]
|
2019-10-30 00:40:49 +00:00
|
|
|
);
|
2010-08-11 20:14:25 +00:00
|
|
|
|
2021-01-15 05:42:41 +00:00
|
|
|
installTargets = [ "install" ] ++ lib.optional x11Support "install-gui";
|
2013-02-28 20:15:59 +00:00
|
|
|
|
2013-01-14 22:08:27 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2013-08-26 19:16:18 +00:00
|
|
|
# Provide a reasonable standard font when not using fontconfig. Maybe we should symlink here.
|
2021-01-15 05:42:41 +00:00
|
|
|
postInstall = lib.optionalString (!fontconfigSupport)
|
2010-12-23 17:07:07 +00:00
|
|
|
''
|
|
|
|
mkdir -p $out/share/mplayer
|
|
|
|
cp ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mplayer/subfont.ttf
|
2013-02-28 20:15:59 +00:00
|
|
|
if test -f $out/share/applications/mplayer.desktop ; then
|
|
|
|
echo "NoDisplay=True" >> $out/share/applications/mplayer.desktop
|
|
|
|
fi
|
2010-12-23 17:07:07 +00:00
|
|
|
'';
|
|
|
|
|
2021-09-14 21:48:36 +00:00
|
|
|
meta = with lib; {
|
2006-10-11 16:45:55 +00:00
|
|
|
description = "Movie player that supports many video formats";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://mplayerhq.hu";
|
2021-09-14 21:48:36 +00:00
|
|
|
license = licenses.gpl2Only;
|
|
|
|
maintainers = with maintainers; [ eelco ];
|
2023-08-14 19:45:22 +00:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
|
2006-10-11 16:45:55 +00:00
|
|
|
};
|
2003-11-11 15:01:07 +00:00
|
|
|
}
|