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@gentoo.org>
This commit is contained in:
Thomas Beierlein
2023-07-04 19:33:03 +02:00
parent 92eccfef05
commit ae348f36a8
2 changed files with 105 additions and 0 deletions

View File

@@ -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)

View File

@@ -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
}