net-analyzer/nagios-plugins-linux-madrisan: fix build w. -fno-common
authorLouis Sautier <sbraz@gentoo.org>
Wed, 29 Jan 2020 11:01:18 +0000 (12:01 +0100)
committerLouis Sautier <sbraz@gentoo.org>
Wed, 29 Jan 2020 11:04:07 +0000 (12:04 +0100)
Closes: https://bugs.gentoo.org/706536
Package-Manager: Portage-2.3.85, Repoman-2.3.20
Signed-off-by: Louis Sautier <sbraz@gentoo.org>
net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-25-fix-fno-common.patch [new file with mode: 0644]
net-analyzer/nagios-plugins-linux-madrisan/nagios-plugins-linux-madrisan-25-r1.ebuild

diff --git a/net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-25-fix-fno-common.patch b/net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-25-fix-fno-common.patch
new file mode 100644 (file)
index 0000000..74bddd6
--- /dev/null
@@ -0,0 +1,37 @@
+From 4936ca25f3e9a2875ce063033e5e8f3a3590dab2 Mon Sep 17 00:00:00 2001
+From: Davide Madrisan <davide.madrisan@gmail.com>
+Date: Mon, 27 Jan 2020 22:00:41 +0100
+Subject: [PATCH] The build fails when '-fno-common' is added to CFLAGS
+
+As reported by 'sbraz', the build stops with the error message:
+
+   (.bss+0x8): multiple definition of `program_name'
+   (.bss+0x0): multiple definition of `program_name_short'
+
+This flag will be apparently enabled by default in gcc 10.
+
+Fix this build problem by correctly referencing as extern both
+the variables in the header file.
+
+Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
+---
+ include/progname.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/progname.h b/include/progname.h
+index 576ed16..847122a 100644
+--- a/include/progname.h
++++ b/include/progname.h
+@@ -25,10 +25,10 @@ extern "C" {
+ #endif
+   /* String containing name the program is called with.  */
+-  const char *program_name;
++  extern const char *program_name;
+   /* String containing a short version of 'program_name'.  */
+-  const char *program_name_short;
++  extern const char *program_name_short;
+   /* Set program_name, based on argv[0].
+      argv0 must be a string allocated with indefinite extent, and must not be
index 6367fdc2f4e773d294778b252eb373161fafb894..284d0d9d1a834745374e481c2f18ba26db1a0a91 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2019 Gentoo Authors
+# Copyright 2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -20,6 +20,10 @@ IUSE="curl"
 DEPEND="curl? ( net-misc/curl:0= )"
 RDEPEND="${DEPEND}"
 
+# https://github.com/madrisan/nagios-plugins-linux/issues/48
+# Will be in the next release
+PATCHES=( "${FILESDIR}/${P}-fix-fno-common.patch" )
+
 S="${WORKDIR}/${MY_P}"
 
 src_prepare() {