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