nixpkgs/pkgs/by-name/jf/jffi/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.6 KiB
Nix
Raw Normal View History

2024-03-25 18:51:15 +00:00
{ lib
, stdenv
, fetchFromGitHub
, ant
, jdk
, libffi
, pkg-config
, texinfo
, stripJavaArchivesHook
}:
2022-01-14 23:16:10 +00:00
2024-03-25 18:51:15 +00:00
stdenv.mkDerivation (finalAttrs: {
2022-01-14 23:16:10 +00:00
pname = "jffi";
2024-02-20 07:10:06 +00:00
version = "1.3.13";
2022-01-14 23:16:10 +00:00
src = fetchFromGitHub {
owner = "jnr";
repo = "jffi";
2024-03-25 18:51:15 +00:00
rev = "jffi-${finalAttrs.version}";
hash = "sha256-aBQkkZyXZkaJc4sr/jHnIRaJYP116u4Jqsr9XXzfOBA=";
2022-01-14 23:16:10 +00:00
};
2024-03-25 18:51:15 +00:00
nativeBuildInputs = [
ant
jdk
pkg-config
texinfo
stripJavaArchivesHook
];
2022-01-14 23:16:10 +00:00
2024-03-25 18:51:15 +00:00
buildInputs = [ libffi ];
2022-01-14 23:16:10 +00:00
2024-03-25 18:51:15 +00:00
# The pkg-config script in the build.xml doesn't work propery
# set the lib path manually to work around this.
env.LIBFFI_LIBS = "${libffi}/lib/libffi${stdenv.hostPlatform.extensions.sharedLibrary}";
env.ANT_ARGS = "-Duse.system.libffi=1";
2022-01-14 23:16:10 +00:00
2024-03-25 18:51:15 +00:00
buildPhase = ''
runHook preBuild
ant jar
ant archive-platform-jar
runHook postBuild
2022-01-14 23:16:10 +00:00
'';
doCheck = true;
2024-03-25 18:51:15 +00:00
2022-01-14 23:16:10 +00:00
checkPhase = ''
2024-03-25 18:51:15 +00:00
runHook preCheck
ant test
runHook postCheck
'';
installPhase = ''
runHook preInstall
install -Dm644 dist/*.jar -t $out/share/java
runHook postInstall
'';
2022-01-14 23:16:10 +00:00
2024-03-25 18:51:15 +00:00
# nix can't detect libffi as a dependency inside the jar file, so we create
# a dummy file with the path to libffi, to make sure that nix knows about it
postFixup = ''
mkdir -p $out/nix-support
echo ${libffi} > $out/nix-support/depends
2022-01-14 23:16:10 +00:00
'';
meta = with lib; {
broken = stdenv.hostPlatform.isDarwin;
description = "Java Foreign Function Interface";
2022-01-14 23:16:10 +00:00
homepage = "https://github.com/jnr/jffi";
platforms = platforms.unix;
license = licenses.asl20;
maintainers = with maintainers; [ bachp ];
};
2024-03-25 18:51:15 +00:00
})