@@ -1,140 +0,0 @@
1−{ stdenv, fetchurl, fetchgit, freetype, pkgconfig, yasm, freefont_ttf, ffmpeg, libass
2−, python3, docutils, which
3−, x11Support ? true, libX11 ? null, libXext ? null, mesa ? null, libXxf86vm ? null
4−, xineramaSupport ? true, libXinerama ? null
5−, xvSupport ? true, libXv ? null
6−, alsaSupport ? true, alsaLib ? null
7−, screenSaverSupport ? true, libXScrnSaver ? null
8−, vdpauSupport ? true, libvdpau ? null
9−, dvdnavSupport ? true, libdvdnav ? null
10−, bluraySupport ? true, libbluray ? null
11−, speexSupport ? true, speex ? null
12−, theoraSupport ? true, libtheora ? null
13−, jackaudioSupport ? false, jack2 ? null
14−, pulseSupport ? true, pulseaudio ? null
15−, bs2bSupport ? false, libbs2b ? null
16−# For screenshots
17−, libpngSupport ? true, libpng ? null
18−, libjpegSupport ? true, libjpeg ? null
19−, useUnfreeCodecs ? false
20−}:
21−
22−assert x11Support -> (libX11 != null && libXext != null && mesa != null && libXxf86vm != null);
23−assert xineramaSupport -> (libXinerama != null && x11Support);
24−assert xvSupport -> (libXv != null && x11Support);
25−assert alsaSupport -> alsaLib != null;
26−assert screenSaverSupport -> libXScrnSaver != null;
27−assert vdpauSupport -> libvdpau != null;
28−assert dvdnavSupport -> libdvdnav != null;
29−assert bluraySupport -> libbluray != null;
30−assert speexSupport -> speex != null;
31−assert theoraSupport -> libtheora != null;
32−assert jackaudioSupport -> jack2 != null;
33−assert pulseSupport -> pulseaudio != null;
34−assert bs2bSupport -> libbs2b != null;
35−assert libpngSupport -> libpng != null;
36−assert libjpegSupport -> libjpeg != null;
37−
38−let
39−
40− codecs_src =
41− let
42− dir = http://www.mplayerhq.hu/MPlayer/releases/codecs/;
43− in
44− if stdenv.system == "i686-linux" then fetchurl {
45− url = "${dir}/essential-20071007.tar.bz2";
46− sha256 = "18vls12n12rjw0mzw4pkp9vpcfmd1c21rzha19d7zil4hn7fs2ic";
47− } else if stdenv.system == "x86_64-linux" then fetchurl {
48− url = "${dir}/essential-amd64-20071007.tar.bz2";
49− sha256 = "13xf5b92w1ra5hw00ck151lypbmnylrnznq9hhb0sj36z5wz290x";
50− } else if stdenv.system == "powerpc-linux" then fetchurl {
51− url = "${dir}/essential-ppc-20071007.tar.bz2";
52− sha256 = "18mlj8dp4wnz42xbhdk1jlz2ygra6fbln9wyrcyvynxh96g1871z";
53− } else null;
54−
55− codecs = if codecs_src != null then stdenv.mkDerivation {
56− name = "MPlayer-codecs-essential-20071007";
57−
58− src = codecs_src;
59−
60− installPhase = ''
61− mkdir $out
62− cp -prv * $out
63− '';
64−
65− meta.license = stdenv.lib.licenses.unfree;
66− } else null;
67−
68−in
69−
70−stdenv.mkDerivation rec {
71− name = "mplayer2-20130428";
72−
73− src = fetchgit {
74− url = "git://git.mplayer2.org/mplayer2.git";
75− rev = "6c87a981baa4972fd71c25dfddea017b5a972e89";
76− sha256 = "b09c1331141dd0939dfa424ae14dc0bdf82c8a72bb32c78e3ad15e3ee1d2c851";
77− };
78−
79− prePatch = ''
80− sed -i /^_install_strip/d configure
81−
82− sed -i '/stdlib/a#include <ctype.h>/' sub/sub*.c
83− '';
84−
85− buildInputs = with stdenv.lib;
86− [ freetype pkgconfig ffmpeg libass docutils which ]
87− ++ optionals x11Support [ libX11 libXext mesa libXxf86vm ]
88− ++ optional alsaSupport alsaLib
89− ++ optional xvSupport libXv
90− ++ optional theoraSupport libtheora
91− ++ optional xineramaSupport libXinerama
92− ++ optionals dvdnavSupport [ libdvdnav libdvdnav.libdvdread ]
93− ++ optional bluraySupport libbluray
94− ++ optional jackaudioSupport jack2
95− ++ optional pulseSupport pulseaudio
96− ++ optional screenSaverSupport libXScrnSaver
97− ++ optional vdpauSupport libvdpau
98− ++ optional speexSupport speex
99− ++ optional bs2bSupport libbs2b
100− ++ optional libpngSupport libpng
101− ++ optional libjpegSupport libjpeg
102− ;
103−
104− nativeBuildInputs = [ yasm python3 ];
105−
106− postConfigure = ''
107− patchShebangs TOOLS
108− '';
109−
110− configureFlags = with stdenv.lib;
111− ''
112− ${optionalString (useUnfreeCodecs && codecs != null) "--codecsdir=${codecs}"}
113− ${optionalString (stdenv.isi686 || stdenv.isx86_64) "--enable-runtime-cpudetection"}
114− ${optionalString dvdnavSupport "--extra-ldflags=-ldvdread"}
115− ${if xvSupport then "--enable-xv" else "--disable-xv"}
116− ${if x11Support then "--enable-x11 --enable-gl --extra-cflags=-I${libX11}/include"
117− else "--disable-x11 --disable-gl"}
118− --disable-xvid
119− --disable-ossaudio
120− '';
121−
122− NIX_LDFLAGS = stdenv.lib.optionalString x11Support "-lX11 -lXext";
123−
124− enableParallelBuilding = true;
125−
126− # Provide a reasonable standard font. Maybe we should symlink here.
127− postInstall =
128− ''
129− mkdir -p $out/share/mplayer
130− cp ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mplayer/subfont.ttf
131− '';
132−
133− meta = {
134− description = "A movie player that supports many video formats (MPlayer fork)";
135− homepage = "http://mplayer2.org";
136− license = stdenv.lib.licenses.gpl3Plus;
137− maintainers = [ stdenv.lib.maintainers.viric ];
138− platforms = stdenv.lib.platforms.linux;
139− };
140−}