commit:     43b339616b8cd4ab204fb89b882dfe3d8ca55f78
Author:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Mon Nov  1 16:17:23 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 16 00:34:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43b33961

app-misc/cw: EAPI 8, fix build

Closes: https://bugs.gentoo.org/830507
Closes: https://bugs.gentoo.org/692426
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/22782
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-misc/cw/cw-1.0.16-r4.ebuild                    | 71 ++++++++++++++++++++++
 .../cw-1.0.16-replace-isastream-with-fcntl.patch   | 20 ++++++
 2 files changed, 91 insertions(+)

diff --git a/app-misc/cw/cw-1.0.16-r4.ebuild b/app-misc/cw/cw-1.0.16-r4.ebuild
new file mode 100644
index 000000000000..8a1bb807eb9a
--- /dev/null
+++ b/app-misc/cw/cw-1.0.16-r4.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="A non-intrusive real-time ANSI color wrapper for common 
unix-based commands"
+HOMEPAGE="http://cwrapper.sourceforge.net";
+SRC_URI="mirror://sourceforge/cwrapper/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+PATCHES=(
+       "${FILESDIR}"/${PV}-ldflags.patch
+       "${FILESDIR}"/${PV}-path.patch
+       "${FILESDIR}"/${PV}-collision.patch
+       "${FILESDIR}"/${PV}-format-security.patch
+       "${FILESDIR}"/${P}-replace-isastream-with-fcntl.patch
+)
+
+src_unpack() {
+       default
+       gunzip "${S}"/man/*.gz || die
+}
+
+src_configure() {
+       tc-export CC
+       econf
+}
+
+src_compile() {
+       emake local
+}
+
+src_install() {
+       insinto /usr/share/cw
+       doins etc/*
+
+       exeinto /usr/libexec/cw
+       doexe def/*
+
+       doman man/cwu.1
+       doman man/cwe.1
+       newman man/cw.1 color-wrapper
+       dodoc CHANGES CONTRIB INSTALL README PLATFORM doc/README*
+
+       dobin bin/{cwu,colorcfg}
+       # app-misc/color currently conflicts; hopefully 'colors' is safe
+       newbin bin/color colors
+       # media-radio/unixcw currently conflicts;
+       newbin bin/cw color-wrapper
+}
+
+pkg_postinst() {
+       ebegin "Updating definition files"
+       cwu /usr/libexec/cw /usr/bin/color-wrapper || die # >/dev/null
+       eend $?
+
+       elog "To enable color-wrapper, as your user, run:"
+       elog "  colorcfg [1|2|3]"
+       elog "to add relevant environment variables to your ~/.bash_profile"
+       elog "Run colorcfg without options to see what [1|2|3] means."
+       elog
+       elog "After sourcing your ~/.bash_profile, commands for which 
definitions"
+       elog "are provided should have colored output."
+       elog
+       elog "To enable/disable colored output, run: 'colors [on|off]'."
+}

diff --git a/app-misc/cw/files/cw-1.0.16-replace-isastream-with-fcntl.patch 
b/app-misc/cw/files/cw-1.0.16-replace-isastream-with-fcntl.patch
new file mode 100644
index 000000000000..18f2dba953d2
--- /dev/null
+++ b/app-misc/cw/files/cw-1.0.16-replace-isastream-with-fcntl.patch
@@ -0,0 +1,20 @@
+--- /var/tmp/portage/app-misc/cw-1.0.16-r3/work/cw-1.0.16/src/cw.c
++++ cw-1.0.16/src/cw.c
+@@ -1173,7 +1173,7 @@
+   close(master);
+   return(0);
+  }
+- if(isastream(slave)){
++ if(fcntl(slave,F_GETFD) < 0){
+   if(ioctl(slave,I_PUSH,"ptem")<0||ioctl(slave,I_PUSH,"ldterm")<0){
+    close(master);
+    close(slave);
+@@ -1211,7 +1211,7 @@
+   close(master);
+   return(0);
+  }
+- if(isastream(slave)){
++ if(fcntl(slave,F_GETFD) < 0){
+   if(ioctl(slave,I_PUSH,"ptem")<0||ioctl(slave,I_PUSH,"ldterm")<0){
+    close(master);
+    close(slave);

Reply via email to