mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-18 06:31:15 +00:00
tclPackages.expect: 5.45.4 -> 6.0a1
* Change src to maintained fork * Upstreamed some patches * Unbreaks build with Tcl 9
This commit is contained in:
@@ -1,295 +0,0 @@
|
||||
From: Andrew Ruder <andrew.ruder@elecsyscorp.com>
|
||||
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 <andrew.ruder@elecsyscorp.com>
|
||||
|
||||
--
|
||||
|
||||
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 <sys/wait.h>
|
||||
-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 <rtor@ansa.co.uk> 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 <sgtty.h>
|
||||
-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 <termio.h>
|
||||
- int
|
||||
- main()
|
||||
- {
|
||||
- struct termio tmp;
|
||||
- return 0;
|
||||
- }],
|
||||
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
+#include <termio.h>
|
||||
+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 <inttypes.h>
|
||||
-# endif
|
||||
-# include <termios.h>
|
||||
- int
|
||||
- main()
|
||||
- {
|
||||
- struct termios tmp;
|
||||
- return 0;
|
||||
- }],
|
||||
+#endif
|
||||
+#include <termios.h>
|
||||
+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 <inttypes.h>
|
||||
+# include <inttypes.h>
|
||||
#endif
|
||||
#include <termios.h>
|
||||
-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 <inttypes.h>
|
||||
+# include <inttypes.h>
|
||||
#endif
|
||||
#include <termios.h>
|
||||
-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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <sys/ioctl.h>
|
||||
#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 <pty.h> /* openpty */
|
||||
+/* openpty */
|
||||
+#if defined(__APPLE__)
|
||||
+# include <util.h>
|
||||
+#elif defined(__FreeBSD__)
|
||||
+# include <sys/types.h>
|
||||
+# include <sys/ioctl.h>
|
||||
+# include <termios.h>
|
||||
+# include <libutil.h>
|
||||
+#else /* pty.h is Linux-specific */
|
||||
+# include <pty.h>
|
||||
+#endif
|
||||
+
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user