1 { stdenv, lib, src, pkg-config, tcl, libXft, zip, zlib, patches ? []
2 , enableAqua ? stdenv.hostPlatform.isDarwin, darwin
11 outputs = [ "out" "man" "dev" ];
13 setOutputFlags = false;
16 configureFlagsArray+=(--mandir=$man/share/man --enable-man-symlinks)
21 for file in $(find library/demos/. -type f ! -name "*.*"); do
22 substituteInPlace $file --replace "exec wish" "exec $out/bin/wish"
25 + lib.optionalString (stdenv.hostPlatform.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "11") ''
26 substituteInPlace unix/configure* \
27 --replace " -framework UniformTypeIdentifiers" ""
31 ln -s $out/bin/wish* $out/bin/wish
32 cp ../{unix,generic}/*.h $out/include
33 ln -s $out/lib/libtk${tcl.release}${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libtk${stdenv.hostPlatform.extensions.sharedLibrary}
35 + lib.optionalString (stdenv.hostPlatform.isDarwin) ''
36 cp ../macosx/*.h $out/include
41 ] ++ lib.optional stdenv.hostPlatform.is64bit "--enable-64bit"
42 ++ lib.optional enableAqua "--enable-aqua"
43 ++ lib.optional (lib.versionAtLeast tcl.version "9.0")
44 # By default, tk libraries get zipped and embedded into libtcl9tk*.so,
45 # which gets `zipfs mount`ed at runtime. This is fragile (for example
46 # stripping the .so removes the zip trailer), so we install them as
48 # This might make tcl slower to start from slower storage on cold cache,
49 # however according to my benchmarks on fast storage and warm cache
50 # tcl built with --disable-zipfs actually starts in half the time.
55 ] ++ lib.optionals (lib.versionAtLeast tcl.version "9.0") [
56 # Only used to detect the presence of zlib. Could be replaced with a stub.
59 buildInputs = lib.optionals (lib.versionAtLeast tcl.version "9.0") [
63 propagatedBuildInputs = [
65 ] ++ lib.optionals enableAqua ([
66 darwin.apple_sdk.frameworks.Cocoa
67 ] ++ lib.optionals (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") [
68 darwin.apple_sdk.frameworks.UniformTypeIdentifiers
71 enableParallelBuilding = true;
73 doCheck = false; # fails. can't find itself
78 inherit (tcl) release version;
79 libPrefix = "tk${tcl.release}";
80 libdir = "lib/${libPrefix}";
84 description = "Widget toolkit that provides a library of basic elements for building a GUI in many different programming languages";
85 homepage = "https://www.tcl.tk/";
86 license = licenses.tcltk;
87 platforms = platforms.all;
89 broken = stdenv.hostPlatform.isDarwin
90 && lib.elem (lib.versions.majorMinor tcl.version) ["8.5" "9.0"];