<commit_before>{ stdenv, fetchurl, pkgconfig, freetype, yasm
, fontconfigSupport ? true, fontconfig ? null, freefont_ttf ? null
, fribidiSupport ? true, fribidi ? null
, x11Support ? true, libX11 ? null, libXext ? null, mesa ? null
, xineramaSupport ? true, libXinerama ? null
, xvSupport ? true, libXv ? null
, alsaSupport ? true, alsaLib ? null
, screenSaverSupport ? true, libXScrnSaver ? null
, vdpauSupport ? false, libvdpau ? null
, cddaSupport ? true, cdparanoia ? null
, dvdnavSupport ? true, libdvdnav ? null
, bluraySupport ? true, libbluray ? null
, amrSupport ? false, amrnb ? null, amrwb ? null
, cacaSupport ? true, libcaca ? null
, lameSupport ? true, lame ? null
, speexSupport ? true, speex ? null
, theoraSupport ? true, libtheora ? null
, x264Support ? false, x264 ? null
, jackaudioSupport ? false, jack2 ? null
, pulseSupport ? false, pulseaudio ? null
, bs2bSupport ? false, libbs2b ? null
# For screenshots
, libpngSupport ? true, libpng ? null
, libjpegSupport ? true, libjpeg ? null
, useUnfreeCodecs ? false
}:

assert fontconfigSupport -> (fontconfig != null);
assert (!fontconfigSupport) -> (freefont_ttf != null);
assert fribidiSupport -> (fribidi != null);
assert x11Support -> (libX11 != null && libXext != null && mesa != null);
assert xineramaSupport -> (libXinerama != null && x11Support);
assert xvSupport -> (libXv != null && x11Support);
assert alsaSupport -> alsaLib != null;
assert screenSaverSupport -> libXScrnSaver != null;
assert vdpauSupport -> libvdpau != null;
assert cddaSupport -> cdparanoia != null;
assert dvdnavSupport -> libdvdnav != null;
assert bluraySupport -> libbluray != null;
assert amrSupport -> (amrnb != null && amrwb != null);
assert cacaSupport -> libcaca != null;
assert lameSupport -> lame != null;
assert speexSupport -> speex != null;
assert theoraSupport -> libtheora != null;
assert x264Support -> x264 != null;
assert jackaudioSupport -> jack2 != null;
assert pulseSupport -> pulseaudio != null;
assert bs2bSupport -> libbs2b != null;
assert libpngSupport -> libpng != null;
assert libjpegSupport -> libjpeg != null;

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
    '';

    meta.license = stdenv.lib.licenses.unfree;
  } else null;

in

