git: 9f9722769c19 - main - comms/wsjtx: Fix Fortran runtime error

From: Diane Bruce <db_at_FreeBSD.org>
Date: Sun, 03 Sep 2023 15:34:00 UTC
The branch main has been updated by db:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9f9722769c195fe5b2ea0079a3082fa9a32c29c7

commit 9f9722769c195fe5b2ea0079a3082fa9a32c29c7
Author:     Diane Bruce <db@FreeBSD.org>
AuthorDate: 2023-09-03 15:25:23 +0000
Commit:     Diane Bruce <db@FreeBSD.org>
CommitDate: 2023-09-03 15:33:54 +0000

    comms/wsjtx: Fix Fortran runtime error
    
    Suggested fixes did not work for FreeBSD because of clang differences
    this should fix problem.
    
    PR:             PR:     262937
---
 comms/wsjtx/Makefile           |  5 +--
 comms/wsjtx/files/hamlib.patch | 10 +++---
 comms/wsjtx/files/wsjtx.patch  | 75 +++++++++++++++++++++++++++++++++---------
 3 files changed, 67 insertions(+), 23 deletions(-)

diff --git a/comms/wsjtx/Makefile b/comms/wsjtx/Makefile
index ecb09ed2a572..6b7b0decbf5b 100644
--- a/comms/wsjtx/Makefile
+++ b/comms/wsjtx/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	wsjtx
 DISTVERSION=	2.5.4
-PORTREVISION=	6
+PORTREVISION=	7
 CATEGORIES=	comms hamradio
 MASTER_SITES=	SF/wsjt/${PORTNAME}-${PORTVERSION}${DISTVERSIONSUFFIX}
 
@@ -48,7 +48,8 @@ make-hamlib-patch:
 	(cd ${WRKDIR}/.build/hamlib-prefix/src;diff -u hamlib/$f.orig hamlib/$f >> ${FILESDIR}/hamlib.patch || true)
 . endfor
 
-_WSJTX_PATCHES=	CMakeLists.txt Radio.cpp widgets/FrequencyLineEdit.cpp \
+_WSJTX_PATCHES=	wsjtx_config.h.in CMakeLists.txt Radio.cpp \
+		widgets/FrequencyLineEdit.cpp \
 		widgets/FrequencyDeltaLineEdit.cpp \
 		CMake/Modules/FindUsb.cmake \
 		CMake/Modules/FindHamlib.cmake
diff --git a/comms/wsjtx/files/hamlib.patch b/comms/wsjtx/files/hamlib.patch
index 335e13502141..c4a39324ad9c 100644
--- a/comms/wsjtx/files/hamlib.patch
+++ b/comms/wsjtx/files/hamlib.patch
@@ -1,5 +1,5 @@
 --- hamlib/configure.orig	2022-01-02 05:10:19.000000000 -0500
-+++ hamlib/configure	2023-02-17 16:55:21.413328000 -0500
++++ hamlib/configure	2023-09-03 10:33:52.838742000 -0400
 @@ -19135,7 +19135,7 @@
  case "$host_os" in #(
    freebsd*) :
@@ -18,7 +18,7 @@
  
  
 --- hamlib/hamlib.pc.in.orig	2022-01-02 05:10:11.000000000 -0500
-+++ hamlib/hamlib.pc.in	2023-02-17 16:55:21.413939000 -0500
++++ hamlib/hamlib.pc.in	2023-09-03 10:33:52.839354000 -0400
 @@ -7,7 +7,6 @@
  Description: Library to control radio and rotator equipment.
  URL: @PACKAGE_URL@
@@ -30,7 +30,7 @@
 +Libs: -L${libdir} ${libdir}/libhamlib.a
 +Libs.private: @MATH_LIBS@ @DL_LIBS@ @NET_LIBS@ @PTHREAD_LIBS@ -lusb
 --- hamlib/tests/rigtestlibusb.c.orig	2022-01-02 05:10:11.000000000 -0500
-+++ hamlib/tests/rigtestlibusb.c	2023-02-17 16:55:21.414509000 -0500
++++ hamlib/tests/rigtestlibusb.c	2023-09-03 10:33:52.839923000 -0400
 @@ -115,7 +115,10 @@
      printf("      wSpeedSupported:       %u\n", ss_usb_cap->wSpeedSupported);
      printf("      bFunctionalitySupport: %u\n", ss_usb_cap->bFunctionalitySupport);
