about summary refs log tree commit diff
path: root/pkgs/applications/science/biology/kent/default.nix
blob: f30a6725bb4743c4957ed0c19809ff1eb4c21b06 (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
81
82
83
84
85
{ lib, stdenv
, libpng
, libuuid
, zlib
, bzip2
, xz
, openssl
, curl
, libmysqlclient
, bash
, fetchFromGitHub
, which
}:
stdenv.mkDerivation rec {
  pname = "kent";
  version = "467";

  src = fetchFromGitHub {
    owner = "ucscGenomeBrowser";
    repo = pname;
    rev = "v${version}_base";
    hash = "sha256-Y8iHSo70nsPZwVy8ZiiqjU3mGrPOyPQkW0VpLS+ulGE=";
  };

  buildInputs = [ libpng libuuid zlib bzip2 xz openssl curl libmysqlclient ];

  postPatch = ''
    substituteInPlace ./src/checkUmask.sh \
      --replace "/bin/bash" "${bash}/bin/bash"

    substituteInPlace ./src/hg/sqlEnvTest.sh \
      --replace "which mysql_config" "${which}/bin/which ${libmysqlclient}/bin/mysql_config"
  '';

  buildPhase = ''
    runHook preBuild

    export MACHTYPE=$(uname -m)
    export CFLAGS="-fPIC"
    export MYSQLINC=$(mysql_config --include | sed -e 's/^-I//g')
    export MYSQLLIBS=$(mysql_config --libs)
    export HOME=$TMPDIR
    export DESTBINDIR=$HOME/bin

    mkdir -p $HOME/lib $HOME/bin/x86_64

    cd ./src
    chmod +x ./checkUmask.sh
    ./checkUmask.sh

    make libs
    cd jkOwnLib
    make

    cp ../lib/x86_64/jkOwnLib.a $HOME/lib
    cp ../lib/x86_64/jkweb.a $HOME/lib
    cp -r ../inc  $HOME/

    cd ../utils
    make

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/lib $out/inc
    cp $HOME/lib/jkOwnLib.a $out/lib
    cp $HOME/lib/jkweb.a $out/lib
    cp $HOME/bin/x86_64/* $out/bin
    cp -r $HOME/inc/* $out/inc/

    runHook postInstall
  '';

  meta = with lib; {
    description = "UCSC Genome Bioinformatics Group's suite of biological analysis tools, i.e. the kent utilities";
    homepage = "http://genome.ucsc.edu";
    changelog = "https://github.com/ucscGenomeBrowser/kent/releases/tag/v${version}_base";
    license = licenses.unfree;
    maintainers = with maintainers; [ scalavision ];
    platforms = platforms.linux;
  };
}