jffi: clean up and make deterministic

TomaSajt e48ef08d 0c14ba3f

+47 -21
+47 -21
pkgs/development/libraries/java/jffi/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub, jdk, jre, ant, libffi, texinfo, pkg-config }: 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , ant 5 + , jdk 6 + , libffi 7 + , pkg-config 8 + , texinfo 9 + , stripJavaArchivesHook 10 + }: 2 11 3 - stdenv.mkDerivation rec { 12 + stdenv.mkDerivation (finalAttrs: { 4 13 pname = "jffi"; 5 14 version = "1.3.13"; 6 15 7 16 src = fetchFromGitHub { 8 17 owner = "jnr"; 9 18 repo = "jffi"; 10 - rev = "jffi-${version}"; 11 - sha256 = "sha256-aBQkkZyXZkaJc4sr/jHnIRaJYP116u4Jqsr9XXzfOBA="; 19 + rev = "jffi-${finalAttrs.version}"; 20 + hash = "sha256-aBQkkZyXZkaJc4sr/jHnIRaJYP116u4Jqsr9XXzfOBA="; 12 21 }; 13 22 14 - nativeBuildInputs = [ jdk ant texinfo pkg-config ]; 15 - buildInputs = [ libffi ] ; 23 + nativeBuildInputs = [ 24 + ant 25 + jdk 26 + pkg-config 27 + texinfo 28 + stripJavaArchivesHook 29 + ]; 16 30 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" 31 + buildInputs = [ libffi ]; 21 32 22 - ant -Duse.system.libffi=1 jar 23 - ant -Duse.system.libffi=1 archive-platform-jar 24 - ''; 33 + # The pkg-config script in the build.xml doesn't work propery 34 + # set the lib path manually to work around this. 35 + env.LIBFFI_LIBS = "${libffi}/lib/libffi${stdenv.hostPlatform.extensions.sharedLibrary}"; 36 + env.ANT_ARGS = "-Duse.system.libffi=1"; 25 37 26 - installPhase = '' 27 - mkdir -p $out/share/java 28 - cp -r dist/* $out/share/java 38 + buildPhase = '' 39 + runHook preBuild 40 + ant jar 41 + ant archive-platform-jar 42 + runHook postBuild 29 43 ''; 30 44 31 45 doCheck = true; 46 + 32 47 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" 48 + runHook preCheck 49 + ant test 50 + runHook postCheck 51 + ''; 52 + 53 + installPhase = '' 54 + runHook preInstall 55 + install -Dm644 dist/*.jar -t $out/share/java 56 + runHook postInstall 57 + ''; 36 58 37 - ant -Duse.system.libffi=1 test 59 + # nix can't detect libffi as a dependency inside the jar file, so we create 60 + # a dummy file with the path to libffi, to make sure that nix knows about it 61 + postFixup = '' 62 + mkdir -p $out/nix-support 63 + echo ${libffi} > $out/nix-support/depends 38 64 ''; 39 65 40 66 meta = with lib; { ··· 45 71 license = licenses.asl20; 46 72 maintainers = with maintainers; [ bachp ]; 47 73 }; 48 - } 74 + })