1{ lib, stdenv, fetchurl }:
2
3stdenv.mkDerivation rec {
4 pname = "findbugs";
5 version = "3.0.1";
6
7 src = fetchurl {
8 url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
9 sha256 = "06b46fz4nid7qvm36r66zw01fr87y4jyz21ixw27b8hkqah0s3p8";
10 };
11
12 buildPhase = ''
13 substituteInPlace bin/findbugs --replace /bin/pwd pwd
14 '';
15
16 installPhase = ''
17 d=$out/libexec/findbugs
18 mkdir -p $d $out/bin $out/nix-support
19
20 cp -prd bin lib plugin doc $d/
21 rm $d/bin/*.bat
22 for i in $d/bin/*; do
23 if [ -f $i ]; then ln -s $i $out/bin/; fi
24 done
25
26 # Get rid of unnecessary JARs.
27 rm $d/lib/ant.jar
28
29 # Make some JARs findable.
30 mkdir -p $out/share/java
31 ln -s $d/lib/{findbugs.jar,findbugs-ant.jar} $out/share/java/
32
33 cat <<EOF > $out/nix-support/setup-hook
34 export FINDBUGS_HOME=$d
35 EOF
36 '';
37
38 meta = with lib; {
39 description = "A static analysis tool to find bugs in Java programs automatically";
40 homepage = "http://findbugs.sourceforge.net/";
41 maintainers = with maintainers; [ pSub ];
42 platforms = with platforms; unix;
43 sourceProvenance = with sourceTypes; [ binaryBytecode ];
44 license = licenses.lgpl3;
45 };
46}