diff --git a/pkgs/development/tcl-modules/by-name/ex/expect/0004-enable-cross-compilation.patch b/pkgs/development/tcl-modules/by-name/ex/expect/0004-enable-cross-compilation.patch deleted file mode 100644 index c09623d292b2..000000000000 --- a/pkgs/development/tcl-modules/by-name/ex/expect/0004-enable-cross-compilation.patch +++ /dev/null @@ -1,295 +0,0 @@ -From: Andrew Ruder -Subject: [PATCH] enable cross compilation for expect - -This patch was created by running ./configure on a modern Linux machine -and inserting the results into the cross compilation section of -each AC_MSG_CHECKING that bombed out with an error. - -Signed-off-by: Andrew Ruder - --- - -The original patch, and description above, is originally from -https://github.com/buildroot/buildroot/blob/master/package/expect/0001-enable-cross-compilation.patch - -This patch has been further modified to not hard-code Linux assumptions. - ---- - -Index: expect-5.45/configure.in -=================================================================== ---- expect-5.45.orig/configure.in 2013-11-14 07:59:58.732100595 -0600 -+++ expect-5.45/configure.in 2013-11-14 07:59:58.732100595 -0600 -@@ -6,10 +6,12 @@ - AC_INIT([expect],[5.45.4]) - - TEA_INIT([3.9]) - - AC_CONFIG_AUX_DIR(tclconfig) -+ -+AC_LANG([C]) - - #-------------------------------------------------------------------- - # Configure script for package 'Expect'. - # TEA compliant. - #-------------------------------------------------------------------- -@@ -465,26 +467,20 @@ - # Some systems only define WNOHANG if _POSIX_SOURCE is defined - # The following merely tests that sys/wait.h can be included - # and if so that WNOHANG is not defined. The only place I've - # seen this is ISC. - AC_MSG_CHECKING([if WNOHANG requires _POSIX_SOURCE]) --AC_TRY_RUN([ -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ - #include --int --main() { - #ifndef WNOHANG -- return 0; --#else -- return 1; -+# error "WNOHANG requires _POSIX_SOURCE to be defined" - #endif --}], -+]])], - AC_MSG_RESULT(yes) - AC_DEFINE(WNOHANG_REQUIRES_POSIX_SOURCE) - , - AC_MSG_RESULT(no) --, -- AC_MSG_ERROR([Expect can't be cross compiled]) - ) - - AC_MSG_CHECKING([if any value exists for WNOHANG]) - rm -rf wnohang - AC_TRY_RUN([ -@@ -504,11 +501,12 @@ - rm -f wnohang - , - AC_MSG_RESULT(no) - AC_DEFINE(WNOHANG_BACKUP_VALUE, 1) - , -- AC_MSG_ERROR([Expect can't be cross compiled]) -+ AC_MSG_RESULT(yes) -+ AC_DEFINE(WNOHANG_BACKUP_VALUE, 1) - ) - - # - # check how signals work - # -@@ -572,11 +570,11 @@ - }], - AC_MSG_RESULT(yes) - AC_DEFINE(REARM_SIG) - , - AC_MSG_RESULT(no) --, AC_MSG_WARN([Expect can't be cross compiled]) -+, AC_MSG_RESULT(no) - ) - - # HPUX7 has trouble with the big cat so split it - # Owen Rees 29Mar93 - SEDDEFS="${SEDDEFS}CONFEOF -@@ -710,25 +708,19 @@ - AC_DEFINE(POSIX) - fi - - # first check for the pure bsd - AC_MSG_CHECKING([for struct sgttyb]) --AC_TRY_RUN([ -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ - #include --int --main() --{ -- struct sgttyb tmp; -- return 0; --}], -+static struct sgttyb tmp; -+]])], - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SGTTYB) - PTY_TYPE=sgttyb - , - AC_MSG_RESULT(no) --, -- AC_MSG_ERROR([Expect can't be cross compiled]) - ) - - # mach systems have include files for unimplemented features - # so avoid doing following test on those systems - if test $mach -eq 0 ; then -@@ -735,116 +728,88 @@ - # next check for the older style ttys - # note that if we detect termio.h (only), we still set PTY_TYPE=termios - # since that just controls which of pty_XXXX.c file is use and - # pty_termios.c is set up to handle pty_termio. - AC_MSG_CHECKING([for struct termio]) -- AC_TRY_RUN([#include -- int -- main() -- { -- struct termio tmp; -- return 0; -- }], -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ -+#include -+static struct termio tmp; -+]])], - AC_DEFINE(HAVE_TERMIO) - PTY_TYPE=termios - AC_MSG_RESULT(yes) - , - AC_MSG_RESULT(no) --, -- AC_MSG_ERROR([Expect can't be cross compiled]) - ) - - # now check for the new style ttys (not yet posix) - AC_MSG_CHECKING([for struct termios]) -- AC_TRY_RUN([ -- /* including termios.h on Solaris 5.6 fails unless inttypes.h included */ --# ifdef HAVE_INTTYPES_H -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ -+/* including termios.h on Solaris 5.6 fails unless inttypes.h included */ -+#ifdef HAVE_INTTYPES_H - # include --# endif --# include -- int -- main() -- { -- struct termios tmp; -- return 0; -- }], -+#endif -+#include -+static struct termios tmp; -+]])], - AC_DEFINE(HAVE_TERMIOS) - PTY_TYPE=termios - AC_MSG_RESULT(yes) - , - AC_MSG_RESULT(no) -- , -- AC_MSG_ERROR([Expect can't be cross compiled]) - ) - fi - - AC_MSG_CHECKING([if TCGETS or TCGETA in termios.h]) --AC_TRY_RUN([ -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ - /* including termios.h on Solaris 5.6 fails unless inttypes.h included */ - #ifdef HAVE_INTTYPES_H --#include -+# include - #endif - #include --int --main() { --#if defined(TCGETS) || defined(TCGETA) -- return 0; --#else -- return 1; -+# -+#if !(defined(TCGETS) || defined(TCGETA)) -+# error "missing both of TCGETS and TCGETA" - #endif --}], -+]])], - AC_DEFINE(HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H) - AC_MSG_RESULT(yes) - , - AC_MSG_RESULT(no) --, -- AC_MSG_ERROR([Expect can't be cross compiled]) - ) - - AC_MSG_CHECKING([if TIOCGWINSZ in termios.h]) --AC_TRY_RUN([ -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ - /* including termios.h on Solaris 5.6 fails unless inttypes.h included */ - #ifdef HAVE_INTTYPES_H --#include -+# include - #endif - #include --int --main() { --#ifdef TIOCGWINSZ -- return 0; --#else -- return 1; -+ -+#ifndef TIOCGWINSZ -+# error "missing TIOCGWINSZ" - #endif --}], -+]])], - AC_DEFINE(HAVE_TIOCGWINSZ_IN_TERMIOS_H) - AC_MSG_RESULT(yes) - , - AC_MSG_RESULT(no) --, -- AC_MSG_ERROR([Expect can't be cross compiled]) - ) - - # finally check for Cray style ttys - AC_MSG_CHECKING([for Cray-style ptys]) - SETUID=":" --AC_TRY_RUN([ --int --main(){ --#ifdef CRAY -- return 0; --#else -- return 1; -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ -+#ifndef CRAY -+# error "CRAY is not defined" - #endif --} --], -+]])], - PTY_TYPE=unicos - SETUID="chmod u+s" - AC_MSG_RESULT(yes) - , - AC_MSG_RESULT(no) --, -- AC_MSG_ERROR([Expect can't be cross compiled]) - ) - - # - # Check for select and/or poll. If both exist, we prefer select. - # if neither exists, define SIMPLE_EVENT. -@@ -873,26 +842,24 @@ - - # - # check for timezones - # - AC_MSG_CHECKING([for SV-style timezone]) --AC_TRY_RUN([ -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ - extern char *tzname[2]; - extern int daylight; - int - main() - { - int *x = &daylight; - char **y = tzname; - - return 0; --}], -+}]])], - AC_DEFINE(HAVE_SV_TIMEZONE) - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no) --, -- AC_MSG_ERROR([Expect can't be cross compiled]) - ) - - - # Following comment stolen from Tcl's configure.in: - # Note: in the following variable, it's important to use the absolute - diff --git a/pkgs/development/tcl-modules/by-name/ex/expect/fix-build-time-run-tcl.patch b/pkgs/development/tcl-modules/by-name/ex/expect/fix-build-time-run-tcl.patch index 8edc4bea39d6..213251101530 100644 --- a/pkgs/development/tcl-modules/by-name/ex/expect/fix-build-time-run-tcl.patch +++ b/pkgs/development/tcl-modules/by-name/ex/expect/fix-build-time-run-tcl.patch @@ -1,11 +1,13 @@ ---- a/Makefile.in 2022-09-07 21:46:37.090519258 +0200 -+++ b/Makefile.in 2022-09-07 21:46:21.462592279 +0200 -@@ -380,7 +380,7 @@ - cp $(DIST_ROOT)/$(PKG_DIR).tar.gz $(top_builddir) - - $(SCRIPTS): -- $(TCLSH) $(srcdir)/fixline1 $(SHORT_BINDIR) < $(srcdir)/example/$@ > $@ -+ @tcl@ $(srcdir)/fixline1 $(SHORT_BINDIR) < $(srcdir)/example/$@ > $@ - - ## We cannot use TCL_LIBS below (after TCL_LIB_SPEC) because its - ## expansion references the contents of LIBS, which contains linker +diff --git a/Makefile.in b/Makefile.in +index 36feb62..ac77b25 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -380,7 +380,7 @@ dist: dist-clean doc + cp $(DIST_ROOT)/$(PKG_DIR).tar.gz $(top_builddir) + + $(SCRIPTS): +- $(TCLSH) $(srcdir)/fixline1 $(SHORT_BINDIR) < $(srcdir)/example/$@ > $@ ++ @tcl@ $(srcdir)/fixline1 $(SHORT_BINDIR) < $(srcdir)/example/$@ > $@ + + ## We cannot use TCL_LIBS below (after TCL_LIB_SPEC) because its + ## expansion references the contents of LIBS, which contains linker diff --git a/pkgs/development/tcl-modules/by-name/ex/expect/fix-darwin-bsd-clang16.patch b/pkgs/development/tcl-modules/by-name/ex/expect/fix-darwin-bsd-clang16.patch deleted file mode 100644 index a0e11a5f9d6b..000000000000 --- a/pkgs/development/tcl-modules/by-name/ex/expect/fix-darwin-bsd-clang16.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -ur a/exp_win.c b/exp_win.c ---- a/exp_win.c 2018-02-02 14:15:52.000000000 -0500 -+++ b/exp_win.c 2023-10-10 07:47:33.082690432 -0400 -@@ -39,7 +39,8 @@ - /* Sigh. On AIX 2.3, termios.h exists but does not define TIOCGWINSZ */ - /* Instead, it has to come from ioctl.h. However, As I said above, this */ - /* can't be cavalierly included on all machines, even when it exists. */ --#if defined(HAVE_TERMIOS) && !defined(HAVE_TIOCGWINSZ_IN_TERMIOS_H) -+/* Darwin also has termios.h, but it requires ioctl.h for `ioctl`. */ -+#if defined(HAVE_TERMIOS) && (defined(__APPLE__) || !defined(HAVE_TIOCGWINSZ_IN_TERMIOS_H)) - # include - #endif - -diff -ur d/pty_termios.c c/pty_termios.c ---- d/pty_termios.c 2023-10-10 07:59:23.244452442 -0400 -+++ c/pty_termios.c 2023-10-10 08:00:35.303231582 -0400 -@@ -7,7 +7,18 @@ - - */ - --#include /* openpty */ -+/* openpty */ -+#if defined(__APPLE__) -+# include -+#elif defined(__FreeBSD__) -+# include -+# include -+# include -+# include -+#else /* pty.h is Linux-specific */ -+# include -+#endif -+ - #include - #include - diff --git a/pkgs/development/tcl-modules/by-name/ex/expect/package.nix b/pkgs/development/tcl-modules/by-name/ex/expect/package.nix index 8e4b2b0caa54..ca7fb72b9739 100644 --- a/pkgs/development/tcl-modules/by-name/ex/expect/package.nix +++ b/pkgs/development/tcl-modules/by-name/ex/expect/package.nix @@ -2,40 +2,28 @@ lib, stdenv, buildPackages, - fetchurl, + fetchFromGitHub, tcl, makeWrapper, autoreconfHook, - fetchpatch, replaceVars, }: -tcl.mkTclDerivation rec { +tcl.mkTclDerivation (finalAttrs: { pname = "expect"; - version = "5.45.4"; + version = "6.0a1"; - src = fetchurl { - url = "mirror://sourceforge/expect/Expect/${version}/expect${version}.tar.gz"; - hash = "sha256-Safag7C92fRtBKBN7sGcd2e7mjI+QMR4H4nK92C5LDQ="; + src = fetchFromGitHub { + owner = "tcltk-depot"; + repo = "expect"; + tag = "v${finalAttrs.version}"; + hash = "sha256-RDWI4cH7X+N9axm31e1ACFUvTYfQ2r/sfNxWkZrYDJo="; }; patches = [ (replaceVars ./fix-build-time-run-tcl.patch { tcl = "${buildPackages.tcl}/bin/tclsh"; }) - # 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="; - }) - ./0004-enable-cross-compilation.patch - # Include `sys/ioctl.h` and `util.h` on Darwin, which are required for `ioctl` and `openpty`. - # 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 ]; @@ -49,24 +37,17 @@ tcl.mkTclDerivation rec { makeWrapper ]; + __structuredAttrs = true; + strictDeps = true; - env = { - NIX_CFLAGS_COMPILE = toString ( - # Needed to avoid errors when building with GCC 15. - lib.optionals stdenv.cc.isGNU [ "-Wno-error=incompatible-pointer-types" ] - # Autoconf 2.73 defaults to C23, but Expect uses K&R style function declarations. - ++ [ "-std=gnu17" ] - ); - }; - - hardeningDisable = [ "format" ]; - postInstall = '' tclWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ tcl ]}) - ${lib.optionalString stdenv.hostPlatform.isDarwin "tclWrapperArgs+=(--prefix DYLD_LIBRARY_PATH : $out/lib/expect${version})"} + ${lib.optionalString stdenv.hostPlatform.isDarwin "tclWrapperArgs+=(--prefix DYLD_LIBRARY_PATH : $out/lib/expect${finalAttrs.version})"} ''; + doCheck = true; + installCheckTarget = "test"; tclRequiresCheck = [ "Expect" ]; outputs = [ @@ -81,6 +62,5 @@ tcl.mkTclDerivation rec { platforms = lib.platforms.unix; mainProgram = "expect"; maintainers = with lib.maintainers; [ SuperSandro2000 ]; - broken = tcl.isTcl9; }; -} +})