@@ -60,8 +60,8 @@
      libusb_free_bos_descriptor(bos);
  }
  
---- hamlib/src/misc.c.orig	2023-02-17 18:06:57.171679000 -0500
-+++ hamlib/src/misc.c	2023-02-17 18:13:49.377881000 -0500
+--- hamlib/src/misc.c.orig	2022-01-02 05:10:11.000000000 -0500
++++ hamlib/src/misc.c	2023-09-03 10:33:52.841041000 -0400
 @@ -2550,7 +2550,8 @@
      if (localtime)
      {
diff --git a/comms/wsjtx/files/wsjtx.patch b/comms/wsjtx/files/wsjtx.patch
index 64bdf7ac06ac..4cd6321db885 100644
--- a/comms/wsjtx/files/wsjtx.patch
+++ b/comms/wsjtx/files/wsjtx.patch
@@ -1,5 +1,48 @@
---- wsjtx/CMakeLists.txt.orig	2021-11-03 19:53:01.000000000 -0400
-+++ wsjtx/CMakeLists.txt	2021-12-31 07:53:05.900792000 -0500
+--- wsjtx/wsjtx_config.h.in.orig	2023-09-03 10:51:04.025598000 -0400
++++ wsjtx/wsjtx_config.h.in	2023-09-03 10:51:06.011258000 -0400
+@@ -18,7 +18,6 @@
+ 
+ #cmakedefine CMAKE_INSTALL_DATAROOTDIR "@CMAKE_INSTALL_DATAROOTDIR@"
+ #cmakedefine CMAKE_INSTALL_DOCDIR "@CMAKE_INSTALL_DOCDIR@"
+-#cmakedefine CMAKE_INSTALL_DATADIR "@CMAKE_INSTALL_DATADIR@"
+ #cmakedefine CMAKE_PROJECT_NAME "@CMAKE_PROJECT_NAME@"
+ #cmakedefine PROJECT_VENDOR "@PROJECT_VENDOR@"
+ #cmakedefine PROJECT_NAME "@PROJECT_NAME@"
+@@ -58,16 +57,23 @@
+ #endif
+ 
+   /* typedef for consistent gfortran ABI for charlen type hidden arguments */
+-#if __GNUC__ > 7
+-#ifdef __cplusplus
+-#include <cstddef>
+-#else
+-#include <stddef.h>
+-#endif
+-  typedef size_t fortran_charlen_t;
+-#else
++#if (__GNUC__ > 7)
++  #ifdef __cplusplus
++    #include <cstddef>
++  #else
++    #include <stddef.h>
++  #endif
++   typedef size_t fortran_charlen_t;
++ #else
+   typedef int fortran_charlen_t;
+-#endif
++/* typedef for consistent gfortran ABI for charlen type hidden arguments */
++  #if defined(__clang__)
++    #include <stddef.h>
++    typedef size_t fortran_charlen_t;
++  #else
++    typedef int fortran_charlen_t;
++  #endif
++ #endif
+ 
+ #ifdef __cplusplus
+ }
+--- wsjtx/CMakeLists.txt.orig	2021-12-28 04:31:58.000000000 -0500
++++ wsjtx/CMakeLists.txt	2023-09-03 10:35:34.257208000 -0400
 @@ -41,7 +41,7 @@
  endif ()
  