stdenv.mkDerivation rec {
  name = "mplayer-1.1.1";

  src = fetchurl {
    # Old kind of URL:
    # url = http://tarballs.nixos.org/mplayer-snapshot-20101227.tar.bz2;
    # Snapshot I took on 20110423

    #Transient
    #url = http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2;
    #sha256 = "cc1b3fda75b172f02c3f46581cfb2c17f4090997fe9314ad046e464a76b858bb";

    url = "http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.1.1.tar.xz";
    sha256 = "ce8fc7c3179e6a57eb3a58cb7d1604388756b8a61764cc93e095e7aff3798c76";
  };

  prePatch = ''
    sed -i /^_install_strip/d configure
  '';

  buildInputs = with stdenv.lib;
    [ pkgconfig freetype ]
    ++ optional fontconfigSupport fontconfig
    ++ optional fribidiSupport fribidi
    ++ optionals x11Support [ libX11 libXext mesa ]
    ++ optional alsaSupport alsaLib
    ++ optional xvSupport libXv
    ++ optional theoraSupport libtheora
    ++ optional cacaSupport libcaca
    ++ optional xineramaSupport libXinerama
    ++ optional dvdnavSupport libdvdnav
    ++ optional bluraySupport libbluray
    ++ optional cddaSupport cdparanoia
    ++ optional jackaudioSupport jack2
    ++ optionals amrSupport [ amrnb amrwb ]
    ++ optional x264Support x264
    ++ optional pulseSupport pulseaudio<commit_msg>Enable aalib support in mplayer.<commit_after>{ stdenv, fetchurl, pkgconfig, freetype, yasm
, aalibSupport ? true, aalib ? null
, fontconfigSupport ? true, fontconfig ? null, freefont_ttf ? null
, fribidiSupport ? true, fribidi ? null
, x11Support ? true, libX11 ? null, libXext ? null, mesa ? null
, xineramaSupport ? true, libXinerama ? null
, xvSupport ? true, libXv ? null
, alsaSupport ? true, alsaLib ? null
, screenSaverSupport ? true, libXScrnSaver ? null
, vdpauSupport ? false, libvdpau ? null
, cddaSupport ? true, cdparanoia ? null
, dvdnavSupport ? true, libdvdnav ? null
, bluraySupport ? true, libbluray ? null
, amrSupport ? false, amrnb ? null, amrwb ? null
, cacaSupport ? true, libcaca ? null
, lameSupport ? true, lame ? null
, speexSupport ? true, speex ? null
, theoraSupport ? true, libtheora ? null
, x264Support ? false, x264 ? null
, jackaudioSupport ? false, jack2 ? null
, pulseSupport ? false, pulseaudio ? null
, bs2bSupport ? false, libbs2b ? null
# For screenshots
, libpngSupport ? true, libpng ? null
, libjpegSupport ? true, libjpeg ? null
, useUnfreeCodecs ? false
}:

assert fontconfigSupport -> (fontconfig != null);
assert (!fontconfigSupport) -> (freefont_ttf != null);
assert fribidiSupport -> (fribidi != null);
assert x11Support -> (libX11 != null && libXext != null && mesa != null);
assert xineramaSupport -> (libXinerama != null && x11Support);
assert xvSupport -> (libXv != null && x11Support);
assert alsaSupport -> alsaLib != null;
assert screenSaverSupport -> libXScrnSaver != null;
assert vdpauSupport -> libvdpau != null;
assert cddaSupport -> cdparanoia != null;
assert dvdnavSupport -> libdvdnav != null;
assert bluraySupport -> libbluray != null;
assert amrSupport -> (amrnb != null && amrwb != null);
assert cacaSupport -> libcaca != null;
assert lameSupport -> lame != null;
assert speexSupport -> speex != null;
assert theoraSupport -> libtheora != null;
assert x264Support -> x264 != null;
assert jackaudioSupport -> jack2 != null;
assert pulseSupport -> pulseaudio != null;
assert bs2bSupport -> libbs2b != null;
assert libpngSupport -> libpng != null;
assert libjpegSupport -> libjpeg != null;

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
    '';

    meta.license = stdenv.lib.licenses.unfree;
  } else null;

in

stdenv.mkDerivation rec {
  name = "mplayer-1.1.1";

  src = fetchurl {
    # Old kind of URL:
    # url = http://tarballs.nixos.org/mplayer-snapshot-20101227.tar.bz2;
    # Snapshot I took on 20110423

    #Transient
    #url = http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2;
    #sha256 = "cc1b3fda75b172f02c3f46581cfb2c17f4090997fe9314ad046e464a76b858bb";

    url = "http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.1.1.tar.xz";
    sha256 = "ce8fc7c3179e6a57eb3a58cb7d1604388756b8a61764cc93e095e7aff3798c76";
  };

  prePatch = ''
    sed -i /^_install_strip/d configure
  '';

  buildInputs = with stdenv.lib;
    [ pkgconfig freetype ]
    ++ optional aalibSupport aalib
    ++ optional fontconfigSupport fontconfig
    ++ optional fribidiSupport fribidi
    ++ optionals x11Support [ libX11 libXext mesa ]
    ++ optional alsaSupport alsaLib
    ++ optional xvSupport libXv
    ++ optional theoraSupport libtheora
    ++ optional cacaSupport libcaca
    ++ optional xineramaSupport libXinerama
    ++ optional dvdnavSupport libdvdnav
    ++ optional bluraySupport libbluray
    ++ optional cddaSupport cdparanoia
    ++ optional jackaudioSupport jack2
    ++ optionals amrSupport [ amrnb amrwb ]
    ++ optional x264Support x264
    ++ optional pulseSupport pulseaudio
{'fraction_non_alphanumeric': 0.11424298205246203, 'fraction_numerical': 0.059595029912563276, 'mean_word_length': 3.93079977311401, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2547810', 'n_tokens_mistral': 3413, 'n_tokens_neox': 3058, 'n_words': 706}