git: 6b15ccae94be - main - x11-wm/obpager: modernize, undeprecate, take maintainership

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Tue, 19 Dec 2023 06:31:51 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6b15ccae94be4fb9d2dfd14f4546f2e65d6e4ab9

commit 6b15ccae94be4fb9d2dfd14f4546f2e65d6e4ab9
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2023-12-19 06:31:00 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2023-12-19 06:31:00 +0000

    x11-wm/obpager: modernize, undeprecate, take maintainership
    
    - Avoid C++11 narrowing issue altogether by not truncating
      displayed workspace numbers so long they fit 4-char buffer
    - Convert GNU sed(1) to more standard extended regex syntax
    - Clean up the Makefile patch; nuke ugly `post-patch' target
    - Adjust LICENSE (GPLv2 or later), unfold description text
---
 x11-wm/obpager/Makefile                   | 25 ++++---------------------
 x11-wm/obpager/files/patch-Makefile       | 30 ++++++++++++++++++------------
 x11-wm/obpager/files/patch-src_OBPager.cc | 19 +++++++++++++++++++
 x11-wm/obpager/pkg-descr                  | 11 ++++-------
 4 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/x11-wm/obpager/Makefile b/x11-wm/obpager/Makefile
index a401a9d7c676..2bdbd7c7db39 100644
--- a/x11-wm/obpager/Makefile
+++ b/x11-wm/obpager/Makefile
@@ -3,35 +3,18 @@ PORTVERSION=	1.8
 CATEGORIES=	x11-wm
 MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}
 
-MAINTAINER=	ports@FreeBSD.org
-COMMENT=	Lightweight pager for netwm compatible window managers
+MAINTAINER=	danfe@FreeBSD.org
+COMMENT=	Lightweight pager for NetWM-compliant window managers
 WWW=		https://obpager.sourceforge.net/
 
-LICENSE=	GPLv2
+LICENSE=	GPLv2+
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-DEPRECATED=	Last upstream release was in 2004
-EXPIRATION_DATE=	2024-01-18
-
-BUILD_DEPENDS=	gsed:textproc/gsed
-
-USES=		compiler gmake xorg
-USE_CXXSTD=	c++14
+USES=		gmake xorg
 USE_XORG=	x11 xext
 
-MAKE_ARGS=	CDEFS="${CXXFLAGS}"
-
-CXXFLAGS+=	${CXXFLAGS_${CHOSEN_COMPILER_TYPE}}
-CXXFLAGS_clang=	-Wno-c++11-narrowing
-
 PLIST_FILES=	bin/${PORTNAME}
 
-post-patch:
-	${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g; \
-	    s|%%LOCALBASE%%|${LOCALBASE}|g; \
-	    s|%%CXX%%|${CXX}|g; \
-	    s|sed|gsed|g' ${WRKSRC}/Makefile
-
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
 
diff --git a/x11-wm/obpager/files/patch-Makefile b/x11-wm/obpager/files/patch-Makefile
index 1aa3adfe8db6..19d2332a52ef 100644
--- a/x11-wm/obpager/files/patch-Makefile
+++ b/x11-wm/obpager/files/patch-Makefile
@@ -1,25 +1,31 @@
 --- Makefile.orig	2004-09-01 14:23:44 UTC
 +++ Makefile
-@@ -7,18 +7,18 @@ DEPDIR = ./deps
- 
- 
- # Set the install directory for the executable
--INSTALLDIR = /usr/local/bin
-+INSTALLDIR = %%PREFIX%%/bin
+@@ -11,14 +11,13 @@ INSTALLDIR = /usr/local/bin
  
  
  # Set the compilation flags and such
 -CXX = g++
-+CXX = %%CXX%%
- CDEFS = -D_REENTRANT
- CPPFLAGS = -ggdb -Wall
- #CPPFLAGS = -ggdb -Wall -O2
+-CDEFS = -D_REENTRANT
+-CPPFLAGS = -ggdb -Wall
+-#CPPFLAGS = -ggdb -Wall -O2
 -INCLUDES = -I/usr/X11R6/include/X11 -I/usr/X11R6/include/X11/extensions -I./src
-+INCLUDES = -I%%LOCALBASE%%/include -I%%LOCALBASE%%/include/X11 -I%%LOCALBASE%%/include/X11/extensions -I./src
++CXX ?= g++
++CDEFS = $(CXXFLAGS)
++CPPFLAGS = -D_REENTRANT
++INCLUDES = -I$(LOCALBASE)/include -I$(LOCALBASE)/include/X11 -I$(LOCALBASE)/include/X11/extensions
  COMPILE = $(CXX) $(CDEFS) $(INCLUDES) $(CPPFLAGS)
  LINK = $(CXX) $(LDFLAGS) $(LDLIBS)
 -LDLIBS = -L/usr/X11R6/lib  -lX11 -lXext
-+LDLIBS = -L%%LOCALBASE%%/lib  -lX11 -lXext
++LDLIBS = -L$(LOCALBASE)/lib -lX11 -lXext
+ 
  
  
+@@ -89,7 +88,7 @@ $(OBJDIR)/%.o : %.cc
+ 	mkdir $(DEPDIR) 2>/dev/null ; mkdir $(DEPDIR)/src 2>/dev/null ; \
+ 	$(COMPILE) -MMD -o $@ -c $< ; \
+ 	cp $(OBJDIR)/$*.d $(DEPDIR)/$*.d ; \
+-	sed -s -e 's/^[^:]\+: *//' -e 's/ *\\$$//' -e 's/^ *//' -e 's/ \+/ :\n/g' -e 's/$$/ :/' < $(OBJDIR)/$*.d >> $(DEPDIR)/$*.d ; \
++	sed -E -e 's/^[^:]+: *//' -e 's/ *\\$$//' -e 's/^ *//' -e 's/ +/ :\n/g' -e 's/$$/ :/' < $(OBJDIR)/$*.d >> $(DEPDIR)/$*.d ; \
+ 	rm -f $(OBJDIR)/$*.d
+ 	
  
diff --git a/x11-wm/obpager/files/patch-src_OBPager.cc b/x11-wm/obpager/files/patch-src_OBPager.cc
index 1d74eab310fb..e77791561181 100644
--- a/x11-wm/obpager/files/patch-src_OBPager.cc
+++ b/x11-wm/obpager/files/patch-src_OBPager.cc
@@ -18,3 +18,22 @@
  	unsigned long borderColour = BlackPixel(mDisplay(), mScreenNum);
  	unsigned long backgroundColour = BlackPixel(mDisplay(), mScreenNum);
  	
+@@ -397,7 +397,7 @@ void OBPager::createShowWindow()
+ 	
+ 	// First, get the mask as an XBM, and hold it in an auto_ptr so it gets disposed when we exit this block
+ 	
+-	std::auto_ptr<unsigned char> pixmaskBits(getRectangularXBMMask(width, height, APPLET_MARGIN_WIDTH));
++	std::unique_ptr<unsigned char> pixmaskBits(getRectangularXBMMask(width, height, APPLET_MARGIN_WIDTH));
+ 	
+ 	// Next, create the pixmap using the XBM mask
+ 	
+@@ -934,7 +934,8 @@ void OBPager::redrawWindow()
+ 	
+ 	// Draw the desktop number using the appropriate font
+ 	
+-	char text[2] = { (mDesktopNum % 9) + '1', '\0' };
++	char text[4];
++	snprintf(text, sizeof text, "%d", mDesktopNum + 1);
+ 	int textLength = strlen(text);
+ 	int textWidth, textHeight;
+ 	int direction, ascent, descent;
diff --git a/x11-wm/obpager/pkg-descr b/x11-wm/obpager/pkg-descr
index 5a21880c46e9..efe85ef995f3 100644
--- a/x11-wm/obpager/pkg-descr
+++ b/x11-wm/obpager/pkg-descr
@@ -1,8 +1,5 @@
-OBPager is a lightweight pager designed
-to be used with NetWM-compliant window
-managers like OpenBox.
+OBPager is a lightweight pager designed to be used with NetWM-compliant
+window managers like Openbox.
 
-Unlike many other pagers out there,
-OBPager has very few dependencies,
-requiring only Xlib and glibc++
-(no Gnome or KDE necessary).
+Unlike many other pagers out there, OBPager has very few dependencies,
+requiring only Xlib and glibc++ (no Gnome or KDE necessary).