diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix --- a/nix/dev-shell.nix +++ b/nix/dev-shell.nix @@ -8,6 +8,7 @@ , cmake , cryptopp , darwin +, fbjni , folly , fmt , grpc @@ -59,6 +60,7 @@ # include any libraries buildInputs buildInputs = [ + fbjni # android builds protobuf_3_15_cmake # exposes both a library and a command, thus should appear in both inputs folly # cpp tools fmt # needed for folly diff --git a/nix/fbjni.nix b/nix/fbjni.nix new file mode 100644 --- /dev/null +++ b/nix/fbjni.nix @@ -0,0 +1,47 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, fetchpatch +, openjdk +, gtest +}: + +stdenv.mkDerivation rec { + pname = "fbjni"; + version = "0.3.0"; + + src = fetchFromGitHub { + owner = "facebookincubator"; + repo = pname; + rev = "v${version}"; + sha256 = "132s9c8vlx1r4zcjjsgii9n3f2fx5qxgj3yvg6hw0dzg61x07bpg"; + }; + + patches = [ + # fix cmake install of cmake and include directories + (fetchpatch { + url = "https://github.com/facebookincubator/fbjni/pull/76.patch"; + sha256 = "sha256-ZCJmzwTKT/n4rdypXBZ2Vv8qYVcQxB3UoFIgoK7qmvE="; + }) + ]; + + nativeBuildInputs = [ + cmake + openjdk + ]; + + buildInputs = [ + gtest + ]; + + cmakeFlags = [ + "-DJAVA_HOME=${openjdk.passthru.home}" + ]; + + meta = with lib; { + description = "A library designed to simplify the usage of the Java Native Interface"; + homepage = "https://github.com/facebookincubator/fbjni"; + license = licenses.asl20; + }; +} diff --git a/nix/overlay.nix b/nix/overlay.nix --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -38,4 +38,6 @@ ''${!outputDev}/include/olm ''; }); + + fbjni = prev.callPackage ./fbjni.nix { }; }