commit:     c9dbd4fa234c88d579afd19236b3bc999ed36b53
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 16 23:54:05 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 16 23:54:19 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9dbd4fa

net-misc/cadaver: fix quoting w/ autoconf-2.72, respect CFLAGS during link

See https://github.com/gentoo/gentoo/pull/36274#issuecomment-2058032256.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-misc/cadaver/cadaver-0.24.ebuild               |  2 +
 .../cadaver/files/cadaver-0.24-autoconf-2.72.patch | 63 ++++++++++++++++++++++
 .../cadaver/files/cadaver-0.24-link-cflags.patch   | 24 +++++++++
 3 files changed, 89 insertions(+)

diff --git a/net-misc/cadaver/cadaver-0.24.ebuild 
b/net-misc/cadaver/cadaver-0.24.ebuild
index 2b63e89112aa..b9220d4366d2 100644
--- a/net-misc/cadaver/cadaver-0.24.ebuild
+++ b/net-misc/cadaver/cadaver-0.24.ebuild
@@ -23,6 +23,8 @@ DOCS=( BUGS ChangeLog FAQ NEWS README.md THANKS TODO )
 PATCHES=(
        "${FILESDIR}"/${PN}-0.23.2-disable-nls.patch
        "${FILESDIR}"/${PN}-0.24-neon-0.33.patch
+       "${FILESDIR}"/${PN}-0.24-autoconf-2.72.patch
+       "${FILESDIR}"/${PN}-0.24-link-cflags.patch
 )
 
 src_prepare() {

diff --git a/net-misc/cadaver/files/cadaver-0.24-autoconf-2.72.patch 
b/net-misc/cadaver/files/cadaver-0.24-autoconf-2.72.patch
new file mode 100644
index 000000000000..addf7f0345a9
--- /dev/null
+++ b/net-misc/cadaver/files/cadaver-0.24-autoconf-2.72.patch
@@ -0,0 +1,63 @@
+https://github.com/notroj/cadaver/pull/42
+
+From 4f2ab67be45132ffdd9765d47b8457ca986b6fe3 Mon Sep 17 00:00:00 2001
+From: Sam James <s...@gentoo.org>
+Date: Wed, 17 Apr 2024 00:48:11 +0100
+Subject: [PATCH] m4: fix quoting in readline.m4
+
+Without this, with autoconf-2.72 at least, we get:
+```
+$ ./configure
+[...]
+checking for pkg-config... /usr/sbin/pkg-config
+checking pkg-config is at least version 0.9.0... yes
+checking for tputs in -lcurses... ./configure: 5319: ac_fn_c_try_link: not 
found
+no
+checking for tputs in -lncurses... no
+[...]
+```
+---
+ m4/readline.m4 | 25 +++++++++++--------------
+ 1 file changed, 11 insertions(+), 14 deletions(-)
+
+diff --git a/m4/readline.m4 b/m4/readline.m4
+index c0ab8af..9d650b9 100644
+--- a/m4/readline.m4
++++ b/m4/readline.m4
+@@ -9,24 +9,21 @@ AC_ARG_ENABLE(readline,
+       [use_readline=$enableval],
+       [use_readline=yes])  dnl Defaults to ON (if found)
+ 
+-if test "$use_readline" = "yes"; then
+-      AC_CHECK_LIB(curses, tputs, LIBS="$LIBS -lcurses",
+-              AC_CHECK_LIB(ncurses, tputs))
+-      AC_CHECK_LIB(readline, readline)
++AS_IF([test "$use_readline" = "yes"], [
++      AC_CHECK_LIB([curses], [tputs], [LIBS="$LIBS -lcurses"],
++              [AC_CHECK_LIB(ncurses, tputs)])
++      AC_CHECK_LIB([readline], [readline])
+ 
+-      AC_SEARCH_LIBS(add_history, history,
+-              AC_DEFINE(HAVE_ADD_HISTORY, 1, [Define if you have the 
add_history function])
++      AC_SEARCH_LIBS([add_history], [history],
++              AC_DEFINE([HAVE_ADD_HISTORY], [1], [Define if you have the 
add_history function])
+       )
+ 
+-      AC_CHECK_HEADERS(history.h readline/history.h readline.h 
readline/readline.h)
++      AC_CHECK_HEADERS([history.h readline/history.h readline.h 
readline/readline.h])
+ 
+       # Check for rl_completion_matches as in readline 4.2
+-      AC_CHECK_FUNCS(rl_completion_matches)
+-      
++      AC_CHECK_FUNCS([rl_completion_matches])
++
+       msg_readline="enabled"
+-else
++], [
+       msg_readline="disabled"
+-fi
+-
+-])
+-
++])])
+

diff --git a/net-misc/cadaver/files/cadaver-0.24-link-cflags.patch 
b/net-misc/cadaver/files/cadaver-0.24-link-cflags.patch
new file mode 100644
index 000000000000..f4e537d6482a
--- /dev/null
+++ b/net-misc/cadaver/files/cadaver-0.24-link-cflags.patch
@@ -0,0 +1,24 @@
+From e798c0144d3042cf6139d1ab85d84a8416cf5f00 Mon Sep 17 00:00:00 2001
+From: Sam James <s...@gentoo.org>
+Date: Wed, 17 Apr 2024 00:51:57 +0100
+Subject: [PATCH] Makefile.in: include CFLAGS at link-time
+
+GCC's documentation recommends this [0] for e.g. LTO. As a trivial silly
+example, my -fdiagnostics-color=always was stripped out, so a warning
+I got wasn't in colour.
+
+[0] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flto
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -56,7 +56,7 @@ all: $(TARGET)
+ .PHONY: subdirs install clean distclean
+ 
+ $(TARGET): $(ALLOBJS) subdirs
+-      $(CC) $(LDFLAGS) -o $(TARGET) $(ALLOBJS) $(LIBS)
++      $(CC) $(CFLAGS) $(LDFLAGS) -o $(TARGET) $(ALLOBJS) $(LIBS)
+ 
+ .c.o:
+       $(CC) $(ALL_CFLAGS) -o $@ -c $<
+-- 
+2.44.0
+

Reply via email to