2013-01-30 23:26:30 +00:00
|
|
|
{ stdenv, fetchurl, fetchgit, freetype, pkgconfig, yasm, freefont_ttf, ffmpeg, libass
|
|
|
|
, python3, docutils, which
|
2013-04-04 11:50:09 +01:00
|
|
|
, x11Support ? true, libX11 ? null, libXext ? null, mesa ? null, libXxf86vm ? null
|
2013-01-30 23:26:30 +00:00
|
|
|
, xineramaSupport ? true, libXinerama ? null
|
|
|
|
, xvSupport ? true, libXv ? null
|
|
|
|
, alsaSupport ? true, alsaLib ? null
|
|
|
|
, screenSaverSupport ? true, libXScrnSaver ? null
|
|
|
|
, vdpauSupport ? true, libvdpau ? null
|
|
|
|
, dvdnavSupport ? true, libdvdnav ? null
|
|
|
|
, bluraySupport ? true, libbluray ? null
|
|
|
|
, speexSupport ? true, speex ? null
|
|
|
|
, theoraSupport ? true, libtheora ? null
|
2014-07-31 11:47:17 +01:00
|
|
|
, jackaudioSupport ? false, jack2 ? null
|
2013-01-30 23:26:30 +00:00
|
|
|
, pulseSupport ? true, pulseaudio ? null
|
2013-05-17 00:18:48 +01:00
|
|
|
, bs2bSupport ? false, libbs2b ? null
|
2013-01-30 23:26:30 +00:00
|
|
|
# For screenshots
|
|
|
|
, libpngSupport ? true, libpng ? null
|
2014-09-27 07:06:54 +01:00
|
|
|
, libjpegSupport ? true, libjpeg ? null
|
2013-01-30 23:26:30 +00:00
|
|
|
, useUnfreeCodecs ? false
|
|
|
|
}:
|
|
|
|
|
2013-04-04 11:50:09 +01:00
|
|
|
assert x11Support -> (libX11 != null && libXext != null && mesa != null && libXxf86vm != null);
|
2013-01-30 23:26:30 +00:00
|
|
|
assert xineramaSupport -> (libXinerama != null && x11Support);
|
|
|
|
assert xvSupport -> (libXv != null && x11Support);
|
|
|
|
assert alsaSupport -> alsaLib != null;
|
|
|
|
assert screenSaverSupport -> libXScrnSaver != null;
|
|
|
|
assert vdpauSupport -> libvdpau != null;
|
|
|
|
assert dvdnavSupport -> libdvdnav != null;
|
|
|
|
assert bluraySupport -> libbluray != null;
|
|
|
|
assert speexSupport -> speex != null;
|
|
|
|
assert theoraSupport -> libtheora != null;
|
2014-07-31 11:47:17 +01:00
|
|
|
assert jackaudioSupport -> jack2 != null;
|
2013-01-30 23:26:30 +00:00
|
|
|
assert pulseSupport -> pulseaudio != null;
|
2013-05-17 00:18:48 +01:00
|
|
|
assert bs2bSupport -> libbs2b != null;
|
2013-01-30 23:26:30 +00:00
|
|
|
assert libpngSupport -> libpng != null;
|
2014-09-27 07:06:54 +01:00
|
|
|
assert libjpegSupport -> libjpeg != null;
|
2013-01-30 23:26:30 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
codecs_src =
|
|
|
|
let
|
|
|
|
dir = http://www.mplayerhq.hu/MPlayer/releases/codecs/;
|
|
|
|
in
|
|
|
|
if stdenv.system == "i686-linux" then fetchurl {
|
|
|
|
url = "${dir}/essential-20071007.tar.bz2";
|
|
|
|
sha256 = "18vls12n12rjw0mzw4pkp9vpcfmd1c21rzha19d7zil4hn7fs2ic";
|
|
|
|
} else if stdenv.system == "x86_64-linux" then fetchurl {
|
|
|
|
url = "${dir}/essential-amd64-20071007.tar.bz2";
|
|
|
|
sha256 = "13xf5b92w1ra5hw00ck151lypbmnylrnznq9hhb0sj36z5wz290x";
|
|
|
|
} else if stdenv.system == "powerpc-linux" then fetchurl {
|
|
|
|
url = "${dir}/essential-ppc-20071007.tar.bz2";
|
|
|
|
sha256 = "18mlj8dp4wnz42xbhdk1jlz2ygra6fbln9wyrcyvynxh96g1871z";
|
|
|
|
} else null;
|
|
|
|
|
|
|
|
codecs = if codecs_src != null then stdenv.mkDerivation {
|
|
|
|
name = "MPlayer-codecs-essential-20071007";
|
|
|
|
|
|
|
|
src = codecs_src;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp -prv * $out
|
|
|
|
'';
|
|
|
|
|
2014-06-19 05:19:00 +01:00
|
|
|
meta.license = stdenv.lib.licenses.unfree;
|
2013-01-30 23:26:30 +00:00
|
|
|
} else null;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2013-12-09 13:49:34 +00:00
|
|
|
name = "mplayer2-20130428";
|
2013-01-30 23:26:30 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "git://git.mplayer2.org/mplayer2.git";
|
2013-12-09 13:49:34 +00:00
|
|
|
rev = "6c87a981baa4972fd71c25dfddea017b5a972e89";
|
|
|
|
sha256 = "b09c1331141dd0939dfa424ae14dc0bdf82c8a72bb32c78e3ad15e3ee1d2c851";
|
2013-01-30 23:26:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
sed -i /^_install_strip/d configure
|
2013-04-04 21:57:08 +01:00
|
|
|
|
|
|
|
sed -i '/stdlib/a#include <ctype.h>/' sub/sub*.c
|
2013-01-30 23:26:30 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = with stdenv.lib;
|
|
|
|
[ freetype pkgconfig ffmpeg libass docutils which ]
|
2013-04-04 11:50:09 +01:00
|
|
|
++ optionals x11Support [ libX11 libXext mesa libXxf86vm ]
|
2013-01-30 23:26:30 +00:00
|
|
|
++ optional alsaSupport alsaLib
|
|
|
|
++ optional xvSupport libXv
|
|
|
|
++ optional theoraSupport libtheora
|
|
|
|
++ optional xineramaSupport libXinerama
|
|
|
|
++ optionals dvdnavSupport [ libdvdnav libdvdnav.libdvdread ]
|
|
|
|
++ optional bluraySupport libbluray
|
2014-07-31 11:47:17 +01:00
|
|
|
++ optional jackaudioSupport jack2
|
2013-01-30 23:26:30 +00:00
|
|
|
++ optional pulseSupport pulseaudio
|
|
|
|
++ optional screenSaverSupport libXScrnSaver
|
|
|
|
++ optional vdpauSupport libvdpau
|
|
|
|
++ optional speexSupport speex
|
2013-05-17 00:18:48 +01:00
|
|
|
++ optional bs2bSupport libbs2b
|
2013-01-30 23:26:30 +00:00
|
|
|
++ optional libpngSupport libpng
|
2014-09-27 07:06:54 +01:00
|
|
|
++ optional libjpegSupport libjpeg
|
2013-01-30 23:26:30 +00:00
|
|
|
;
|
|
|
|
|
2013-02-15 12:38:07 +00:00
|
|
|
nativeBuildInputs = [ yasm python3 ];
|
2013-01-30 23:26:30 +00:00
|
|
|
|
2015-01-08 09:26:49 +00:00
|
|
|
postConfigure = ''
|
|
|
|
patchShebangs TOOLS
|
|
|
|
'';
|
|
|
|
|
2013-01-30 23:26:30 +00:00
|
|
|
configureFlags = with stdenv.lib;
|
|
|
|
''
|
|
|
|
${optionalString (useUnfreeCodecs && codecs != null) "--codecsdir=${codecs}"}
|
|
|
|
${optionalString (stdenv.isi686 || stdenv.isx86_64) "--enable-runtime-cpudetection"}
|
|
|
|
${optionalString dvdnavSupport "--extra-ldflags=-ldvdread"}
|
|
|
|
${if xvSupport then "--enable-xv" else "--disable-xv"}
|
2014-09-27 07:21:24 +01:00
|
|
|
${if x11Support then "--enable-x11 --enable-gl --extra-cflags=-I${libX11}/include"
|
|
|
|
else "--disable-x11 --disable-gl"}
|
2013-01-30 23:26:30 +00:00
|
|
|
--disable-xvid
|
|
|
|
--disable-ossaudio
|
|
|
|
'';
|
|
|
|
|
|
|
|
NIX_LDFLAGS = stdenv.lib.optionalString x11Support "-lX11 -lXext";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
# Provide a reasonable standard font. Maybe we should symlink here.
|
|
|
|
postInstall =
|
|
|
|
''
|
|
|
|
mkdir -p $out/share/mplayer
|
|
|
|
cp ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mplayer/subfont.ttf
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A movie player that supports many video formats (MPlayer fork)";
|
|
|
|
homepage = "http://mplayer2.org";
|
2014-06-19 05:19:00 +01:00
|
|
|
license = stdenv.lib.licenses.gpl3Plus;
|
2013-01-30 23:26:30 +00:00
|
|
|
maintainers = [ stdenv.lib.maintainers.viric ];
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|