summary refs log tree commit diff
path: root/pkgs/development/libraries/sqlite/sqlite3_analyzer.nix
blob: d3e1a6dc17e77b327ee280ae5036d6ccf229c089 (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
{ lib, stdenv, fetchurl, unzip, tcl }:

stdenv.mkDerivation {
  name = "sqlite3_analyzer-3.8.10.1";

  src = fetchurl {
    url = "https://www.sqlite.org/2015/sqlite-src-3081001.zip";
    sha1 = "6z7w8y69jxr0xwxbhs8z3zf56zfs5x7z";
  };

  buildInputs = [ unzip tcl ];

  # A bug in the latest release of sqlite3 prevents bulding sqlite3_analyzer.
  # Hopefully this work-around can be removed for future releases.
  postConfigure = ''
    substituteInPlace Makefile \
      --replace '"#define SQLITE_ENABLE_DBSTAT_VTAB"' '"#define SQLITE_ENABLE_DBSTAT_VTAB 1"'
  '';

  buildPhase = ''
    make sqlite3_analyzer
  '';

  installPhase = ''
    mkdir -p "$out/bin"
    mv sqlite3_analyzer "$out/bin"
  '';

  meta = {
    homepage = http://www.sqlite.org/;
    description = "A tool that shows statistics about sqlite databases";
    platforms = stdenv.lib.platforms.unix;
    maintainers = with stdenv.lib.maintainers; [ pesterhazy ];
  };
}