nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 78 lines 2.2 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPackages, 5 fetchurl, 6 tcl, 7 makeWrapper, 8 autoreconfHook, 9 fetchpatch, 10 replaceVars, 11}: 12 13tcl.mkTclDerivation rec { 14 pname = "expect"; 15 version = "5.45.4"; 16 17 src = fetchurl { 18 url = "mirror://sourceforge/expect/Expect/${version}/expect${version}.tar.gz"; 19 hash = "sha256-Safag7C92fRtBKBN7sGcd2e7mjI+QMR4H4nK92C5LDQ="; 20 }; 21 22 patches = [ 23 (replaceVars ./fix-build-time-run-tcl.patch { 24 tcl = "${buildPackages.tcl}/bin/tclsh"; 25 }) 26 # The following patches fix compilation with clang 15+ 27 (fetchpatch { 28 url = "https://sourceforge.net/p/expect/patches/24/attachment/0001-Add-prototype-to-function-definitions.patch"; 29 hash = "sha256-X2Vv6VVM3KjmBHo2ukVWe5YTVXRmqe//Kw2kr73OpZs="; 30 }) 31 (fetchpatch { 32 url = "https://sourceforge.net/p/expect/patches/_discuss/thread/b813ca9895/6759/attachment/expect-configure-c99.patch"; 33 hash = "sha256-PxQQ9roWgVXUoCMxkXEgu+it26ES/JuzHF6oML/nk54="; 34 }) 35 ./0004-enable-cross-compilation.patch 36 # Include `sys/ioctl.h` and `util.h` on Darwin, which are required for `ioctl` and `openpty`. 37 # Include `termios.h` on FreeBSD for `openpty` 38 ./fix-darwin-bsd-clang16.patch 39 # Remove some code which causes it to link against a file that does not exist at build time on native FreeBSD 40 ./freebsd-unversioned.patch 41 ]; 42 43 postPatch = '' 44 sed -i "s,/bin/stty,$(type -p stty),g" configure.in 45 ''; 46 47 nativeBuildInputs = [ 48 autoreconfHook 49 makeWrapper 50 ]; 51 52 strictDeps = true; 53 54 env = lib.optionalAttrs stdenv.cc.isGNU { 55 NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; 56 }; 57 58 hardeningDisable = [ "format" ]; 59 60 postInstall = '' 61 tclWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ tcl ]}) 62 ${lib.optionalString stdenv.hostPlatform.isDarwin "tclWrapperArgs+=(--prefix DYLD_LIBRARY_PATH : $out/lib/expect${version})"} 63 ''; 64 65 outputs = [ 66 "out" 67 "dev" 68 ]; 69 70 meta = with lib; { 71 description = "Tool for automating interactive applications"; 72 homepage = "https://expect.sourceforge.net/"; 73 license = licenses.publicDomain; 74 platforms = platforms.unix; 75 mainProgram = "expect"; 76 maintainers = with maintainers; [ SuperSandro2000 ]; 77 }; 78}