summary refs log tree commit diff
path: root/pkgs/applications/science/biology/bayescan/default.nix
blob: 4e216fbdbe63f944ea6009cb1f9023acccf2cc82 (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
{ stdenv, fetchurl, unzip, llvmPackages }:

stdenv.mkDerivation rec {
  pname = "bayescan";
  version = "2.1";

  src = fetchurl {
    url = "http://cmpg.unibe.ch/software/BayeScan/files/BayeScan${version}.zip";
    sha256 = "0ismima8j8z0zj9yc267rpf7z90w57b2pbqzjnayhc3ab8mcbfy6";
  };

  nativeBuildInputs = [ unzip ];
  buildInputs = stdenv.lib.optional stdenv.cc.isClang llvmPackages.openmp;

  # Disable FORTIFY_SOURCE or the binary fails with "buffer overflow"
  hardeningDisable = [ "fortify" ];

  sourceRoot = "BayeScan${version}/source";

  postPatch = ''
    substituteInPlace Makefile --replace "-static" "" \
                               --replace "g++" "c++"
  '';

  installPhase = ''
    mkdir -p $out/bin
    mkdir -p $out/share/doc/bayescan
    cp bayescan_${version} $out/bin
    cp -r ../*pdf ../input_examples ../"R functions" $out/share/doc/bayescan
  '';

  meta = with stdenv.lib; {
    description = "Detecting natural selection from population-based genetic data";
    homepage = "http://cmpg.unibe.ch/software/BayeScan";
    license = licenses.gpl3;
    maintainers = [ maintainers.bzizou ];
    platforms = stdenv.lib.platforms.all;
  };
}