2023-10-09 19:29:22 +00:00
|
|
|
{ lib, stdenv, callPackage, makeSetupHook, runCommand
|
|
|
|
, tzdata
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Version specific stuff
|
|
|
|
, release, version, src
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
let
|
|
|
|
baseInterp =
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-06-28 23:13:55 +00:00
|
|
|
pname = "tcl";
|
|
|
|
inherit version src;
|
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
|
|
|
setOutputFlags = false;
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
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" ""
|
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
preConfigure = ''
|
|
|
|
cd unix
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-threads"
|
|
|
|
# Note: using $out instead of $man to prevent a runtime dependency on $man.
|
|
|
|
"--mandir=${placeholder "out"}/share/man"
|
|
|
|
"--enable-man-symlinks"
|
|
|
|
# Don't install tzdata because NixOS already has a more up-to-date copy.
|
|
|
|
"--with-tzdata=no"
|
|
|
|
"tcl_cv_strtod_unbroken=ok"
|
|
|
|
] ++ lib.optional stdenv.is64bit "--enable-64bit";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
postInstall = let
|
|
|
|
dllExtension = stdenv.hostPlatform.extensions.sharedLibrary;
|
|
|
|
in ''
|
|
|
|
make install-private-headers
|
|
|
|
ln -s $out/bin/tclsh${release} $out/bin/tclsh
|
|
|
|
ln -s $out/lib/libtcl${release}${dllExtension} $out/lib/libtcl${dllExtension}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "The Tcl scripting language";
|
|
|
|
homepage = "https://www.tcl.tk/";
|
|
|
|
license = licenses.tcltk;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ agbrooks ];
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru = rec {
|
|
|
|
inherit release version;
|
|
|
|
libPrefix = "tcl${release}";
|
|
|
|
libdir = "lib/${libPrefix}";
|
2021-09-26 12:46:18 +00:00
|
|
|
tclPackageHook = callPackage ({ buildPackages }: makeSetupHook {
|
2021-06-28 23:13:55 +00:00
|
|
|
name = "tcl-package-hook";
|
2023-03-04 12:14:45 +00:00
|
|
|
propagatedBuildInputs = [ buildPackages.makeWrapper ];
|
2021-06-28 23:13:55 +00:00
|
|
|
} ./tcl-package-hook.sh) {};
|
2023-10-09 19:29:22 +00:00
|
|
|
# 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
|
|
|
|
'';
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
mkTclDerivation = callPackage ./mk-tcl-derivation.nix { tcl = baseInterp; };
|
|
|
|
|
|
|
|
in baseInterp.overrideAttrs (self: {
|
|
|
|
passthru = self.passthru // {
|
|
|
|
inherit mkTclDerivation;
|
|
|
|
};
|
|
|
|
})
|