Skip to content

Commit

Permalink
sqlite{,-analyzer}: use the same src (NixOS#40945)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukateras committed May 23, 2018
1 parent 11fe14b commit e28a586
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 36 deletions.
18 changes: 3 additions & 15 deletions pkgs/development/libraries/sqlite/analyzer.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
{ stdenv, fetchurl, unzip, sqlite, tcl }:

let
archiveVersion = import ./archive-version.nix stdenv.lib;
in
{ stdenv, tcl, sqlite }:

stdenv.mkDerivation rec {
name = "sqlite-analyzer-${version}";
version = "3.23.1";

src = assert version == sqlite.version; fetchurl {
url = "https://sqlite.org/2018/sqlite-src-${archiveVersion version}.zip";
sha256 = "1z3xr8d8ds4l8ndkg34cii13d0w790nlxdkrw6virinqi7wmmd1d";
};

nativeBuildInputs = [ unzip ];
buildInputs = [ tcl ];
inherit (sqlite) src version;

nativeBuildInputs = [ tcl ];
makeFlags = [ "sqlite3_analyzer" ];

installPhase = "install -Dt $out/bin sqlite3_analyzer";

meta = with stdenv.lib; {
Expand Down
11 changes: 0 additions & 11 deletions pkgs/development/libraries/sqlite/archive-version.nix

This file was deleted.

31 changes: 21 additions & 10 deletions pkgs/development/libraries/sqlite/default.nix
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
{ stdenv, fetchurl, zlib, interactive ? false, readline ? null, ncurses ? null }:
{ stdenv, fetchzip, tcl, zlib, interactive ? false, readline ? null, ncurses ? null }:

assert interactive -> readline != null && ncurses != null;

with stdenv.lib;

let
archiveVersion = import ./archive-version.nix stdenv.lib;
archiveVersion = version:
let
segments = splitString "." version;
major = head segments;
minor = concatMapStrings (fixedWidthNumber 2) (tail segments);
in
major + minor + "00";
in

stdenv.mkDerivation rec {
name = "sqlite-${version}";
version = "3.23.1";

# NB! Make sure to update analyzer.nix src (in the same directory).
src = fetchurl {
url = "https://sqlite.org/2018/sqlite-autoconf-${archiveVersion version}.tar.gz";
sha256 = "09ggapjhqjb2pzk0wkfczil77plijg3d77m2bpzlwx2y7ql2p14j";
src = fetchzip {
url = "https://sqlite.org/2018/sqlite-src-${archiveVersion version}.zip";
sha256 = "1dshxmiqdiympg1i2jsz3x543zmcgzhn78lpsjc0546rir0s0zk0";
};

outputs = [ "bin" "dev" "out" ];
separateDebugInfo = stdenv.isLinux;

buildInputs = [ zlib ] ++ optionals interactive [ readline ncurses ];
nativeBuildInputs = [ tcl ];
buildInputs = [ zlib ]
++ optionals interactive [ readline ncurses ];

configureFlags = [ "--enable-threadsafe" ] ++ optional interactive "--enable-readline";
configureFlags = [
# Disables libtclsqlite.so, tcl is still required for the build itself:
"--disable-tcl"
"--enable-threadsafe"
] ++ optional interactive "--enable-readline";

NIX_CFLAGS_COMPILE = [
"-DSQLITE_ENABLE_COLUMN_METADATA"
Expand Down Expand Up @@ -61,9 +72,9 @@ stdenv.mkDerivation rec {
# Necessary for FTS5 on Linux
export NIX_LDFLAGS="$NIX_LDFLAGS -lm"
echo ""
echo
echo "NIX_CFLAGS_COMPILE = $NIX_CFLAGS_COMPILE"
echo ""
echo
'';

meta = {
Expand Down

0 comments on commit e28a586

Please sign in to comment.