From ec6950e63a7400ff86847d9a2cb2a33a0b34325e Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Fri, 27 Sep 2024 11:40:39 +0200 Subject: [PATCH] tcl-9_0: init --- pkgs/development/interpreters/tcl/9.0.nix | 16 ++++++++++++ pkgs/development/interpreters/tcl/generic.nix | 26 +++++++++++++++++-- pkgs/top-level/all-packages.nix | 1 + 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/interpreters/tcl/9.0.nix diff --git a/pkgs/development/interpreters/tcl/9.0.nix b/pkgs/development/interpreters/tcl/9.0.nix new file mode 100644 index 0000000000000..48a9570675a1a --- /dev/null +++ b/pkgs/development/interpreters/tcl/9.0.nix @@ -0,0 +1,16 @@ +{ callPackage, fetchzip, ... }@args: + +callPackage ./generic.nix ( + args + // rec { + release = "9.0"; + version = "${release}.0"; + + # Note: when updating, the hash in pkgs/development/libraries/tk/9.0.nix must also be updated! + + src = fetchzip { + url = "mirror://sourceforge/tcl/tcl${version}-src.tar.gz"; + sha256 = "sha256-QaPSY6kfxyc3x+2ptzEmN2puZ0gSFSeeNjPuxsVKXYE="; + }; + } +) diff --git a/pkgs/development/interpreters/tcl/generic.nix b/pkgs/development/interpreters/tcl/generic.nix index 5df6fb28a3040..7746034c357dc 100644 --- a/pkgs/development/interpreters/tcl/generic.nix +++ b/pkgs/development/interpreters/tcl/generic.nix @@ -1,5 +1,5 @@ { lib, stdenv, callPackage, makeSetupHook, runCommand -, tzdata +, tzdata, zip, zlib # Version specific stuff , release, version, src @@ -24,17 +24,39 @@ let --replace "/usr/local/etc/zoneinfo" "" ''; + nativeBuildInputs = lib.optionals (lib.versionAtLeast version "9.0") [ + # Only used to detect the presence of zlib. Could be replaced with a stub. + zip + ]; + + buildInputs = lib.optionals (lib.versionAtLeast version "9.0") [ + zlib + ]; + preConfigure = '' cd unix ''; - configureFlags = [ + # Note: pre-9.0 flags are temporarily interspersed to avoid a mass rebuild. + configureFlags = lib.optionals (lib.versionOlder version "9.0") [ "--enable-threads" + ] ++ [ # Note: using $out instead of $man to prevent a runtime dependency on $man. "--mandir=${placeholder "out"}/share/man" + ] ++ lib.optionals (lib.versionOlder version "9.0") [ "--enable-man-symlinks" # Don't install tzdata because NixOS already has a more up-to-date copy. "--with-tzdata=no" + ] ++ lib.optionals (lib.versionAtLeast version "9.0") [ + # By default, tcl libraries get zipped and embedded into libtcl*.so, + # which gets `zipfs mount`ed at runtime. This is fragile (for example + # stripping the .so removes the zip trailer), so we install them as + # traditional files. + # This might make tcl slower to start from slower storage on cold cache, + # however according to my benchmarks on fast storage and warm cache + # tcl built with --disable-zipfs actually starts in half the time. + "--disable-zipfs" + ] ++ [ "tcl_cv_strtod_unbroken=ok" ] ++ lib.optional stdenv.hostPlatform.is64bit "--enable-64bit"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ab4e0b8b7236e..26bab338401a2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16619,6 +16619,7 @@ with pkgs; tcl = tcl-8_6; tcl-8_5 = callPackage ../development/interpreters/tcl/8.5.nix { }; tcl-8_6 = callPackage ../development/interpreters/tcl/8.6.nix { }; + tcl-9_0 = callPackage ../development/interpreters/tcl/9.0.nix { }; tclreadline = callPackage ../development/interpreters/tclreadline { };