summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-misc/cw')
-rw-r--r--app-misc/cw/cw-1.0.16-r3.ebuild4
-rw-r--r--app-misc/cw/cw-1.0.16-r5.ebuild80
-rw-r--r--app-misc/cw/files/cw-1.0.16-Respect-CPPFLAGS.patch21
-rw-r--r--app-misc/cw/files/cw-1.0.16-fix-configure-for-newer-autotools.patch10
-rw-r--r--app-misc/cw/files/cw-1.0.16-replace-isastream-with-fcntl.patch20
5 files changed, 133 insertions, 2 deletions
diff --git a/app-misc/cw/cw-1.0.16-r3.ebuild b/app-misc/cw/cw-1.0.16-r3.ebuild
index 3a0b86621c4a..edce7bf53157 100644
--- a/app-misc/cw/cw-1.0.16-r3.ebuild
+++ b/app-misc/cw/cw-1.0.16-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -7,7 +7,7 @@ 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"
+SRC_URI="https://downloads.sourceforge.net/cwrapper/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
diff --git a/app-misc/cw/cw-1.0.16-r5.ebuild b/app-misc/cw/cw-1.0.16-r5.ebuild
new file mode 100644
index 000000000000..aff93ae20c07
--- /dev/null
+++ b/app-misc/cw/cw-1.0.16-r5.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+WANT_AUTOMAKE="none"
+inherit autotools flag-o-matic toolchain-funcs
+
+DESCRIPTION="A non-intrusive real-time ANSI color wrapper for common unix-based commands"
+HOMEPAGE="http://cwrapper.sourceforge.net"
+SRC_URI="https://downloads.sourceforge.net/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
+ "${FILESDIR}"/${P}-fix-configure-for-newer-autotools.patch
+ "${FILESDIR}"/${P}-Respect-CPPFLAGS.patch
+)
+
+src_prepare() {
+ default
+
+ gunzip "${S}"/man/*.gz || die
+
+ eautoreconf
+}
+
+src_configure() {
+ tc-export CC
+
+ append-cppflags -D_GNU_SOURCE
+
+ 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 # >/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-Respect-CPPFLAGS.patch b/app-misc/cw/files/cw-1.0.16-Respect-CPPFLAGS.patch
new file mode 100644
index 000000000000..b1ae96daf4a4
--- /dev/null
+++ b/app-misc/cw/files/cw-1.0.16-Respect-CPPFLAGS.patch
@@ -0,0 +1,21 @@
+From 64249a5b7e2aaa4b53e41deb767a164cf5b68421 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Thu, 20 Oct 2022 04:48:48 +0100
+Subject: [PATCH] Respect CPPFLAGS
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -19,11 +19,11 @@ all:
+
+ cw:
+ @$(ECHO) "* Compiling cw(color wrapper)..."
+- $(CC) $(CFLAGS) $(LDFLAGS) src/cw.c -o bin/cw @CFLAGS@ @LIBS@ @DEFS@
++ $(CC) $(CPPFLAGS) @DEFS@ $(CFLAGS) @CFLAGS@ $(LDFLAGS) src/cw.c -o bin/cw @LIBS@
+
+ cwu:
+ @$(ECHO) "* Compiling cwu(color wrapper directive updater)..."
+- $(CC) $(CFLAGS) $(LDFLAGS) src/cwu.c -o bin/cwu
++ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) src/cwu.c -o bin/cwu
+
+ local: cw cwu
+
diff --git a/app-misc/cw/files/cw-1.0.16-fix-configure-for-newer-autotools.patch b/app-misc/cw/files/cw-1.0.16-fix-configure-for-newer-autotools.patch
new file mode 100644
index 000000000000..038e30074371
--- /dev/null
+++ b/app-misc/cw/files/cw-1.0.16-fix-configure-for-newer-autotools.patch
@@ -0,0 +1,10 @@
+--- a/configure.in
++++ b/configure.in
+@@ -17,7 +17,6 @@ ORIG_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wall"
+ AC_TRY_COMPILE(,[return 0;],AC_MSG_RESULT(yes),AC_MSG_RESULT(no);CFLAGS="$ORIG_CFLAGS")
+ AC_CONFIG_HEADER(config.h)
+-AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_LIB(util, openpty)
+ AC_CHECK_FILE("/dev/ptmx", AC_DEFINE(HAVE_DEV_PTMX, 1, Have /dev/ptmx.))
+ AC_CHECK_FUNCS(getpt isatty isxdigit openpty putenv regcomp setenv setproctitle setsid sigaction sscanf uname unsetenv vsnprintf waitpid)
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..978c23bb9b71
--- /dev/null
+++ b/app-misc/cw/files/cw-1.0.16-replace-isastream-with-fcntl.patch
@@ -0,0 +1,20 @@
+--- a/src/cw.c
++++ b/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);