From 291d0cdc27a226c72a1903b9e6482b4767f27361 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Fri, 27 Sep 2024 11:41:39 +0200 Subject: [PATCH] tk-9_0: init --- pkgs/development/libraries/tk/9.0.nix | 23 +++++++++++++++++++++ pkgs/development/libraries/tk/generic.nix | 25 ++++++++++++++++++++--- pkgs/top-level/all-packages.nix | 1 + 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/libraries/tk/9.0.nix diff --git a/pkgs/development/libraries/tk/9.0.nix b/pkgs/development/libraries/tk/9.0.nix new file mode 100644 index 000000000000..ff99ca8b4f63 --- /dev/null +++ b/pkgs/development/libraries/tk/9.0.nix @@ -0,0 +1,23 @@ +{ + callPackage, + fetchzip, + tcl, + ... +}@args: + +callPackage ./generic.nix ( + args + // { + + src = fetchzip { + url = "mirror://sourceforge/tcl/tk${tcl.version}-src.tar.gz"; + sha256 = "sha256-jQ9kZuFx6ikQ+SpY7kSbvXJ5hjw4WB9VgRaNlQLtG0s="; + }; + + patches = [ + # https://core.tcl-lang.org/tk/tktview/765642ffffffffffffff + ./tk-8_6_13-find-library.patch + ]; + + } +) diff --git a/pkgs/development/libraries/tk/generic.nix b/pkgs/development/libraries/tk/generic.nix index 8094ed169fa3..7a4b0a76d3b4 100644 --- a/pkgs/development/libraries/tk/generic.nix +++ b/pkgs/development/libraries/tk/generic.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, src, pkg-config, tcl, libXft, patches ? [] +{ stdenv, lib, src, pkg-config, tcl, libXft, zip, zlib, patches ? [] , enableAqua ? stdenv.hostPlatform.isDarwin, darwin , ... }: @@ -39,9 +39,26 @@ tcl.mkTclDerivation { configureFlags = [ "--enable-threads" ] ++ lib.optional stdenv.hostPlatform.is64bit "--enable-64bit" - ++ lib.optional enableAqua "--enable-aqua"; + ++ lib.optional enableAqua "--enable-aqua" + ++ lib.optional (lib.versionAtLeast tcl.version "9.0") + # By default, tk libraries get zipped and embedded into libtcl9tk*.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"; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ + pkg-config + ] ++ lib.optionals (lib.versionAtLeast tcl.version "9.0") [ + # Only used to detect the presence of zlib. Could be replaced with a stub. + zip + ]; + buildInputs = lib.optionals (lib.versionAtLeast tcl.version "9.0") [ + zlib + ]; propagatedBuildInputs = [ libXft @@ -69,5 +86,7 @@ tcl.mkTclDerivation { license = licenses.tcltk; platforms = platforms.all; maintainers = [ ]; + broken = stdenv.hostPlatform.isDarwin + && lib.elem (lib.versions.majorMinor tcl.version) ["8.5" "9.0"]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 26bab338401a..26cb83569c11 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23277,6 +23277,7 @@ with pkgs; tk = tk-8_6; + tk-9_0 = callPackage ../development/libraries/tk/9.0.nix { tcl = tcl-9_0; }; tk-8_6 = callPackage ../development/libraries/tk/8.6.nix { }; tk-8_5 = callPackage ../development/libraries/tk/8.5.nix { tcl = tcl-8_5; };