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 = [
|
2022-10-21 18:38:19 +00:00
|
|
|
(substituteAll {
|
2024-07-27 06:49:29 +00:00
|
|
|
src = ./fix-build-time-run-tcl.patch;
|
2022-10-21 18:38:19 +00:00
|
|
|
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=";
|
|
|
|
})
|
2024-07-27 06:49:29 +00:00
|
|
|
./0004-enable-cross-compilation.patch
|
2023-11-16 04:20:00 +00:00
|
|
|
# Include `sys/ioctl.h` and `util.h` on Darwin, which are required for `ioctl` and `openpty`.
|
2024-07-27 06:49:29 +00:00
|
|
|
# Include `termios.h` on FreeBSD for `openpty`
|
|
|
|
./fix-darwin-bsd-clang16.patch
|
|
|
|
# Remove some code which causes it to link against a file that does not exist at build time on native FreeBSD
|
|
|
|
./freebsd-unversioned.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 ]})
|
2024-09-26 11:04:55 +00:00
|
|
|
${lib.optionalString stdenv.hostPlatform.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; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "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
|
|
|
};
|
|
|
|
}
|