commit:     ae348f36a8e2b3f7e55ede95c86785fe24e6952f
Author:     Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  4 17:33:03 2023 +0000
Commit:     Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
CommitDate: Tue Jul  4 17:35:30 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae348f36

media-radio/tlf: provide fallback definitions for M_PI and M_PI_2

C Standard does not guarantee the presence of both definitions in every
circumstance.

Closes: https://bugs.gentoo.org/907442
Signed-off-by: Thomas Beierlein <tomjbe <AT> gentoo.org>

 media-radio/tlf/files/tlf-1.4.1-pi.patch | 47 ++++++++++++++++++++++++++
 media-radio/tlf/tlf-1.4.1-r4.ebuild      | 58 ++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/media-radio/tlf/files/tlf-1.4.1-pi.patch 
b/media-radio/tlf/files/tlf-1.4.1-pi.patch
new file mode 100644
index 000000000000..586ce973cc1a
--- /dev/null
+++ b/media-radio/tlf/files/tlf-1.4.1-pi.patch
@@ -0,0 +1,47 @@
+# As C standards does not define M_PI or M_PI_2 provide a fallback
+# bug 907442
+diff --git a/src/muf.c b/src/muf.c
+index 6671651..1f880fd 100644
+--- a/src/muf.c
++++ b/src/muf.c
+@@ -32,6 +32,10 @@
+ #include "tlf_panel.h"
+ #include "ui_utils.h"
+ 
++#ifndef M_PI_2
++      # define M_PI_2         1.57079632679489661923  /* pi/2 */
++#endif
++
+ 
+ // message splitters:
+ // line[0] - original line, content can be modified in-place
+diff --git a/src/qrb.h b/src/qrb.h
+index 89d3f30..0120de0 100644
+--- a/src/qrb.h
++++ b/src/qrb.h
+@@ -21,6 +21,10 @@
+ #ifndef QRB_H
+ #define QRB_H
+ 
++#ifndef M_PI
++      # define M_PI           3.14159265358979323846  /* pi */
++#endif
++
+ #define ARC_IN_KM 111.2
+ #define RADIAN  (180.0 / M_PI)
+ 
+diff --git a/src/sunup.c b/src/sunup.c
+index b1186dd..7412c06 100644
+--- a/src/sunup.c
++++ b/src/sunup.c
+@@ -23,6 +23,10 @@
+ 
+ #include "get_time.h"
+ 
++#ifndef M_PI
++        # define M_PI           3.14159265358979323846  /* pi */
++#endif
++
+ #define RADIAN  (180.0 / M_PI)
+ 
+ 

diff --git a/media-radio/tlf/tlf-1.4.1-r4.ebuild 
b/media-radio/tlf/tlf-1.4.1-r4.ebuild
new file mode 100644
index 000000000000..a0c1a639f712
--- /dev/null
+++ b/media-radio/tlf/tlf-1.4.1-r4.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+inherit autotools flag-o-matic
+
+DESCRIPTION="Console-mode amateur radio contest logger"
+HOMEPAGE="http://home.iae.nl/users/reinc/TLF-0.2.html";
+SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="test"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND="sys-libs/ncurses:=
+       dev-libs/glib:2
+       media-libs/hamlib:=
+       media-sound/sox
+       dev-libs/xmlrpc-c[curl]
+       elibc_musl? ( sys-libs/argp-standalone )"
+DEPEND="
+       ${RDEPEND}
+       test? ( dev-util/cmocka )"
+
+PATCHES=( "${FILESDIR}/${P}-zone_nr.patch"
+         "${FILESDIR}/${P}-musl.patch"
+         "${FILESDIR}/${P}-missing-include.patch"
+         "${FILESDIR}/${P}-prototypes.patch"
+         "${FILESDIR}/${P}-pi.patch"
+       )
+
+# suppress warning wrt 'implicit function declaration' in config logs
+# bug #899842
+QA_CONFIG_IMPL_DECL_SKIP=(
+       wget_wch        # designed to check availability of various ncursesw
+                               # header files
+       )
+
+src_prepare() {
+       if has_version '>=media-libs/hamlib-4.2' ; then
+               sed -i -e "s/FILPATHLEN/HAMLIB_FILPATHLEN/g" 
"${S}"/src/sendqrg.c || die
+       fi
+
+       eapply ${PATCHES[@]}
+       eapply_user
+       eautoreconf
+}
+
+src_configure() {
+       use elibc_musl && append-libs argp
+       append-ldflags -L/usr/$(get_libdir)/hamlib
+       filter-lto              # bug # 876418
+       econf --enable-fldigi-xmlrpc
+}

Reply via email to