1{ lib, stdenv, fetchFromGitHub, jdk, jre, ant, libffi, texinfo, pkg-config }:
2
3stdenv.mkDerivation rec {
4 pname = "jffi";
5 version = "1.3.12";
6
7 src = fetchFromGitHub {
8 owner = "jnr";
9 repo = "jffi";
10 rev = "jffi-${version}";
11 sha256 = "sha256-U0pBoKewZEen7aH3rIvZ8dKKeXKE1+Z5WtfM0HK6/LQ=";
12 };
13
14 nativeBuildInputs = [ jdk ant texinfo pkg-config ];
15 buildInputs = [ libffi ] ;
16
17 buildPhase = ''
18 # The pkg-config script in the build.xml doesn't work propery
19 # set the lib path manually to work around this.
20 export LIBFFI_LIBS="${libffi}/lib/libffi.so"
21
22 ant -Duse.system.libffi=1 jar
23 ant -Duse.system.libffi=1 archive-platform-jar
24 '';
25
26 installPhase = ''
27 mkdir -p $out/share/java
28 cp -r dist/* $out/share/java
29 '';
30
31 doCheck = true;
32 checkPhase = ''
33 # The pkg-config script in the build.xml doesn't work propery
34 # set the lib path manually to work around this.
35 export LIBFFI_LIBS="${libffi}/lib/libffi.so"
36
37 ant -Duse.system.libffi=1 test
38 '';
39
40 meta = with lib; {
41 broken = stdenv.isDarwin;
42 description = "Java Foreign Function Interface ";
43 homepage = "https://github.com/jnr/jffi";
44 platforms = platforms.unix;
45 license = licenses.asl20;
46 maintainers = with maintainers; [ bachp ];
47 };
48}