btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / be / bedops / package.nix
blobd455e98264cc131d9db583898ff163e8fb9f8342
1 { lib, stdenv, fetchFromGitHub, zlib, bzip2, jansson, makeWrapper }:
3 stdenv.mkDerivation rec {
4   pname = "bedops";
5   version = "2.4.41";
7   src = fetchFromGitHub {
8     owner = "bedops";
9     repo = "bedops";
10     rev = "v${version}";
11     sha256 = "sha256-VJBoi1+tHA4oOVOsClUfimB+mOV5ZSQsDcDq3vAZwBA=";
12   };
14   buildInputs = [ zlib bzip2 jansson ];
15   nativeBuildInputs = [ makeWrapper ];
17   preConfigure = ''
18     # We use nixpkgs versions of these libraries
19     rm -r third-party
20     sed -i '/^LIBS/d' system.mk/*
21     sed -i 's|^LIBRARIES.*$|LIBRARIES = -lbz2 -lz -ljansson|' */*/*/*/Makefile*
23     # `make support` installs above libraries
24     substituteInPlace system.mk/* \
25       --replace ": support" ":"
27     # Variable name is different in this makefile
28     substituteInPlace applications/bed/sort-bed/src/Makefile.darwin \
29       --replace "DIST_DIR" "BINDIR"
31     # `mkdir -p $BINDIR` is missing
32     substituteInPlace applications/bed/sort-bed/src/Makefile.darwin \
33       --replace 'mkdir -p ''${OBJ_DIR}' 'mkdir -p ''${OBJ_DIR} ''${BINDIR}'
35     substituteInPlace applications/bed/starch/src/Makefile --replace '$(LIBRARIES)' ""
37     # Function name is different in nixpkgs provided libraries
38     for f in interfaces/src/data/starch/starchFileHelpers.c applications/bed/starch/src/starchcat.c ; do
39       substituteInPlace $f --replace deflateInit2cpp deflateInit2
40     done
42     # Don't force static
43     for f in */*/*/*/Makefile* ; do
44       substituteInPlace $f --replace '-static' ""
45     done
46   '';
48   makeFlags = [ "BINDIR=$(out)/bin" ];
50   postFixup = ''
51     for f in $out/bin/* ; do
52       wrapProgram $f --prefix PATH : "$out/bin"
53     done
54   '';
56   meta = with lib; {
57     description = "Suite of tools for addressing questions arising in genomics studies";
58     homepage = "https://github.com/bedops/bedops";
59     license = licenses.gpl2Only;
60     maintainers = with maintainers; [ jbedo ];
61     platforms = platforms.x86_64;
62   };