2024-05-02 00:46:19 +00:00
|
|
|
# Generic builder for tcl packages/applications, generally based on mk-python-derivation.nix
|
2024-05-13 21:24:10 +00:00
|
|
|
{ tcl, lib, makeWrapper, runCommand, writeScript }:
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
{ buildInputs ? [ ], nativeBuildInputs ? [ ], propagatedBuildInputs ? [ ]
|
|
|
|
, checkInputs ? [ ], nativeCheckInputs ? [ ]
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
# true if we should skip the configuration phase altogether
|
2024-05-02 00:46:19 +00:00
|
|
|
, dontConfigure ? false
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
# Extra flags passed to configure step
|
|
|
|
, configureFlags ? [ ]
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
# Whether or not we should add common Tcl-related configure flags
|
2024-05-02 00:46:19 +00:00
|
|
|
, addTclConfigureFlags ? true
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
, meta ? { }, passthru ? { }, doCheck ? true, ... }@attrs:
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (tcl) stdenv;
|
|
|
|
inherit (lib) getBin optionalAttrs;
|
|
|
|
|
|
|
|
defaultTclPkgConfigureFlags = [
|
|
|
|
"--with-tcl=${tcl}/lib"
|
|
|
|
"--with-tclinclude=${tcl}/include"
|
|
|
|
"--exec-prefix=${placeholder "out"}"
|
|
|
|
];
|
|
|
|
|
|
|
|
self = (stdenv.mkDerivation ((builtins.removeAttrs attrs [
|
2024-05-13 21:24:10 +00:00
|
|
|
"addTclConfigureFlags"
|
|
|
|
"checkPhase"
|
|
|
|
"checkInputs"
|
|
|
|
"nativeCheckInputs"
|
|
|
|
"doCheck"
|
2024-05-02 00:46:19 +00:00
|
|
|
]) // {
|
|
|
|
|
|
|
|
buildInputs = buildInputs ++ [ tcl.tclPackageHook ];
|
|
|
|
nativeBuildInputs = nativeBuildInputs ++ [ makeWrapper tcl ];
|
|
|
|
propagatedBuildInputs = propagatedBuildInputs ++ [ tcl ];
|
|
|
|
|
|
|
|
TCLSH = "${getBin tcl}/bin/tclsh";
|
|
|
|
|
|
|
|
# Run tests after install, at which point we've done all TCLLIBPATH setup
|
|
|
|
doCheck = false;
|
|
|
|
doInstallCheck = attrs.doCheck or (attrs.doInstallCheck or false);
|
2024-05-13 21:24:10 +00:00
|
|
|
installCheckInputs = checkInputs ++ (attrs.installCheckInputs or [ ]);
|
|
|
|
nativeInstallCheckInputs = nativeCheckInputs
|
|
|
|
++ (attrs.nativeInstallCheckInputs or [ ]);
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
# Add typical values expected by TEA for configureFlags
|
2024-05-13 21:24:10 +00:00
|
|
|
configureFlags = if (!dontConfigure && addTclConfigureFlags) then
|
|
|
|
(configureFlags ++ defaultTclPkgConfigureFlags)
|
|
|
|
else
|
|
|
|
configureFlags;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
meta = { platforms = tcl.meta.platforms; } // meta;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
} // optionalAttrs (attrs ? checkPhase) {
|
2024-05-02 00:46:19 +00:00
|
|
|
installCheckPhase = attrs.checkPhase;
|
2024-05-13 21:24:10 +00:00
|
|
|
}));
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
in lib.extendDerivation true passthru self
|