@@ -9,7 +52,7 @@
  endif ()
  
  project (wsjtx
-@@ -867,7 +867,7 @@
+@@ -868,7 +868,7 @@
  # OpenMP
  #
  find_package (OpenMP)
@@ -18,7 +61,7 @@
  #
  # fftw3 single precision library
  #
-@@ -884,7 +884,7 @@
+@@ -885,7 +885,7 @@
  check_type_size (CACHE_ALL HAMLIB_OLD_CACHING)
  check_symbol_exists (rig_set_cache_timeout_ms "hamlib/rig.h" HAVE_HAMLIB_CACHING)
  
@@ -27,7 +70,7 @@
  
  #
  # Qt5 setup
-@@ -914,7 +914,7 @@
+@@ -915,7 +915,7 @@
  #
  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
  
@@ -36,7 +79,7 @@
  
  if (NOT APPLE)
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pragmas")
-@@ -1160,7 +1160,7 @@
+@@ -1161,7 +1161,7 @@
  target_link_libraries (encode77 wsjt_fort wsjt_cxx)
  
  add_executable (wsprsim ${wsprsim_CSRCS})
@@ -45,8 +88,8 @@
  
  add_executable (jt4code lib/jt4code.f90)
  target_link_libraries (jt4code wsjt_fort wsjt_cxx)
---- wsjtx/Radio.cpp.orig	2021-11-03 19:53:01.000000000 -0400
-+++ wsjtx/Radio.cpp	2021-12-31 07:48:03.411318000 -0500
+--- wsjtx/Radio.cpp.orig	2021-12-28 04:31:58.000000000 -0500
++++ wsjtx/Radio.cpp	2023-09-03 10:35:34.257683000 -0400
 @@ -54,7 +54,8 @@
      value *= std::pow (10., scale);
      if (ok)
@@ -66,8 +109,8 @@
            {
              value = 0.;
              *ok = false;
---- wsjtx/widgets/FrequencyLineEdit.cpp.orig	2021-11-03 19:53:01.000000000 -0400
-+++ wsjtx/widgets/FrequencyLineEdit.cpp	2021-12-31 07:48:03.411740000 -0500
+--- wsjtx/widgets/FrequencyLineEdit.cpp.orig	2021-12-28 04:31:58.000000000 -0500
++++ wsjtx/widgets/FrequencyLineEdit.cpp	2023-09-03 10:35:34.258093000 -0400
 @@ -39,7 +39,8 @@
  FrequencyLineEdit::FrequencyLineEdit (QWidget * parent)
    : QLineEdit (parent)
@@ -78,8 +121,8 @@
  }
  
  auto FrequencyLineEdit::frequency () const -> Frequency
---- wsjtx/widgets/FrequencyDeltaLineEdit.cpp.orig	2021-11-03 19:53:01.000000000 -0400
-+++ wsjtx/widgets/FrequencyDeltaLineEdit.cpp	2021-12-31 07:48:03.412129000 -0500
+--- wsjtx/widgets/FrequencyDeltaLineEdit.cpp.orig	2021-12-28 04:31:58.000000000 -0500
++++ wsjtx/widgets/FrequencyDeltaLineEdit.cpp	2023-09-03 10:35:34.258484000 -0400
 @@ -39,8 +39,8 @@
  FrequencyDeltaLineEdit::FrequencyDeltaLineEdit (QWidget * parent)
    : QLineEdit (parent)
@@ -91,8 +134,8 @@
  }
  
  auto FrequencyDeltaLineEdit::frequency_delta () const -> FrequencyDelta
---- wsjtx/CMake/Modules/FindUsb.cmake.orig	2021-11-03 19:53:01.000000000 -0400
-+++ wsjtx/CMake/Modules/FindUsb.cmake	2021-12-31 07:48:03.412537000 -0500
+--- wsjtx/CMake/Modules/FindUsb.cmake.orig	2021-12-28 04:31:58.000000000 -0500
++++ wsjtx/CMake/Modules/FindUsb.cmake	2023-09-03 10:35:34.258886000 -0400
 @@ -13,25 +13,35 @@
  #  Usb::Usb	- The libusb library
  #
@@ -158,8 +201,8 @@
    Usb_LIBRARIES
    )
 +endif()
---- wsjtx/CMake/Modules/FindHamlib.cmake.orig	2021-11-03 19:53:01.000000000 -0400
-+++ wsjtx/CMake/Modules/FindHamlib.cmake	2021-12-31 07:48:03.412916000 -0500
+--- wsjtx/CMake/Modules/FindHamlib.cmake.orig	2021-12-28 04:31:58.000000000 -0500
++++ wsjtx/CMake/Modules/FindHamlib.cmake	2023-09-03 10:35:34.259262000 -0400
 @@ -18,7 +18,9 @@
    FIND_LIBRARY hamlib
    )