anchor.diff:                  ++ optional withFonts freetype
                   ;
   
  -  propagatedBuildInputs = stdenv.lib.optional withAACS libaacs;
  +  propagatedBuildInputs = optional withAACS libaacs;
  +
  +  NIX_LDFLAGS = [
  +    (optionalString withAACS   "-L${libaacs}/lib -laacs")
  +    (optionalString withBDplus "-L${libbdplus}/lib -lbdplus")
  +  ];
   
     preConfigure = ''
       ${optionalString withJava ''export JDK_HOME="${jdk.home}"''}
  -    ${optionalString withAACS ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${libaacs}/lib -laacs"''}
  -    ${optionalString withBDplus ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${libbdplus}/lib -lbdplus"''}
     '';
   
     configureFlags =  with stdenv.lib;
  
positive.code:                  ++ optional (! withFonts) "--without-freetype"
                   ;
  
    # Fix search path for BDJ jarfile
    patches = stdenv.lib.optional withJava ./BDJ-JARFILE-path.patch;
  
    meta = with stdenv.lib; {
      homepage = "http://www.videolan.org/developers/libbluray.html";
      description = "Library to access Blu-Ray disks for video playback";
      license = licenses.lgpl21;
      maintainers = [ maintainers.abbradar ];
      platforms = platforms.unix;
    };
  }
  
negative.code: 
  stdenv.mkDerivation rec {
    name = "libbluray-${version}";
    version  = "1.0.0";
  
    src = fetchurl {
      url = "http://get.videolan.org/libbluray/${version}/${name}.tar.bz2";
      sha256 = "1k3lag4lxi2jjd3zh4wcb5l3hadzm54j5kagh92yzfy76p9svqzp";
    };
  
    patches = optional withJava ./BDJ-JARFILE-path.patch;
  
    nativeBuildInputs = [ pkgconfig autoreconfHook ]
                        ++ optionals withJava [ ant ]
  