lol
1{ stdenv, fetchurl, pkgconfig, fontconfig, autoreconfHook
2, withJava ? false, jdk ? null, ant ? null
3, withAACS ? false, libaacs ? null
4, withBDplus ? false, libbdplus ? null
5, withMetadata ? true, libxml2 ? null
6, withFonts ? true, freetype ? null
7}:
8
9with stdenv.lib;
10
11assert withJava -> jdk != null && ant != null;
12assert withAACS -> libaacs != null;
13assert withBDplus -> libbdplus != null;
14assert withMetadata -> libxml2 != null;
15assert withFonts -> freetype != null;
16
17# Info on how to use:
18# https://wiki.archlinux.org/index.php/BluRay
19
20stdenv.mkDerivation rec {
21 name = "libbluray-${version}";
22 version = "1.0.2";
23
24 src = fetchurl {
25 url = "http://get.videolan.org/libbluray/${version}/${name}.tar.bz2";
26 sha256 = "1zxfnw1xbghcj7b3zz5djndv6gwssxda19cz1lrlqrkg8577r7kd";
27 };
28
29 patches = optional withJava ./BDJ-JARFILE-path.patch;
30
31 nativeBuildInputs = [ pkgconfig autoreconfHook ]
32 ++ optionals withJava [ ant ]
33 ;
34
35 buildInputs = [ fontconfig ]
36 ++ optional withJava jdk
37 ++ optional withMetadata libxml2
38 ++ optional withFonts freetype
39 ;
40
41 propagatedBuildInputs = optional withAACS libaacs;
42
43 NIX_LDFLAGS = [
44 (optionalString withAACS "-L${libaacs}/lib -laacs")
45 (optionalString withBDplus "-L${libbdplus}/lib -lbdplus")
46 ];
47
48 preConfigure = ''
49 ${optionalString withJava ''export JDK_HOME="${jdk.home}"''}
50 '';
51
52 configureFlags = with stdenv.lib;
53 optional (! withJava) "--disable-bdjava-jar"
54 ++ optional (! withMetadata) "--without-libxml2"
55 ++ optional (! withFonts) "--without-freetype"
56 ;
57
58 meta = with stdenv.lib; {
59 homepage = http://www.videolan.org/developers/libbluray.html;
60 description = "Library to access Blu-Ray disks for video playback";
61 license = licenses.lgpl21;
62 maintainers = with maintainers; [ abbradar ];
63 platforms = platforms.unix;
64 };
65}