Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 103 lines 2.7 kB view raw
1{ 2 stdenv, 3 lib, 4 src, 5 pkg-config, 6 tcl, 7 libXft, 8 zip, 9 zlib, 10 patches ? [ ], 11 enableAqua ? stdenv.hostPlatform.isDarwin, 12 ... 13}: 14 15tcl.mkTclDerivation { 16 pname = "tk"; 17 version = tcl.version; 18 19 inherit src patches; 20 21 outputs = [ 22 "out" 23 "man" 24 "dev" 25 ]; 26 27 setOutputFlags = false; 28 29 preConfigure = '' 30 configureFlagsArray+=(--mandir=$man/share/man --enable-man-symlinks) 31 cd unix 32 ''; 33 34 postPatch = '' 35 for file in $(find library/demos/. -type f ! -name "*.*"); do 36 substituteInPlace $file --replace "exec wish" "exec $out/bin/wish" 37 done 38 ''; 39 40 postInstall = 41 '' 42 ln -s $out/bin/wish* $out/bin/wish 43 cp ../{unix,generic}/*.h $out/include 44 ln -s $out/lib/libtk${tcl.release}${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libtk${stdenv.hostPlatform.extensions.sharedLibrary} 45 '' 46 + lib.optionalString (stdenv.hostPlatform.isDarwin) '' 47 cp ../macosx/*.h $out/include 48 ''; 49 50 configureFlags = 51 [ 52 "--enable-threads" 53 ] 54 ++ lib.optional stdenv.hostPlatform.is64bit "--enable-64bit" 55 ++ lib.optional enableAqua "--enable-aqua" 56 ++ 57 lib.optional (lib.versionAtLeast tcl.version "9.0") 58 # By default, tk libraries get zipped and embedded into libtcl9tk*.so, 59 # which gets `zipfs mount`ed at runtime. This is fragile (for example 60 # stripping the .so removes the zip trailer), so we install them as 61 # traditional files. 62 # This might make tcl slower to start from slower storage on cold cache, 63 # however according to my benchmarks on fast storage and warm cache 64 # tcl built with --disable-zipfs actually starts in half the time. 65 "--disable-zipfs"; 66 67 nativeBuildInputs = 68 [ 69 pkg-config 70 ] 71 ++ lib.optionals (lib.versionAtLeast tcl.version "9.0") [ 72 # Only used to detect the presence of zlib. Could be replaced with a stub. 73 zip 74 ]; 75 buildInputs = lib.optionals (lib.versionAtLeast tcl.version "9.0") [ 76 zlib 77 ]; 78 79 propagatedBuildInputs = [ 80 libXft 81 ]; 82 83 enableParallelBuilding = true; 84 85 doCheck = false; # fails. can't find itself 86 87 inherit tcl; 88 89 passthru = rec { 90 inherit (tcl) release version; 91 libPrefix = "tk${tcl.release}"; 92 libdir = "lib/${libPrefix}"; 93 }; 94 95 meta = with lib; { 96 description = "Widget toolkit that provides a library of basic elements for building a GUI in many different programming languages"; 97 homepage = "https://www.tcl.tk/"; 98 license = licenses.tcltk; 99 platforms = platforms.all; 100 maintainers = [ ]; 101 broken = stdenv.hostPlatform.isDarwin && lib.elem (lib.versions.majorMinor tcl.version) [ "8.5" ]; 102 }; 103}