From e28a586f94e77f22d943288ad84f88be23c587f8 Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Wed, 23 May 2018 19:06:46 +0300 Subject: [PATCH] sqlite{,-analyzer}: use the same src (#40945) --- .../development/libraries/sqlite/analyzer.nix | 18 ++--------- .../libraries/sqlite/archive-version.nix | 11 ------- pkgs/development/libraries/sqlite/default.nix | 31 +++++++++++++------ 3 files changed, 24 insertions(+), 36 deletions(-) delete mode 100644 pkgs/development/libraries/sqlite/archive-version.nix diff --git a/pkgs/development/libraries/sqlite/analyzer.nix b/pkgs/development/libraries/sqlite/analyzer.nix index a0b1220b217d..2325a9c8d0db 100644 --- a/pkgs/development/libraries/sqlite/analyzer.nix +++ b/pkgs/development/libraries/sqlite/analyzer.nix @@ -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; { diff --git a/pkgs/development/libraries/sqlite/archive-version.nix b/pkgs/development/libraries/sqlite/archive-version.nix deleted file mode 100644 index 1f312ecef23a..000000000000 --- a/pkgs/development/libraries/sqlite/archive-version.nix +++ /dev/null @@ -1,11 +0,0 @@ -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 eaeafa741297..341474326480 100644 --- a/pkgs/development/libraries/sqlite/default.nix +++ b/pkgs/development/libraries/sqlite/default.nix @@ -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" @@ -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 = {