about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libbluray
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libbluray')
-rw-r--r--nixpkgs/pkgs/development/libraries/libbluray/BDJ-JARFILE-path.patch27
-rw-r--r--nixpkgs/pkgs/development/libraries/libbluray/default.nix66
2 files changed, 93 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libbluray/BDJ-JARFILE-path.patch b/nixpkgs/pkgs/development/libraries/libbluray/BDJ-JARFILE-path.patch
new file mode 100644
index 000000000000..8d9c5d0fbba7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbluray/BDJ-JARFILE-path.patch
@@ -0,0 +1,27 @@
+diff --git a/configure.ac b/configure.ac
+index 5fd3c8de..7ae343e0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -228,6 +228,10 @@ if test "x$use_bdjava_jar" = "xyes" && test "x$HAVE_ANT" = "xno"; then
+     AC_MSG_ERROR([BD-J requires ANT, but ant was not found. Please install it.])
+ fi
+ 
++if test "x$use_bdjava_jar" = "xyes"; then
++  CPPFLAGS="${CPPFLAGS} -DJARDIR='\"\$(datadir)/java\"'"
++fi
++
+ AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$java_arch"], ["Defines the architecture of the java vm."])
+ AC_DEFINE_UNQUOTED([JDK_HOME], ["$JDK_HOME"], [""])
+ AM_CONDITIONAL([USING_BDJAVA_BUILD_JAR], [ test $use_bdjava_jar = "yes" ])
+diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
+index 511ad533..e273b9e0 100644
+--- a/src/libbluray/bdj/bdj.c
++++ b/src/libbluray/bdj/bdj.c
+@@ -478,6 +478,7 @@ static const char *_find_libbluray_jar(BDJ_STORAGE *storage)
+     // pre-defined search paths for libbluray.jar
+     static const char * const jar_paths[] = {
+ #ifndef _WIN32
++        JARDIR "/" BDJ_JARFILE,
+         "/usr/share/java/" BDJ_JARFILE,
+         "/usr/share/libbluray/lib/" BDJ_JARFILE,
+ #endif
diff --git a/nixpkgs/pkgs/development/libraries/libbluray/default.nix b/nixpkgs/pkgs/development/libraries/libbluray/default.nix
new file mode 100644
index 000000000000..47015f3b981d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libbluray/default.nix
@@ -0,0 +1,66 @@
+{ lib, stdenv, fetchurl, pkg-config, fontconfig, autoreconfHook, DiskArbitration
+, withJava ? false, jdk ? null, ant ? null
+, withAACS ? false, libaacs ? null
+, withBDplus ? false, libbdplus ? null
+, withMetadata ? true, libxml2 ? null
+, withFonts ? true, freetype ? null
+}:
+
+with lib;
+
+assert withJava -> jdk != null && ant != null;
+assert withAACS -> libaacs != null;
+assert withBDplus -> libbdplus != null;
+assert withMetadata -> libxml2 != null;
+assert withFonts -> freetype != null;
+
+# Info on how to use:
+# https://wiki.archlinux.org/index.php/BluRay
+
+stdenv.mkDerivation rec {
+  pname = "libbluray";
+  version  = "1.3.1";
+
+  src = fetchurl {
+    url = "http://get.videolan.org/libbluray/${version}/${pname}-${version}.tar.bz2";
+    sha256 = "sha256-wksPQcW3N7u2XFRP5jSVY3p3HBClGd/IAudp8RK0O3U=";
+  };
+
+  patches = optional withJava ./BDJ-JARFILE-path.patch;
+
+  nativeBuildInputs = [ pkg-config autoreconfHook ]
+                      ++ optionals withJava [ ant ]
+                      ;
+
+  buildInputs = [ fontconfig ]
+                ++ optional withJava jdk
+                ++ optional withMetadata libxml2
+                ++ optional withFonts freetype
+                ++ optional stdenv.isDarwin DiskArbitration
+                ;
+
+  propagatedBuildInputs = optional withAACS libaacs;
+
+  NIX_LDFLAGS = toString [
+    (optionalString withAACS   "-L${libaacs}/lib -laacs")
+    (optionalString withBDplus "-L${libbdplus}/lib -lbdplus")
+  ];
+
+  preConfigure = ''
+    ${optionalString withJava ''export JDK_HOME="${jdk.home}"''}
+  '';
+
+  configureFlags =  with lib;
+                    optional (! withJava) "--disable-bdjava-jar"
+                 ++ optional (! withMetadata) "--without-libxml2"
+                 ++ optional (! withFonts) "--without-freetype"
+                 ;
+
+  meta = with lib; {
+    homepage = "http://www.videolan.org/developers/libbluray.html";
+    description = "Library to access Blu-Ray disks for video playback";
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ abbradar ];
+    platforms = platforms.unix;
+  };
+}