Merge pull request #298989 from TomaSajt/jffi
jffi: clean up and make deterministic
This commit is contained in:
commit
50d5c2ee68
1 changed files with 49 additions and 23 deletions
|
@ -1,40 +1,66 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, jdk, jre, ant, libffi, texinfo, pkg-config }:
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchFromGitHub
|
||||||
|
, ant
|
||||||
|
, jdk
|
||||||
|
, libffi
|
||||||
|
, pkg-config
|
||||||
|
, texinfo
|
||||||
|
, stripJavaArchivesHook
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "jffi";
|
pname = "jffi";
|
||||||
version = "1.3.13";
|
version = "1.3.13";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "jnr";
|
owner = "jnr";
|
||||||
repo = "jffi";
|
repo = "jffi";
|
||||||
rev = "jffi-${version}";
|
rev = "jffi-${finalAttrs.version}";
|
||||||
sha256 = "sha256-aBQkkZyXZkaJc4sr/jHnIRaJYP116u4Jqsr9XXzfOBA=";
|
hash = "sha256-aBQkkZyXZkaJc4sr/jHnIRaJYP116u4Jqsr9XXzfOBA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ jdk ant texinfo pkg-config ];
|
nativeBuildInputs = [
|
||||||
buildInputs = [ libffi ] ;
|
ant
|
||||||
|
jdk
|
||||||
|
pkg-config
|
||||||
|
texinfo
|
||||||
|
stripJavaArchivesHook
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [ libffi ];
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
# The pkg-config script in the build.xml doesn't work propery
|
# The pkg-config script in the build.xml doesn't work propery
|
||||||
# set the lib path manually to work around this.
|
# set the lib path manually to work around this.
|
||||||
export LIBFFI_LIBS="${libffi}/lib/libffi.so"
|
env.LIBFFI_LIBS = "${libffi}/lib/libffi${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||||
|
env.ANT_ARGS = "-Duse.system.libffi=1";
|
||||||
|
|
||||||
ant -Duse.system.libffi=1 jar
|
buildPhase = ''
|
||||||
ant -Duse.system.libffi=1 archive-platform-jar
|
runHook preBuild
|
||||||
'';
|
ant jar
|
||||||
|
ant archive-platform-jar
|
||||||
installPhase = ''
|
runHook postBuild
|
||||||
mkdir -p $out/share/java
|
|
||||||
cp -r dist/* $out/share/java
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
checkPhase = ''
|
|
||||||
# The pkg-config script in the build.xml doesn't work propery
|
|
||||||
# set the lib path manually to work around this.
|
|
||||||
export LIBFFI_LIBS="${libffi}/lib/libffi.so"
|
|
||||||
|
|
||||||
ant -Duse.system.libffi=1 test
|
checkPhase = ''
|
||||||
|
runHook preCheck
|
||||||
|
ant test
|
||||||
|
runHook postCheck
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
install -Dm644 dist/*.jar -t $out/share/java
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
# 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
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
@ -45,4 +71,4 @@ stdenv.mkDerivation rec {
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
maintainers = with maintainers; [ bachp ];
|
maintainers = with maintainers; [ bachp ];
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
|
Loading…
Reference in a new issue