commit:     40c688f285b4d9f07067da6e2566369fa92a5628
Author:     Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  4 07:39:14 2025 +0000
Commit:     Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
CommitDate: Tue Feb  4 07:44:55 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40c688f2

media-radio/unixcw: Move to Qt6

Signed-off-by: Thomas Beierlein <tomjbe <AT> gentoo.org>

 .../unixcw/files/unixcw-3.6.1-qt6-build.patch      | 116 +++++++++++++++++++++
 .../unixcw/files/unixcw-3.6.1-qt6-src.patch        |  44 ++++++++
 media-radio/unixcw/unixcw-3.6.1-r1.ebuild          |  78 ++++++++++++++
 3 files changed, 238 insertions(+)

diff --git a/media-radio/unixcw/files/unixcw-3.6.1-qt6-build.patch 
b/media-radio/unixcw/files/unixcw-3.6.1-qt6-build.patch
new file mode 100644
index 000000000000..53cda260267e
--- /dev/null
+++ b/media-radio/unixcw/files/unixcw-3.6.1-qt6-build.patch
@@ -0,0 +1,116 @@
+diff --git a/configure.ac b/configure.ac
+index aecd270..d66151e 100755
+--- a/configure.ac
++++ b/configure.ac
+@@ -512,28 +512,28 @@ if test "$enable_xcwcp" = "no" ; then
+     WITH_XCWCP='no'
+ else
+     # 
http://stackoverflow.com/questions/5178511/integrate-qt-project-with-autotool
+-    PKG_CHECK_MODULES(QT5, [Qt5Widgets Qt5Gui Qt5Core >= 5.0.0], [
+-                         AC_PATH_PROGS(MOC, [moc-qt5 moc], moc,`eval 
$PKG_CONFIG --variable=host_bins Qt5Core`)
++    PKG_CHECK_MODULES(QT6, [Qt6Widgets Qt6Gui Qt6Core >= 6.0.0], [
++                         AC_PATH_PROGS(MOC, [moc-qt6 moc], moc,`eval 
$PKG_CONFIG --variable=libexecdir Qt6Core`)
+ 
+                          # 
https://stackoverflow.com/questions/11663702/how-to-suppress-warnings-for-file-included-from-header
+-                         QT_INCLUDE_DIR=`$PKG_CONFIG --variable=includedir 
Qt5Core`
+-                         QT5_CFLAGS="-isystem $QT_INCLUDE_DIR"
+-                         QT5_CFLAGS+=" -isystem $QT_INCLUDE_DIR/QtWidgets"
+-                         QT5_CFLAGS+=" -isystem $QT_INCLUDE_DIR/QtGui"
+-                         QT5_CFLAGS+=" -isystem $QT_INCLUDE_DIR/QtCore"
++                         QT_INCLUDE_DIR=`$PKG_CONFIG --variable=includedir 
Qt6Core`
++                         QT6_CFLAGS="-isystem $QT_INCLUDE_DIR"
++                         QT6_CFLAGS+=" -isystem $QT_INCLUDE_DIR/QtWidgets"
++                         QT6_CFLAGS+=" -isystem $QT_INCLUDE_DIR/QtGui"
++                         QT6_CFLAGS+=" -isystem $QT_INCLUDE_DIR/QtCore"
+ 
+-                         AC_MSG_RESULT([QT5 CLFAGS is $QT5_CFLAGS])
+-                         AC_MSG_RESULT([QT5 LIBS is $QT5_LIBS])
++                         AC_MSG_RESULT([QT6 CFLAGS is $QT6_CFLAGS])
++                         AC_MSG_RESULT([QT6 LIBS is $QT6_LIBS])
+ 
+-                         AC_SUBST(QT5_CFLAGS)
+-                         AC_SUBST(QT5_LIBS)
++                         AC_SUBST(QT6_CFLAGS)
++                         AC_SUBST(QT6_LIBS)
+                          AC_SUBST(MOC)
+ 
+                          WITH_XCWCP='yes'
+ 
+                          ], [
+ 
+-                         AC_MSG_WARN([Cannot find Qt5 files - unable to build 
xcwcp])
++                         AC_MSG_WARN([Cannot find Qt6 files - unable to build 
xcwcp])
+ 
+                          WITH_XCWCP='no'
+ 
+@@ -797,9 +797,9 @@ AC_MSG_NOTICE([  build cwgen:  
..........................................  $WITH
+ AC_MSG_NOTICE([  build cwcp:  ...........................................  
$WITH_CWCP])
+ AC_MSG_NOTICE([  build xcwcp:  ..........................................  
$WITH_XCWCP])
+ if test "$WITH_XCWCP" = 'yes' ; then
+-    AC_MSG_NOTICE([      Qt5 LIBS:  ......................................... 
 $QT5_LIBS])
+-    AC_MSG_NOTICE([      Qt5 MOC:  .......................................... 
 $MOC])
+-    AC_MSG_NOTICE([      Qt5 CFLAGS:  ....................................... 
 $QT5_CFLAGS])
++    AC_MSG_NOTICE([      Qt6 LIBS:  ......................................... 
 $QT6_LIBS])
++    AC_MSG_NOTICE([      Qt6 MOC:  .......................................... 
 $MOC])
++    AC_MSG_NOTICE([      Qt6 CFLAGS:  ....................................... 
 $QT6_CFLAGS])
+ fi
+ AC_MSG_NOTICE([  CFLAGS:  ...............................................  
$CFLAGS])
+ 
+diff --git a/Makefile.inc.in b/Makefile.inc.in
+index dd091db..6ad9361 100644
+--- a/Makefile.inc.in
++++ b/Makefile.inc.in
+@@ -27,9 +27,9 @@ AC_LDCONFIG  = @LDCONFIG@
+ AC_LIBS               = @LIBS@
+ AC_AWK                = @AWK@
+ 
+-AC_QT5_CFLAGS = @QT5_CFLAGS@
+-AC_QT5_LIBS   = @QT5_LIBS@
+-AC_QT5_MOC    = @MOC@
++AC_QT6_CFLAGS = @QT6_CFLAGS@
++AC_QT6_LIBS   = @QT6_LIBS@
++AC_QT6_MOC    = @MOC@
+ AC_SRC_SUBDIRS        = @SRC_SUBDIRS@
+ 
+ AC_CFLAG_PIC  = @CFLAG_PIC@
+diff --git a/src/xcwcp/Makefile.am b/src/xcwcp/Makefile.am
+index 6d4a02d..492b321 100644
+--- a/src/xcwcp/Makefile.am
++++ b/src/xcwcp/Makefile.am
+@@ -18,7 +18,7 @@
+ 
+ # use $(top_builddir) instead of $(top_srcdir) because Makefile.inc is
+ # (re)created at build time; if you use $(top_srcdir), you may (will?)
+-# get empty $(AC_QT5_CFLAGS), $(AC_QT5_LIBS) and $(AC_QT5_MOC);
++# get empty $(AC_QT6_CFLAGS), $(AC_QT6_LIBS) and $(AC_QT6_MOC);
+ -include $(top_builddir)/Makefile.inc
+ 
+ # program(s) to be built in current dir
+@@ -36,12 +36,12 @@ xcwcp_SOURCES = \
+ nodist_xcwcp_SOURCES = moc_application.cc
+ 
+ # target-specific preprocessor flags (#defs and include dirs)
+-xcwcp_CPPFLAGS = -I$(top_srcdir)/src/ -I$(top_srcdir)/src/libcw/ 
$(AC_QT5_CFLAGS) $(AC_CFLAG_PIC)
++xcwcp_CPPFLAGS = -I$(top_srcdir)/src/ -I$(top_srcdir)/src/libcw/ 
$(AC_QT6_CFLAGS) $(AC_CFLAG_PIC)
+ 
+ # Target-specific linker flags (objects to link). Order is important:
+ # first static library then dynamic. Otherwise linker may not find
+ # symbols from the dynamic library.
+-xcwcp_LDADD = $(top_builddir)/src/cwutils/lib_xcwcp.a 
-L$(top_builddir)/src/libcw/.libs -lcw $(AC_QT5_LIBS) -lpthread $(INTL_LIB)
++xcwcp_LDADD = $(top_builddir)/src/cwutils/lib_xcwcp.a 
-L$(top_builddir)/src/libcw/.libs -lcw $(AC_QT6_LIBS) -lpthread $(INTL_LIB)
+ 
+ 
+ 
+@@ -73,10 +73,10 @@ CLEANFILES = moc_application.cc
+ # Qt5 magic
+ if HOST_IS_FREEBSD
+ moc_application.cc: application.h
+-      $(AC_QT5_MOC) application.h -o application.cc
++      $(AC_QT6_MOC) application.h -o application.cc
+ else
+ moc_application.cc: application.h
+-      $(AC_QT5_MOC) $< -o $@
++      $(AC_QT6_MOC) $< -o $@
+ endif
+ 
+ 

diff --git a/media-radio/unixcw/files/unixcw-3.6.1-qt6-src.patch 
b/media-radio/unixcw/files/unixcw-3.6.1-qt6-src.patch
new file mode 100644
index 000000000000..d904ee9020b5
--- /dev/null
+++ b/media-radio/unixcw/files/unixcw-3.6.1-qt6-src.patch
@@ -0,0 +1,44 @@
+diff --git a/src/xcwcp/application.cc b/src/xcwcp/application.cc
+index 12f9311..f1dd707 100644
+--- a/src/xcwcp/application.cc
++++ b/src/xcwcp/application.cc
+@@ -821,7 +821,7 @@ void Application::make_toolbar(void)
+       toolbar->addSeparator();
+ 
+ 
+-      QLabel *speed_label_ = new QLabel(_("Speed:"), 0, 0);
++      QLabel *speed_label_ = new QLabel(_("Speed:"), 0, Qt::Widget);
+       toolbar->addWidget(speed_label_);
+ 
+       speed_spin = new QSpinBox(toolbar);
+@@ -857,7 +857,7 @@ void Application::make_toolbar(void)
+       toolbar->addSeparator();
+ 
+ 
+-      QLabel *volume_label = new QLabel(_("Volume:"), 0, 0);
++      QLabel *volume_label = new QLabel(_("Volume:"), 0, Qt::Widget);
+       toolbar->addWidget(volume_label);
+ 
+       volume_spin = new QSpinBox(toolbar);
+@@ -875,7 +875,7 @@ void Application::make_toolbar(void)
+       toolbar->addSeparator();
+ 
+ 
+-      QLabel *gap_label = new QLabel(_("Gap:"), 0, 0);
++      QLabel *gap_label = new QLabel(_("Gap:"), 0, Qt::Widget);
+       toolbar->addWidget(gap_label);
+ 
+       gap_spin = new QSpinBox(toolbar);
+diff --git a/src/xcwcp/receiver.cc b/src/xcwcp/receiver.cc
+index 904ad22..7c785c0 100644
+--- a/src/xcwcp/receiver.cc
++++ b/src/xcwcp/receiver.cc
+@@ -165,7 +165,7 @@ void Receiver::handle_mouse_event(QMouseEvent *event, bool 
is_reverse_paddles)
+               const int is_down = event->type() == QEvent::MouseButtonPress
+                       || event->type() == QEvent::MouseButtonDblClick;
+ 
+-              if (event->button() == Qt::MidButton) {
++              if (event->button() == Qt::MiddleButton) {
+                       //fprintf(stderr, "---------- handle mouse event: sk: 
%d\n", is_down);
+                       sk_event(is_down);
+                       event->accept();

diff --git a/media-radio/unixcw/unixcw-3.6.1-r1.ebuild 
b/media-radio/unixcw/unixcw-3.6.1-r1.ebuild
new file mode 100644
index 000000000000..22f41c23d9a4
--- /dev/null
+++ b/media-radio/unixcw/unixcw-3.6.1-r1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="Collection of programs that fit together to form a morse code 
tutor program"
+HOMEPAGE="https://unixcw.sourceforge.net";
+SRC_URI="https://downloads.sourceforge.net/${PN}/${P}.tar.gz";
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ppc ~x86"
+IUSE="alsa ncurses pulseaudio suid test qt6"
+RESTRICT="!test? ( test )"
+
+RDEPEND="ncurses? ( sys-libs/ncurses:= )
+       qt6? ( dev-qt/qtbase:6[gui,widgets] )
+       alsa? ( media-libs/alsa-lib )
+       pulseaudio? ( media-libs/libpulse )"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig
+       dev-build/libtool"
+
+PATCHES=( "${FILESDIR}/${PN}-3.6.1-qt6-src.patch"
+       "${FILESDIR}/${PN}-3.6.1-qt6-build.patch" )
+
+src_prepare() {
+       eapply "${PATCHES[@]}"
+       eapply -p0 "${FILESDIR}"/${PN}-3.6-tinfo.patch
+       # Bug# 837617 and 858278
+       sed -i -e "s/curses, initscr/ncurses, initscr/" \
+               -e "s/_curses_initscr/_ncurses_initscr/" configure.ac || die
+       eapply_user
+       eautoreconf
+}
+
+src_configure() {
+       econf --libdir="${EPREFIX}/usr/$(get_libdir)" \
+               $(use_enable pulseaudio ) \
+               $(use_enable alsa ) \
+               $(use_enable ncurses cwcp ) \
+               $(use_enable qt6 xcwcp ) \
+               --disable-static
+}
+
+src_install() {
+       default
+
+       if ! use suid ; then
+               fperms 711 /usr/bin/cw
+               if use ncurses ; then
+                       fperms 711 /usr/bin/cwcp
+               fi
+               if use qt6 ; then
+                       fperms 711 /usr/bin/xcwcp
+               fi
+       fi
+
+       find "${D}" -name '*.la' -type f -delete || die
+}
+
+pkg_postinst() {
+       if use suid ; then
+               ewarn "You have choosen to install 'cw', 'cwcp' and 'xcwcp' 
setuid"
+               ewarn "by setting USE=suid."
+               ewarn "Be aware that this is a security risk and not 
recommended."
+               ewarn ""
+               ewarn "These files do only need root access if you want to use 
the"
+               ewarn "PC speaker for morse sidetone output. You can 
alternativly"
+               ewarn "drop USE=suid and use sudo."
+       else
+               elog "Be aware that 'cw', 'cwcp' and 'xcwcp' needs root access 
if"
+               elog "you want to use the PC speaker for morse sidetone output."
+               elog "You can call the programs via sudo for that (see 'man 
sudo')."
+       fi
+}

Reply via email to