1{ stdenv, lib, src, pkg-config, tcl, libXft, patches ? []
2, enableAqua ? stdenv.isDarwin, darwin
3, ... }:
4
5tcl.mkTclDerivation {
6 pname = "tk";
7 version = tcl.version;
8
9 inherit src patches;
10
11 outputs = [ "out" "man" "dev" ];
12
13 setOutputFlags = false;
14
15 preConfigure = ''
16 configureFlagsArray+=(--mandir=$man/share/man --enable-man-symlinks)
17 cd unix
18 '';
19
20 postPatch = ''
21 for file in $(find library/demos/. -type f ! -name "*.*"); do
22 substituteInPlace $file --replace "exec wish" "exec $out/bin/wish"
23 done
24 ''
25 + lib.optionalString (stdenv.isDarwin && lib.versionOlder stdenv.targetPlatform.darwinMinVersion "11") ''
26 substituteInPlace unix/configure* \
27 --replace " -framework UniformTypeIdentifiers" ""
28 '';
29
30 postInstall = ''
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}
34 ''
35 + lib.optionalString (stdenv.isDarwin) ''
36 cp ../macosx/*.h $out/include
37 '';
38
39 configureFlags = [
40 "--enable-threads"
41 ] ++ lib.optional stdenv.is64bit "--enable-64bit"
42 ++ lib.optional enableAqua "--enable-aqua";
43
44 nativeBuildInputs = [ pkg-config ];
45 buildInputs = [ ];
46
47 propagatedBuildInputs = [
48 libXft
49 ] ++ lib.optionals enableAqua ([
50 darwin.apple_sdk.frameworks.Cocoa
51 ] ++ lib.optionals (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") [
52 darwin.apple_sdk.frameworks.UniformTypeIdentifiers
53 ]);
54
55 enableParallelBuilding = true;
56
57 doCheck = false; # fails. can't find itself
58
59 inherit tcl;
60
61 passthru = rec {
62 inherit (tcl) release version;
63 libPrefix = "tk${tcl.release}";
64 libdir = "lib/${libPrefix}";
65 };
66
67 meta = with lib; {
68 description = "A widget toolkit that provides a library of basic elements for building a GUI in many different programming languages";
69 homepage = "https://www.tcl.tk/";
70 license = licenses.tcltk;
71 platforms = platforms.all;
72 maintainers = with maintainers; [ lovek323 vrthra ];
73 };
74}