diff --git a/pkgs/development/libraries/sqlite/analyzer.nix b/pkgs/development/libraries/sqlite/analyzer.nix index 2325a9c8d0db..a0b1220b217d 100644 --- a/pkgs/development/libraries/sqlite/analyzer.nix +++ b/pkgs/development/libraries/sqlite/analyzer.nix @@ -1,11 +1,23 @@ -{ stdenv, tcl, sqlite }: +{ stdenv, fetchurl, unzip, sqlite, tcl }: + +let + archiveVersion = import ./archive-version.nix stdenv.lib; +in stdenv.mkDerivation rec { name = "sqlite-analyzer-${version}"; - inherit (sqlite) src 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 ]; - nativeBuildInputs = [ tcl ]; makeFlags = [ "sqlite3_analyzer" ]; + installPhase = "install -Dt $out/bin sqlite3_analyzer"; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/sqlite/archive-version.nix b/pkgs/development/libraries/sqlite/archive-version.nix new file mode 100644 index 000000000000..1f312ecef23a --- /dev/null +++ b/pkgs/development/libraries/sqlite/archive-version.nix @@ -0,0 +1,11 @@ +lib: version: + +with lib; + +let + fragments = splitString "." version; + major = head fragments; + minor = concatMapStrings (fixedWidthNumber 2) (tail fragments); +in + +major + minor + "00" diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix index 341474326480..eaeafa741297 100644 --- a/pkgs/development/libraries/sqlite/default.nix +++ b/pkgs/development/libraries/sqlite/default.nix @@ -1,40 +1,29 @@ -{ stdenv, fetchzip, tcl, zlib, interactive ? false, readline ? null, ncurses ? null }: +{ stdenv, fetchurl, zlib, interactive ? false, readline ? null, ncurses ? null }: assert interactive -> readline != null && ncurses != null; with stdenv.lib; let - archiveVersion = version: - let - segments = splitString "." version; - major = head segments; - minor = concatMapStrings (fixedWidthNumber 2) (tail segments); - in - major + minor + "00"; + archiveVersion = import ./archive-version.nix stdenv.lib; in stdenv.mkDerivation rec { name = "sqlite-${version}"; version = "3.23.1"; - src = fetchzip { - url = "https://sqlite.org/2018/sqlite-src-${archiveVersion version}.zip"; - sha256 = "1dshxmiqdiympg1i2jsz3x543zmcgzhn78lpsjc0546rir0s0zk0"; + # 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"; }; outputs = [ "bin" "dev" "out" ]; separateDebugInfo = stdenv.isLinux; - nativeBuildInputs = [ tcl ]; - buildInputs = [ zlib ] - ++ optionals interactive [ readline ncurses ]; + buildInputs = [ zlib ] ++ optionals interactive [ readline ncurses ]; - configureFlags = [ - # Disables libtclsqlite.so, tcl is still required for the build itself: - "--disable-tcl" - "--enable-threadsafe" - ] ++ optional interactive "--enable-readline"; + configureFlags = [ "--enable-threadsafe" ] ++ optional interactive "--enable-readline"; NIX_CFLAGS_COMPILE = [ "-DSQLITE_ENABLE_COLUMN_METADATA" @@ -72,9 +61,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 = {