2022-10-21 18:38:19 +00:00
|
|
|
{ lib, stdenv, buildPackages, fetchurl, tcl, makeWrapper, autoreconfHook, fetchpatch, substituteAll }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
tcl.mkTclDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "expect";
|
2021-02-13 14:23:35 +00:00
|
|
|
version = "5.45.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/expect/Expect/${version}/expect${version}.tar.gz";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-Safag7C92fRtBKBN7sGcd2e7mjI+QMR4H4nK92C5LDQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/buildroot/buildroot/c05e6aa361a4049eabd8b21eb64a34899ef83fc7/package/expect/0001-enable-cross-compilation.patch";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-yyzE0Jjac5qaj7Svn4VpMiAqSNLYrw7VZbtFqgMVncs=";
|
2021-03-09 03:18:52 +00:00
|
|
|
})
|
2022-10-21 18:38:19 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-cross-compilation.patch;
|
|
|
|
tcl = "${buildPackages.tcl}/bin/tclsh";
|
|
|
|
})
|
2023-11-16 04:20:00 +00:00
|
|
|
# The following patches fix compilation with clang 15+
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://sourceforge.net/p/expect/patches/24/attachment/0001-Add-prototype-to-function-definitions.patch";
|
|
|
|
hash = "sha256-X2Vv6VVM3KjmBHo2ukVWe5YTVXRmqe//Kw2kr73OpZs=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://sourceforge.net/p/expect/patches/_discuss/thread/b813ca9895/6759/attachment/expect-configure-c99.patch";
|
|
|
|
hash = "sha256-PxQQ9roWgVXUoCMxkXEgu+it26ES/JuzHF6oML/nk54=";
|
|
|
|
})
|
|
|
|
# Include `sys/ioctl.h` and `util.h` on Darwin, which are required for `ioctl` and `openpty`.
|
|
|
|
./fix-darwin-clang16.patch
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i "s,/bin/stty,$(type -p stty),g" configure.in
|
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook makeWrapper ];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
postInstall = ''
|
|
|
|
tclWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ tcl ]})
|
|
|
|
${lib.optionalString stdenv.isDarwin "tclWrapperArgs+=(--prefix DYLD_LIBRARY_PATH : $out/lib/expect${version})"}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A tool for automating interactive applications";
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://expect.sourceforge.net/";
|
2021-02-13 14:23:35 +00:00
|
|
|
license = licenses.publicDomain;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
2023-10-09 19:29:22 +00:00
|
|
|
mainProgram = "expect";
|
2021-02-13 14:23:35 +00:00
|
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|