Merge pull request #243838 from akho/fix-243831

tcl: fix #243831
This commit is contained in:
Theodore Ni 2023-08-17 15:16:18 -07:00 committed by GitHub
commit f2cdd1c318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
{ lib, stdenv, callPackage, makeSetupHook
{ lib, stdenv, callPackage, makeSetupHook, runCommand
, tzdata
# Version specific stuff
, release, version, src
@ -7,7 +8,7 @@
let
baseInterp =
stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "tcl";
inherit version src;
@ -15,6 +16,14 @@ let
setOutputFlags = false;
postPatch = ''
substituteInPlace library/clock.tcl \
--replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" \
--replace "/usr/share/lib/zoneinfo" "" \
--replace "/usr/lib/zoneinfo" "" \
--replace "/usr/local/etc/zoneinfo" ""
'';
preConfigure = ''
cd unix
'';
@ -55,6 +64,12 @@ let
name = "tcl-package-hook";
propagatedBuildInputs = [ buildPackages.makeWrapper ];
} ./tcl-package-hook.sh) {};
# verify that Tcl's clock library can access tzdata
tests.tzdata = runCommand "${pname}-test-tzdata" {} ''
${baseInterp}/bin/tclsh <(echo "set t [clock scan {2004-10-30 05:00:00} \
-format {%Y-%m-%d %H:%M:%S} \
-timezone :America/New_York]") > $out
'';
};
};