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
This commit is contained in:
Alexey Dokuchaev 2023-12-19 06:31:00 +00:00
parent 2536ac1d76
commit 6b15ccae94
4 changed files with 45 additions and 40 deletions

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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).