blob: 8ae46e7f5dc82fb02fac3d9b587678147c68be4d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
{ stdenv
, lib
, fetchFromGitHub
, jdk
, maven
, which
}:
let
pname = "jnr-posix";
version = "3.1.18";
src = fetchFromGitHub {
owner = "jnr";
repo = "jnr-posix";
rev = "jnr-posix-${version}";
hash = "sha256-zx8I9rsu9Kjef+LatDA1WIuO7Vgo0/JM5nGi3pSWch4=";
};
deps = stdenv.mkDerivation {
name = "${pname}-${version}-deps";
inherit src;
nativeBuildInputs = [ jdk maven ];
buildPhase = ''
runHook preBuild
mvn package -Dmaven.test.skip=true -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000
runHook postBuild
'';
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
installPhase = ''
runHook preInstall
find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete
find $out/.m2 -type f -iname '*.pom' -exec sed -i -e 's/\r\+$//' {} \;
runHook postInstall
'';
outputHashMode = "recursive";
outputHash = "sha256-gOw0KUFyZEMONwLwlHSiV+ZZ7JQhjZwg708Q1IciUfo=";
doCheck = false;
};
in
stdenv.mkDerivation rec {
inherit version pname src;
nativeBuildInputs = [ maven which ];
postPatch = ''
sed -i "s/\/usr\/bin\/id/$(which id | sed 's#/#\\/#g')/g" src/main/java/jnr/posix/JavaPOSIX.java
'';
buildPhase = ''
runHook preBuild
mvn package --offline -Dmaven.test.skip=true -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -D target/${pname}-${version}.jar $out/share/java/${pname}-${version}.jar
runHook postInstall
'';
meta = with lib; {
description = "jnr-posix is a lightweight cross-platform POSIX emulation layer for Java, written in Java and is part of the JNR project";
homepage = "https://github.com/jnr/jnr-posix";
license = with licenses; [ epl20 gpl2Only lgpl21Only ];
maintainers = with lib.maintainers; [ rhysmdnz ];
};
}
|