2019-02-03 15:31:20 +00:00
|
|
|
{ config, stdenv, fetchurl, pkgconfig, freetype, yasm, ffmpeg
|
2015-03-09 06:58:48 +00:00
|
|
|
, aalibSupport ? true, aalib ? null
|
2013-08-26 20:16:18 +01:00
|
|
|
, fontconfigSupport ? true, fontconfig ? null, freefont_ttf ? null
|
2014-08-19 15:24:58 +01:00
|
|
|
, fribidiSupport ? true, fribidi ? null
|
2019-11-10 16:44:34 +00:00
|
|
|
, x11Support ? true, libX11 ? null, libXext ? null, libGLU, libGL ? null
|
2012-10-03 22:44:45 +01:00
|
|
|
, xineramaSupport ? true, libXinerama ? null
|
|
|
|
, xvSupport ? true, libXv ? null
|
2016-09-14 07:12:22 +01:00
|
|
|
, alsaSupport ? stdenv.isLinux, alsaLib ? null
|
2012-10-03 22:44:45 +01:00
|
|
|
, screenSaverSupport ? true, libXScrnSaver ? null
|
|
|
|
, vdpauSupport ? false, libvdpau ? null
|
2016-09-14 07:12:22 +01:00
|
|
|
, cddaSupport ? !stdenv.isDarwin, cdparanoia ? null
|
|
|
|
, dvdnavSupport ? !stdenv.isDarwin, libdvdnav ? null
|
2017-07-28 07:36:59 +01:00
|
|
|
, dvdreadSupport ? true, libdvdread ? null
|
2012-10-03 22:44:45 +01:00
|
|
|
, bluraySupport ? true, libbluray ? null
|
|
|
|
, amrSupport ? false, amrnb ? null, amrwb ? null
|
|
|
|
, cacaSupport ? true, libcaca ? null
|
2010-05-25 19:39:29 +01:00
|
|
|
, lameSupport ? true, lame ? null
|
2012-05-09 11:01:35 +01:00
|
|
|
, speexSupport ? true, speex ? null
|
2012-10-03 22:44:45 +01:00
|
|
|
, theoraSupport ? true, libtheora ? null
|
|
|
|
, x264Support ? false, x264 ? null
|
2015-06-27 08:17:52 +01:00
|
|
|
, jackaudioSupport ? false, libjack2 ? null
|
2019-02-03 15:31:20 +00:00
|
|
|
, pulseSupport ? config.pulseaudio or false, libpulseaudio ? null
|
2013-05-17 00:18:48 +01:00
|
|
|
, bs2bSupport ? false, libbs2b ? null
|
2012-11-04 17:58:13 +00:00
|
|
|
# For screenshots
|
|
|
|
, libpngSupport ? true, libpng ? null
|
2014-09-27 07:06:54 +01:00
|
|
|
, libjpegSupport ? true, libjpeg ? null
|
2013-01-14 22:08:27 +00:00
|
|
|
, useUnfreeCodecs ? false
|
2016-09-14 07:12:22 +01:00
|
|
|
, darwin ? null
|
2017-09-05 18:13:02 +01:00
|
|
|
, buildPackages
|
2005-08-24 16:02:30 +01:00
|
|
|
}:
|
2003-11-11 15:01:07 +00:00
|
|
|
|
2013-08-26 20:16:18 +01:00
|
|
|
assert fontconfigSupport -> (fontconfig != null);
|
|
|
|
assert (!fontconfigSupport) -> (freefont_ttf != null);
|
2014-08-19 15:24:58 +01:00
|
|
|
assert fribidiSupport -> (fribidi != null);
|
2019-11-10 16:44:34 +00:00
|
|
|
assert x11Support -> (libX11 != null && libXext != null && libGLU != null && libGL != null);
|
2010-08-11 21:14:25 +01:00
|
|
|
assert xineramaSupport -> (libXinerama != null && x11Support);
|
2012-10-03 22:44:45 +01:00
|
|
|
assert xvSupport -> (libXv != null && x11Support);
|
|
|
|
assert alsaSupport -> alsaLib != null;
|
2010-08-29 12:09:23 +01:00
|
|
|
assert screenSaverSupport -> libXScrnSaver != null;
|
2010-12-27 18:48:16 +00:00
|
|
|
assert vdpauSupport -> libvdpau != null;
|
2012-10-03 22:44:45 +01:00
|
|
|
assert cddaSupport -> cdparanoia != null;
|
|
|
|
assert dvdnavSupport -> libdvdnav != null;
|
2017-07-28 07:36:59 +01:00
|
|
|
assert dvdreadSupport -> libdvdread != null;
|
2012-10-03 22:44:45 +01:00
|
|
|
assert bluraySupport -> libbluray != null;
|
|
|
|
assert amrSupport -> (amrnb != null && amrwb != null);
|
|
|
|
assert cacaSupport -> libcaca != null;
|
|
|
|
assert lameSupport -> lame != null;
|
2012-05-09 11:01:35 +01:00
|
|
|
assert speexSupport -> speex != null;
|
2012-10-03 22:44:45 +01:00
|
|
|
assert theoraSupport -> libtheora != null;
|
|
|
|
assert x264Support -> x264 != null;
|
2015-06-27 08:17:52 +01:00
|
|
|
assert jackaudioSupport -> libjack2 != null;
|
2015-05-27 20:42:15 +01:00
|
|
|
assert pulseSupport -> libpulseaudio != null;
|
2013-05-17 00:18:48 +01:00
|
|
|
assert bs2bSupport -> libbs2b != null;
|
2012-11-04 17:58:13 +00:00
|
|
|
assert libpngSupport -> libpng != null;
|
2014-09-27 07:06:54 +01:00
|
|
|
assert libjpegSupport -> libjpeg != null;
|
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 21:09:22 +01:00
|
|
|
codecs_src =
|
|
|
|
let
|
2020-04-01 02:11:51 +01:00
|
|
|
dir = "http://www.mplayerhq.hu/MPlayer/releases/codecs/";
|
2019-09-03 21:51:04 +01:00
|
|
|
version = "20071007";
|
2010-08-20 21:09:22 +01:00
|
|
|
in
|
2018-08-20 20:11:29 +01:00
|
|
|
if stdenv.hostPlatform.system == "i686-linux" then fetchurl {
|
2019-09-03 21:51:04 +01:00
|
|
|
url = "${dir}/essential-${version}.tar.bz2";
|
2010-08-20 21:09:22 +01:00
|
|
|
sha256 = "18vls12n12rjw0mzw4pkp9vpcfmd1c21rzha19d7zil4hn7fs2ic";
|
2018-08-20 20:11:29 +01:00
|
|
|
} else if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
|
2019-09-03 21:51:04 +01:00
|
|
|
url = "${dir}/essential-amd64-${version}.tar.bz2";
|
2010-08-20 21:09:22 +01:00
|
|
|
sha256 = "13xf5b92w1ra5hw00ck151lypbmnylrnznq9hhb0sj36z5wz290x";
|
2018-08-20 20:11:29 +01:00
|
|
|
} else if stdenv.hostPlatform.system == "powerpc-linux" then fetchurl {
|
2019-09-03 21:51:04 +01:00
|
|
|
url = "${dir}/essential-ppc-${version}.tar.bz2";
|
2010-08-20 21:09:22 +01:00
|
|
|
sha256 = "18mlj8dp4wnz42xbhdk1jlz2ygra6fbln9wyrcyvynxh96g1871z";
|
|
|
|
} else null;
|
|
|
|
|
|
|
|
codecs = if codecs_src != null then stdenv.mkDerivation {
|
2019-09-03 21:51:04 +01:00
|
|
|
pname = "MPlayer-codecs-essential";
|
2011-05-21 08:31:07 +01:00
|
|
|
|
2010-08-20 21:09:22 +01:00
|
|
|
src = codecs_src;
|
2004-04-01 19:06:09 +01:00
|
|
|
|
2010-04-14 13:13:01 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp -prv * $out
|
|
|
|
'';
|
2011-05-21 08:31:07 +01:00
|
|
|
|
2014-06-19 05:19:00 +01:00
|
|
|
meta.license = stdenv.lib.licenses.unfree;
|
2010-08-20 21:09:22 +01:00
|
|
|
} else null;
|
2012-01-21 21:25:41 +00:00
|
|
|
|
2017-09-05 18:13:02 +01:00
|
|
|
crossBuild = stdenv.hostPlatform != stdenv.buildPlatform;
|
|
|
|
|
2011-05-21 08:31:07 +01:00
|
|
|
in
|
2006-12-05 22:28:45 +00:00
|
|
|
|
2019-09-04 10:02:42 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-09-03 21:51:04 +01:00
|
|
|
pname = "mplayer";
|
|
|
|
version = "1.4";
|
2006-12-05 22:28:45 +00:00
|
|
|
|
2012-10-03 22:44:45 +01:00
|
|
|
src = fetchurl {
|
2019-09-03 21:51:04 +01:00
|
|
|
url = "http://www.mplayerhq.hu/MPlayer/releases/MPlayer-${version}.tar.xz";
|
|
|
|
sha256 = "0j5mflr0wnklxsvnpmxvk704hscyn2785hvvihj2i3a7b3anwnc2";
|
2006-12-05 22:28:45 +00:00
|
|
|
};
|
|
|
|
|
2011-04-23 22:06:39 +01:00
|
|
|
prePatch = ''
|
|
|
|
sed -i /^_install_strip/d configure
|
2017-06-14 16:44:33 +01:00
|
|
|
|
|
|
|
rm -rf ffmpeg
|
2011-04-23 22:06:39 +01:00
|
|
|
'';
|
|
|
|
|
2017-06-26 04:10:03 +01:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
nativeBuildInputs = [ pkgconfig yasm ];
|
2012-10-03 22:44:45 +01:00
|
|
|
buildInputs = with stdenv.lib;
|
2017-09-05 18:13:02 +01:00
|
|
|
[ freetype ffmpeg ]
|
2015-03-09 06:58:48 +00:00
|
|
|
++ optional aalibSupport aalib
|
2013-08-26 20:16:18 +01:00
|
|
|
++ optional fontconfigSupport fontconfig
|
2014-08-19 15:24:58 +01:00
|
|
|
++ optional fribidiSupport fribidi
|
2019-11-10 16:44:34 +00:00
|
|
|
++ optionals x11Support [ libX11 libXext libGLU libGL ]
|
2012-10-03 22:44:45 +01:00
|
|
|
++ optional alsaSupport alsaLib
|
|
|
|
++ optional xvSupport libXv
|
|
|
|
++ optional theoraSupport libtheora
|
|
|
|
++ optional cacaSupport libcaca
|
|
|
|
++ optional xineramaSupport libXinerama
|
|
|
|
++ optional dvdnavSupport libdvdnav
|
2017-07-28 07:36:59 +01:00
|
|
|
++ optional dvdreadSupport libdvdread
|
2012-10-03 22:44:45 +01:00
|
|
|
++ optional bluraySupport libbluray
|
|
|
|
++ optional cddaSupport cdparanoia
|
2015-06-27 08:17:52 +01:00
|
|
|
++ optional jackaudioSupport libjack2
|
2012-10-03 22:44:45 +01:00
|
|
|
++ optionals amrSupport [ amrnb amrwb ]
|
|
|
|
++ optional x264Support x264
|
2015-05-27 20:42:15 +01:00
|
|
|
++ optional pulseSupport libpulseaudio
|
2012-10-03 22:44:45 +01:00
|
|
|
++ optional screenSaverSupport libXScrnSaver
|
|
|
|
++ optional lameSupport lame
|
|
|
|
++ optional vdpauSupport libvdpau
|
2012-11-04 17:58:13 +00:00
|
|
|
++ optional speexSupport speex
|
|
|
|
++ optional libpngSupport libpng
|
2014-09-27 07:06:54 +01:00
|
|
|
++ optional libjpegSupport libjpeg
|
2013-05-17 00:18:48 +01:00
|
|
|
++ optional bs2bSupport libbs2b
|
2016-09-14 07:12:22 +01:00
|
|
|
++ (with darwin.apple_sdk.frameworks; optionals stdenv.isDarwin [ Cocoa OpenGL ])
|
2012-11-04 17:58:13 +00:00
|
|
|
;
|
2005-08-24 16:02:30 +01:00
|
|
|
|
2017-09-05 18:13:02 +01:00
|
|
|
configurePlatforms = [ ];
|
|
|
|
configureFlags = with stdenv.lib; [
|
|
|
|
"--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")
|
|
|
|
"--disable-xanim"
|
|
|
|
"--disable-ivtv"
|
|
|
|
"--disable-xvid --disable-xvid-lavc"
|
|
|
|
"--disable-ossaudio"
|
|
|
|
"--disable-ffmpeg_a"
|
|
|
|
"--yasm=${buildPackages.yasm}/bin/yasm"
|
|
|
|
# Note, the `target` vs `host` confusion is intensional.
|
|
|
|
"--target=${stdenv.hostPlatform.config}"
|
|
|
|
] ++ optional
|
|
|
|
(useUnfreeCodecs && codecs != null && !crossBuild)
|
|
|
|
"--codecsdir=${codecs}"
|
|
|
|
++ optional
|
|
|
|
((stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) && !crossBuild)
|
|
|
|
"--enable-runtime-cpudetection"
|
|
|
|
++ optional fribidiSupport "--enable-fribidi"
|
|
|
|
++ optional stdenv.isLinux "--enable-vidix"
|
|
|
|
++ optional stdenv.isLinux "--enable-fbdev"
|
|
|
|
++ optionals (crossBuild) [
|
|
|
|
"--enable-cross-compile"
|
|
|
|
"--disable-vidix-pcidb"
|
|
|
|
"--with-vidix-drivers=no"
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
configureFlagsArray+=(
|
|
|
|
"--cc=$CC"
|
|
|
|
"--host-cc=$BUILD_CC"
|
|
|
|
"--as=$AS"
|
|
|
|
"--nm=$NM"
|
|
|
|
"--ar=$AR"
|
|
|
|
"--ranlib=$RANLIB"
|
|
|
|
"--windres=$WINDRES"
|
|
|
|
)
|
|
|
|
'';
|
2010-08-11 21:14:25 +01:00
|
|
|
|
2011-05-20 09:06:02 +01:00
|
|
|
postConfigure = ''
|
|
|
|
echo CONFIG_MPEGAUDIODSP=yes >> config.mak
|
2011-04-23 22:06:39 +01:00
|
|
|
'';
|
|
|
|
|
2019-10-30 00:40:49 +00:00
|
|
|
NIX_LDFLAGS = with stdenv.lib; toString (
|
2013-08-26 20:16:18 +01:00
|
|
|
optional fontconfigSupport "-lfontconfig"
|
2014-08-19 15:24:58 +01:00
|
|
|
++ optional fribidiSupport "-lfribidi"
|
2013-08-26 20:16:18 +01:00
|
|
|
++ optionals x11Support [ "-lX11" "-lXext" ]
|
2019-10-30 00:40:49 +00:00
|
|
|
);
|
2010-08-11 21:14:25 +01:00
|
|
|
|
2013-02-28 20:15:59 +00:00
|
|
|
installTargets = [ "install" ] ++ stdenv.lib.optional x11Support "install-gui";
|
|
|
|
|
2013-01-14 22:08:27 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2013-08-26 20:16:18 +01:00
|
|
|
# Provide a reasonable standard font when not using fontconfig. Maybe we should symlink here.
|
|
|
|
postInstall = stdenv.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
|
|
|
'';
|
|
|
|
|
2006-10-11 17:45:55 +01:00
|
|
|
meta = {
|
|
|
|
description = "A movie player that supports many video formats";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://mplayerhq.hu";
|
2008-03-06 09:34:36 +00:00
|
|
|
license = "GPL";
|
2017-03-27 18:11:17 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.eelco ];
|
2019-09-03 21:51:04 +01:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
|
2006-10-11 17:45:55 +01:00
|
|
|
};
|
2003-11-11 15:01:07 +00:00
|
|
|
}
|