pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/ham/uhd uhd: fix some code portability issues
details: https://anonhg.NetBSD.org/pkgsrc/rev/ce51489b20ac
branches: trunk
changeset: 376731:ce51489b20ac
user: tnn <tnn%pkgsrc.org@localhost>
date: Tue Apr 12 20:10:46 2022 +0000
description:
uhd: fix some code portability issues
diffstat:
ham/uhd/Makefile | 6 +-
ham/uhd/distinfo | 7 +-
ham/uhd/patches/patch-examples_getopt_getopt.c | 15 +++
ham/uhd/patches/patch-examples_getopt_getopt.h | 14 ++
ham/uhd/patches/patch-lib_rfnoc_vector__iir__block__control.cpp | 24 ++++
ham/uhd/patches/patch-lib_usrp_common_lmx2592.cpp | 50 ++++++++++
ham/uhd/patches/patch-tests_rfnoc__block__tests_vector__iir__block__test.cpp | 15 +++
7 files changed, 129 insertions(+), 2 deletions(-)
diffs (177 lines):
diff -r 6f07fad42c3a -r ce51489b20ac ham/uhd/Makefile
--- a/ham/uhd/Makefile Tue Apr 12 19:07:11 2022 +0000
+++ b/ham/uhd/Makefile Tue Apr 12 20:10:46 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.66 2022/03/27 17:03:28 tnn Exp $
+# $NetBSD: Makefile,v 1.67 2022/04/12 20:10:46 tnn Exp $
DISTNAME= uhd-4.1.0.5
PKGREVISION= 1
@@ -72,6 +72,10 @@
REPLACE_PYTHON+= tests/streaming_performance/run_N3xx_max_rate_tests.py
REPLACE_PYTHON+= tests/streaming_performance/run_X3xx_max_rate_tests.py
+# -pthread needed to turn on boost threads on some platforms
+CXXFLAGS.SunOS+= -pthread
+LDFLAGS.SunOS+= -lsocket
+
INSTALLATION_DIRS+= share/uhd
INSTALLATION_DIRS+= share/uhd/firmware
INSTALLATION_DIRS+= share/uhd/fpga
diff -r 6f07fad42c3a -r ce51489b20ac ham/uhd/distinfo
--- a/ham/uhd/distinfo Tue Apr 12 19:07:11 2022 +0000
+++ b/ham/uhd/distinfo Tue Apr 12 20:10:46 2022 +0000
@@ -1,9 +1,14 @@
-$NetBSD: distinfo,v 1.31 2022/03/27 17:03:28 tnn Exp $
+$NetBSD: distinfo,v 1.32 2022/04/12 20:10:46 tnn Exp $
BLAKE2s (uhd-4.1.0.5.tar.gz) = f172a3e30a7e6b81cf79ead0b7a7bb2f34ea55777b94152c2fec267b2f68586a
SHA512 (uhd-4.1.0.5.tar.gz) = 4929ebc8a12bcc0acfe4a64ceafe17387420e2f056e7bb7284a8d7b60d14aba05484b3c033ce63b00c6d9115f570b056df4e2b36e11a2b25079a8c34b1d084af
Size (uhd-4.1.0.5.tar.gz) = 37975618 bytes
SHA1 (patch-CMakeLists.txt) = 16cc883a0bffdb6c3a4733dda7060bd206928d68
+SHA1 (patch-examples_getopt_getopt.c) = f9c7297cb1dcc9438baed9dcdaf0f52b83297e01
+SHA1 (patch-examples_getopt_getopt.h) = 7f01c9385644dbf2b61dfd8bebac8016b46000c5
+SHA1 (patch-lib_rfnoc_vector__iir__block__control.cpp) = d0bc32f888a6cfc30f1eb57d7f2d71bb86cdc284
SHA1 (patch-lib_transport_nirio_lvbitx_process-lvbitx.py) = 5117c7593c4e92ed6bfb86388cc366c41a1dead7
+SHA1 (patch-lib_usrp_common_lmx2592.cpp) = 2828dcf989f1fc43c70e10b8de1e34485066842d
SHA1 (patch-lib_usrp_mpmd_mpmd__link__if__ctrl__udp.cpp) = f94b2a282161474a0a91f333fd2d733ce7d1d4f3
SHA1 (patch-lib_usrp_mpmd_mpmd__link__if__ctrl__udp.hpp) = 3106d28c4ddc38fd304eb94de5773ff56fed0fd8
+SHA1 (patch-tests_rfnoc__block__tests_vector__iir__block__test.cpp) = 5d9594ce208acd8668589b117dd58d6b1a09de3a
diff -r 6f07fad42c3a -r ce51489b20ac ham/uhd/patches/patch-examples_getopt_getopt.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ham/uhd/patches/patch-examples_getopt_getopt.c Tue Apr 12 20:10:46 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-examples_getopt_getopt.c,v 1.1 2022/04/12 20:10:46 tnn Exp $
+
+don't conflict with system's getopt prototype
+
+--- examples/getopt/getopt.c.orig 2021-12-14 18:37:20.000000000 +0000
++++ examples/getopt/getopt.c
+@@ -23,7 +23,7 @@ int optopt;
+ char *optarg;
+
+ int
+-getopt(int argc, char **argv, char *opts)
++getopt(int argc, char *const *argv, const char *opts)
+ {
+ static int sp;
+ int c;
diff -r 6f07fad42c3a -r ce51489b20ac ham/uhd/patches/patch-examples_getopt_getopt.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ham/uhd/patches/patch-examples_getopt_getopt.h Tue Apr 12 20:10:46 2022 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-examples_getopt_getopt.h,v 1.1 2022/04/12 20:10:46 tnn Exp $
+
+don't conflict with system's getopt prototype
+
+--- examples/getopt/getopt.h.orig 2021-12-14 18:37:20.000000000 +0000
++++ examples/getopt/getopt.h
+@@ -14,6 +14,6 @@ extern int optind;
+ extern int optopt;
+ extern char* optarg;
+
+-int getopt(int argc, char **argv, char *opts);
++int getopt(int argc, char *const *argv, const char *opts);
+
+ #endif /* _GETOPT_H_ */
diff -r 6f07fad42c3a -r ce51489b20ac ham/uhd/patches/patch-lib_rfnoc_vector__iir__block__control.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ham/uhd/patches/patch-lib_rfnoc_vector__iir__block__control.cpp Tue Apr 12 20:10:46 2022 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-lib_rfnoc_vector__iir__block__control.cpp,v 1.1 2022/04/12 20:10:46 tnn Exp $
+
+Avoid ambiguous call to pow on SunOS.
+
+--- lib/rfnoc/vector_iir_block_control.cpp.orig 2021-12-14 18:37:20.000000000 +0000
++++ lib/rfnoc/vector_iir_block_control.cpp
+@@ -109,7 +109,7 @@ private:
+ throw uhd::value_error("Alpha value must be in [0.0, 1.0]");
+ }
+ _vector_iir_reg_iface.poke32(
+- REG_ALPHA_OFFSET, uint32_t(alpha * pow(2, 31)), chan);
++ REG_ALPHA_OFFSET, uint32_t(alpha * pow((double)2, (double)31)), chan);
+ });
+ register_property(&_prop_beta.back(), [this, chan]() {
+ double beta = _prop_beta.at(chan).get();
+@@ -117,7 +117,7 @@ private:
+ throw uhd::value_error("Beta value must be in [0.0, 1.0]");
+ }
+ _vector_iir_reg_iface.poke32(
+- REG_BETA_OFFSET, uint32_t(beta * pow(2, 31)), chan);
++ REG_BETA_OFFSET, uint32_t(beta * pow((double)2, (double)31)), chan);
+ });
+ register_property(&_prop_delay.back(), [this, chan, max_delay]() {
+ int length = _prop_delay.at(chan).get();
diff -r 6f07fad42c3a -r ce51489b20ac ham/uhd/patches/patch-lib_usrp_common_lmx2592.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ham/uhd/patches/patch-lib_usrp_common_lmx2592.cpp Tue Apr 12 20:10:46 2022 +0000
@@ -0,0 +1,50 @@
+$NetBSD: patch-lib_usrp_common_lmx2592.cpp,v 1.1 2022/04/12 20:10:46 tnn Exp $
+
+Don't conflict with system's offset_t.
+
+--- lib/usrp/common/lmx2592.cpp.orig 2021-12-14 18:37:20.000000000 +0000
++++ lib/usrp/common/lmx2592.cpp
+@@ -104,10 +104,10 @@ inline bool abs_less_than_compare(const
+ return std::abs(a) < std::abs(b);
+ }
+
+-typedef std::pair<double, intermediate_frequency_t> offset_t;
++typedef std::pair<double, intermediate_frequency_t> lmx2592_offset_t;
+
+-// comparator that uses absolute value on the first value of an offset_t
+-inline bool offset_abs_less_than_compare(const offset_t a, const offset_t b)
++// comparator that uses absolute value on the first value of an lmx2592_offset_t
++inline bool offset_abs_less_than_compare(const lmx2592_offset_t a, const lmx2592_offset_t b)
+ {
+ return std::abs(a.first) < std::abs(b.first);
+ }
+@@ -607,7 +607,7 @@ private: // Members
+ // 3. Reference to Fvco spur
+ // 4. Reference to Flo spur
+ // A negative offset indicates the closest spur is at a lower frequency
+- offset_t _get_min_offset_frequency(const uint16_t N,
++ lmx2592_offset_t _get_min_offset_frequency(const uint16_t N,
+ const uint32_t fnum,
+ const uint32_t fden,
+ const int prescaler,
+@@ -626,16 +626,16 @@ private: // Members
+ // in order to calculate the necessary frequency shift
+
+ // Integer Boundary:
+- const offset_t ib_spur = {_get_closest_spur_offset(frf_in, pfd_freq), FRF_IN};
++ const lmx2592_offset_t ib_spur = {_get_closest_spur_offset(frf_in, pfd_freq), FRF_IN};
+
+ // PFD Offset Spur:
+- const offset_t pfd_offset_spur = {_get_closest_spur_offset(fvco, pfd_freq), FVCO};
++ const lmx2592_offset_t pfd_offset_spur = {_get_closest_spur_offset(fvco, pfd_freq), FVCO};
+
+ // Reference to Fvco Spur:
+- const offset_t fvco_spur = {_get_closest_spur_offset(fvco, fref), FVCO};
++ const lmx2592_offset_t fvco_spur = {_get_closest_spur_offset(fvco, fref), FVCO};
+
+ // Reference to F_lo Spur:
+- const offset_t flo_spur = {_get_closest_spur_offset(flo, fref), FLO};
++ const lmx2592_offset_t flo_spur = {_get_closest_spur_offset(flo, fref), FLO};
+
+ // use min with special comparator for minimal absolute value
+ return std::min({ib_spur, pfd_offset_spur, fvco_spur, flo_spur},
diff -r 6f07fad42c3a -r ce51489b20ac ham/uhd/patches/patch-tests_rfnoc__block__tests_vector__iir__block__test.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ham/uhd/patches/patch-tests_rfnoc__block__tests_vector__iir__block__test.cpp Tue Apr 12 20:10:46 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-tests_rfnoc__block__tests_vector__iir__block__test.cpp,v 1.1 2022/04/12 20:10:46 tnn Exp $
+
+Avoid ambiguous call to pow on SunOS.
+
+--- tests/rfnoc_block_tests/vector_iir_block_test.cpp.orig 2021-12-14 18:37:20.000000000 +0000
++++ tests/rfnoc_block_tests/vector_iir_block_test.cpp
+@@ -94,7 +94,7 @@ struct vector_iir_block_fixture
+
+ inline uint32_t calculate_alphabeta_register_value(double alphabeta) const
+ {
+- return uint32_t(alphabeta * pow(2, 31));
++ return uint32_t(alphabeta * pow((double)2, (double)31));
+ }
+
+ inline size_t calculate_register_address(size_t offset, size_t channel) const
Home |
Main Index |
Thread Index |
Old Index