From 62fd83e4fe0ed20c7228a06acc880dc5a8d39224 Mon Sep 17 00:00:00 2001 From: Sam James Date: Wed, 23 Nov 2022 00:24:10 +0000 Subject: dev-tcltk/tclreadline: fix configure w/ clang 16 Signed-off-by: Sam James --- .../tclreadline-2.3.8-configure-clang16.patch | 67 ++++++++++++++++++++++ dev-tcltk/tclreadline/tclreadline-2.3.8-r1.ebuild | 42 -------------- dev-tcltk/tclreadline/tclreadline-2.3.8-r2.ebuild | 53 +++++++++++++++++ 3 files changed, 120 insertions(+), 42 deletions(-) create mode 100644 dev-tcltk/tclreadline/files/tclreadline-2.3.8-configure-clang16.patch delete mode 100644 dev-tcltk/tclreadline/tclreadline-2.3.8-r1.ebuild create mode 100644 dev-tcltk/tclreadline/tclreadline-2.3.8-r2.ebuild (limited to 'dev-tcltk/tclreadline') diff --git a/dev-tcltk/tclreadline/files/tclreadline-2.3.8-configure-clang16.patch b/dev-tcltk/tclreadline/files/tclreadline-2.3.8-configure-clang16.patch new file mode 100644 index 000000000000..1454cf54f698 --- /dev/null +++ b/dev-tcltk/tclreadline/files/tclreadline-2.3.8-configure-clang16.patch @@ -0,0 +1,67 @@ +https://github.com/flightaware/tclreadline/pull/46 + +From 8c75e01b814ac852167611f5edae9659a1f709d2 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Wed, 23 Nov 2022 00:19:55 +0000 +Subject: [PATCH 1/2] Fix configure.ac compatibility with Clang 16 + +Clang 16 makes -Wimplicit-function-declaration and -Wimplicit-int errors by default. + +Unfortunately, this can lead to misconfiguration or miscompilation of software as configure +tests may then return the wrong result. + +We also fix -Wstrict-prototypes while here as it's easy to do and it prepares +us for C23. + +For more information, see LWN.net [0] or LLVM's Discourse [1], the Gentoo wiki [2], +or the (new) c-std-porting mailing list [3]. + +[0] https://lwn.net/Articles/913505/ +[1] https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213 +[2] https://wiki.gentoo.org/wiki/Modern_C_porting +[3] hosted at lists.linux.dev. + +Signed-off-by: Sam James +--- a/configure.ac ++++ b/configure.ac +@@ -245,7 +245,8 @@ AC_TRY_LINK(,[ + AC_MSG_CHECKING([for the readline version number]) + AC_TRY_RUN([ + #include +-int main () { ++#include ++int main (void) { + FILE *fp = fopen("conftestversion", "w"); + extern char *rl_library_version; + fprintf(fp, "%s", rl_library_version); + +From b64772750c7543fe66165fd7862b355d289412b6 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Wed, 23 Nov 2022 00:21:34 +0000 +Subject: [PATCH 2/2] Fix -Wint-conversion in readline configure test + +Fixes the following warning with Clang 16: +``` +configure:12873: clang-16 -o conftest -g -O2 conftest.c -lreadline >&5 +conftest.c:33:11: error: incompatible pointer to integer conversion passing 'FILE *' (aka 'struct _IO_FILE *') to parameter of type 'int' [-Wint-conversion] + close(fp); + ^~ +/usr/include/unistd.h:358:23: note: passing argument to parameter '__fd' here +extern int close (int __fd); +``` + +fopen should be paired with fclose. + +Signed-off-by: Sam James +--- a/configure.ac ++++ b/configure.ac +@@ -250,7 +250,7 @@ int main (void) { + FILE *fp = fopen("conftestversion", "w"); + extern char *rl_library_version; + fprintf(fp, "%s", rl_library_version); +- close(fp); ++ fclose(fp); + return 0; + }], + READLINE_VERSION=`cat conftestversion` + diff --git a/dev-tcltk/tclreadline/tclreadline-2.3.8-r1.ebuild b/dev-tcltk/tclreadline/tclreadline-2.3.8-r1.ebuild deleted file mode 100644 index ff8d8154a93b..000000000000 --- a/dev-tcltk/tclreadline/tclreadline-2.3.8-r1.ebuild +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2020-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DESCRIPTION="Readline extension to TCL" -HOMEPAGE="https://github.com/flightaware/tclreadline" -SRC_URI="https://github.com/flightaware/tclreadline/archive/v${PV}.tar.gz - -> ${P}.tar.gz" - -LICENSE="BSD" -SLOT="0" -KEYWORDS="~alpha amd64 ppc ~sparc x86 ~amd64-linux ~x86-linux" -IUSE="tk" - -DEPEND="dev-lang/tcl:0= - sys-libs/readline:0= - tk? ( dev-lang/tk:0= )" -RDEPEND="${DEPEND}" -BDEPEND="" - -src_prepare() { - default - sed -i \ - -e "s|^\(TCLRL_LIBDIR\)=.*|\1=\"${EPREFIX}/usr/$(get_libdir)\"|" \ - configure || die -} - -src_configure() { - local myConf=( - --with-tcl="${EPREFIX}/usr/$(get_libdir)" - --with-readline-includes="${EPREFIX}/usr/include/readline" - ) - if ! use tk; then - myConf+=(--without-tk) - fi - econf "${myConf[@]}" -} -src_install() { - default - find "${ED}" -name \*.la -delete -} diff --git a/dev-tcltk/tclreadline/tclreadline-2.3.8-r2.ebuild b/dev-tcltk/tclreadline/tclreadline-2.3.8-r2.ebuild new file mode 100644 index 000000000000..f19d330e2688 --- /dev/null +++ b/dev-tcltk/tclreadline/tclreadline-2.3.8-r2.ebuild @@ -0,0 +1,53 @@ +# Copyright 2020-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools + +DESCRIPTION="Readline extension to TCL" +HOMEPAGE="https://github.com/flightaware/tclreadline" +SRC_URI="https://github.com/flightaware/tclreadline/archive/v${PV}.tar.gz + -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha amd64 ppc ~sparc x86 ~amd64-linux ~x86-linux" +IUSE="tk" + +DEPEND=" + dev-lang/tcl:= + sys-libs/readline:= + tk? ( dev-lang/tk:= ) +" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${PN}-2.3.8-configure-clang16.patch +) + +src_prepare() { + default + + # Needed for Clang 16 patch, can drop once in a release + eautoreconf + + sed -i \ + -e "s|^\(TCLRL_LIBDIR\)=.*|\1=\"${EPREFIX}/usr/$(get_libdir)\"|" \ + configure || die +} + +src_configure() { + local myConf=( + --with-tcl="${EPREFIX}/usr/$(get_libdir)" + --with-readline-includes="${EPREFIX}/usr/include/readline" + ) + if ! use tk; then + myConf+=(--without-tk) + fi + econf "${myConf[@]}" +} +src_install() { + default + find "${ED}" -name \*.la -delete +} -- cgit v1.2.3-65-gdbad