Wednesday, January 18, 2023

Re: [NEW] x11/grabc

Hello,

On 2023/01/15 20:11:33 +0100, Mattia Chiozzi <mattia@chiozzi.cc> wrote:
> Hi,
> I tried to make a port for grabc (https://github.com/muquit/grabc).
>
> I added the pledge() system call as a patch. I tested it against all the flag
> options and it shouldn't break anything.

almost perfect ;)

- mandir was slightly wrong and ended up installing the manpage in
/usr/local/man/grabc.1 insteaf of man/man1/grabc.1

- you can avoid patching the Makefile by adding CFLAGS to MAKE_FLAGS

Then I took the liberty of tweaking the pledge patch. It's a bummer
that it needs "rpath prot_exec" just for XCreateGlyphCursor (it
dlopens libXcursor.so). it seems that it's unavoidable to dlopen
Xcursor on demand (see xenocara/lib/libX11/src/CrGlCur.c open_library)

more for fun than for anything, i've added a call to get_cross_cursor
which ends up calling XCreateGlyphCursor and loading libXcursor right
after XOpenDisplay, so that we can pledge("stdio") after that.

Anyway, here's a diff against your makefile and I'm reattaching the
port, that's ok op@ to import. It's a simple little utility and it's
probably easier / simpler than stuff like gcolor2 that I use sometime.

--- Makefile.orig Wed Jan 18 13:17:19 2023
+++ Makefile Wed Jan 18 15:19:01 2023
@@ -9,13 +9,14 @@
MAINTAINER = Mattia Chiozzi <mattia@chiozzi.cc>

# MIT
-PERMIT_PACKAGE = yes
+PERMIT_PACKAGE = Yes

# uses pledge()
WANTLIB += X11 c

-FAKE_FLAGS = mandir="${TRUEPREFIX}/man"
+MAKE_FLAGS += CFLAGS="${CFLAGS} -I${X11BASE}/include"
+FAKE_FLAGS = mandir="${TRUEPREFIX}/man/man1"

NO_TEST = yes

-.include <bsd.port.mk>
+.include <bsd.port.mk>

No comments:

Post a Comment