On Sat, 10 May 2025 19:04:11 +0000
Lucas Gabriel Vuotto <lu...@sexy.is> wrote:

> On Sat, May 10, 2025 at 12:53:44PM -0500, izzy Meyer wrote:
> > Ended up just patching the file for simplicity.
> 
> I tend to avoid patching as much as possible, but to each one their
> own. You're the maintainer anyways.

This might make maintaining easier, but I couldn't get the -D flag in
CFLAGS to apply correctly when setting REBOOT_CMD to "/sbin/shutdown -r
now" in CFLAGS with -D. I must be missing something here:

===>  Building for emwm-utils-1.3p0
cc -O2 -pipe   -DUNPRIVILEGED_SHUTDOWN  -DREBOOT_CMD='/sbin/shutdown -r
now'  -I./Xm -I/usr/X11R6/include -I/usr/local/include  -c smmain.c
smmain.c:1546:13: error: expected expression command = REBOOT_CMD;
                          ^
<command line>:3:20: note: expanded from macro 'REBOOT_CMD'
#define REBOOT_CMD /sbin/shutdown -r now
                   ^
smmain.c:1546:13: error: use of undeclared identifier 'sbin'
<command line>:3:21: note: expanded from macro 'REBOOT_CMD'
#define REBOOT_CMD /sbin/shutdown -r now
                    ^
smmain.c:1546:13: error: use of undeclared identifier 'shutdown'; did
you mean 'wshutdown'? <command line>:3:26: note: expanded from macro
'REBOOT_CMD' #define REBOOT_CMD /sbin/shutdown -r now
                         ^
smmain.c:1360:16: note: 'wshutdown' declared here
        static Widget wshutdown;
                      ^
smmain.c:1546:13: error: use of undeclared identifier 'r'
                command = REBOOT_CMD;
                          ^
<command line>:3:36: note: expanded from macro 'REBOOT_CMD'
#define REBOOT_CMD /sbin/shutdown -r now
                                   ^
4 errors generated.
*** Error 1 in src (<sys.mk>:87 'smmain.o')
*** Error 2 in /usr/ports/pobj/emwm-utils-1.3/emwm-utils-src-1.3
(Makefile:13 'all': @if [ -e src/Makefile ]; then  make -C src
CFLAGS=-O2\...) *** Error 2 in .
(/usr/ports/infrastructure/mk/bsd.port.mk:3069
'/usr/ports/pobj/emwm-utils-1.3/.build_done': @cd
/usr/ports/pobj/emwm-utils...) *** Error 2 in /usr/ports/x11/emwm-utils
(/usr/ports/infrastructure/mk/bsd.port.mk:2712 'all':
@lock=emwm-utils-1.3p0;  export _LOCKS_HELD="...)

It seems it is not wrapping it as a string in the #define macro.
However, doing it in MAKE_ENV seems to work AOK, so I suppose I'll
stick with this method. Is this "correct"?

> > diff --git a/x11/emwm-utils/Makefile b/x11/emwm-utils/Makefile
> > index 0d8b6ba9f61..6a5e5822b36 100644
> > --- a/x11/emwm-utils/Makefile
> > +++ b/x11/emwm-utils/Makefile
> > @@ -3,6 +3,7 @@ COMMENT =   session manager and a
> > toolchest-like application launcher V =             1.3
> >  DISTNAME = emwm-utils-src-${V}
> >  PKGNAME =  emwm-utils-${V}
> > +REVISION = 0
> >  
> >  CATEGORIES =       x11
> >  HOMEPAGE = https://fastestcode.org/emwm.html
> > @@ -20,7 +21,8 @@ WANTLIB += X11 Xinerama Xm Xrandr Xss Xt c
> >  LIB_DEPENDS =      x11/motif
> >  
> >  MAKE_FLAGS =       RCDIR=${PREFIX}/lib/X11 \
> > -           CFLAGS="${CFLAGS} -I./Xm -I${X11BASE}/include
> > -I${LOCALBASE}/include"
> > +           CFLAGS="${CFLAGS} -DUNPRIVILEGED_SHUTDOWN \
> > +                   -I./Xm -I${X11BASE}/include
> > -I${LOCALBASE}/include" 
> >  FAKE_FLAGS =       PREFIX=${WRKINST}${PREFIX} \
> >             APPLRESDIR=${WRKINST}${PREFIX}/lib/X11/app-defaults
> > \ diff --git a/x11/emwm-utils/patches/patch-src_smconf_h
> > b/x11/emwm-utils/patches/patch-src_smconf_h new file mode 100644
> > index 00000000000..fdb4703c05e
> > --- /dev/null
> > +++ b/x11/emwm-utils/patches/patch-src_smconf_h
> > @@ -0,0 +1,12 @@
> > +Index: src/smconf.h
> > +--- src/smconf.h.orig
> > ++++ src/smconf.h
> > +@@ -33,7 +33,7 @@
> > + #endif /* SHUTDOWN_CMD */
> > + 
> > + #ifndef REBOOT_CMD
> > +-#define REBOOT_CMD      "/sbin/reboot"
> > ++#define REBOOT_CMD      "/sbin/shutdown -r now"
> > + #endif
> > + 
> > + #ifndef SUSPEND_CMD
> > diff --git a/x11/emwm-utils/pkg/PLIST b/x11/emwm-utils/pkg/PLIST
> > index 763b5a0e51f..36f96dc0494 100644
> > --- a/x11/emwm-utils/pkg/PLIST
> > +++ b/x11/emwm-utils/pkg/PLIST
> > @@ -10,3 +10,4 @@ lib/X11/app-defaults/XmToolbox
> >  lib/X11/toolboxrc
> >  @man man/man1/xmsm.1
> >  @man man/man1/xmtoolbox.1
> > +share/doc/pkg-readmes/${PKGSTEM}
> > diff --git a/x11/emwm-utils/pkg/README b/x11/emwm-utils/pkg/README
> > new file mode 100644
> > index 00000000000..4739779dd22
> > --- /dev/null
> > +++ b/x11/emwm-utils/pkg/README
> > @@ -0,0 +1,12 @@
> > ++-------------------------------------------------------------------------------
> > +| Running ${PKGSTEM} on OpenBSD
> > ++-------------------------------------------------------------------------------
> > +
> > +This package is not installed with SUID root. You can ignore any
> > warnings about +lacking SUID root.
> > +
> > +- To enable shutdown/reboot access, the user should be in the
> > _shutdown group. +- To enable suspend access, apmd(8) should be
> > running. +
> > +Use usermod(8) to add your user to the _shutdown group.
> > +Use rcctl(8) to enable apmd(8).
> 
> What do you think of:
> 
> ---- 8< ----
> 
> This package is not installed with SUID root; warnings about lacking
> SUID root can be ignored.
> 
> - To enable shutdown and reboot, the user should be in _shutdown
> group.
> - To enable suspend, the user needs to be able to run zzz(8).
> 
> Use usermod(8) to add the user to _shutdown group.
> Enable apmd(8) and check zzz(8) for details about the required
> permissions.
> 
> ---- >8 ----
> 
> The main differences are no use of "you" (we tend to avoid second
> person in documentation) and reworked explanation of suspend. In
> particular, I think it's important to point out that what's really
> needed is that zzz works when run by the user, not only running
> apmd(8). For example, if the user wasn't set up by the installer,
> then there is a big chance that the user isn't part of wheel group,
> which is what makes using apm(8) work "by default" in most cases.

I like this, actually. I re-worked it to include your re-phrasing.
Knowing the reason behind something (the "why") rather than the just
the "what" with no further explanation gives me a warm fuzzy feeling.
I'm sure other users are this way too. 

Not related to this port, just curious, but why refrain from using
second-person in documentation? Is it just to be less passive? I
suppose its a bit more assertive, but I wonder if there is a technical
reason.

Thanks for all the feedback, Lucas. Diff is attached. I'm happy with
this, could you commit?

Appreciated.

-- 
iz (she/her)

> i like to say mundane things,
> there are too many uninteresting things
> that go unnoticed.

izder456 (dot) neocities (dot) org
diff --git a/x11/emwm-utils/Makefile b/x11/emwm-utils/Makefile
index 0d8b6ba9f61..ebeee4d5624 100644
--- a/x11/emwm-utils/Makefile
+++ b/x11/emwm-utils/Makefile
@@ -3,6 +3,7 @@ COMMENT =	session manager and a toolchest-like application launcher
 V =		1.3
 DISTNAME =	emwm-utils-src-${V}
 PKGNAME =	emwm-utils-${V}
+REVISION =	0
 
 CATEGORIES =	x11
 HOMEPAGE =	https://fastestcode.org/emwm.html
@@ -19,8 +20,11 @@ WANTLIB += X11 Xinerama Xm Xrandr Xss Xt c
 
 LIB_DEPENDS =	x11/motif
 
+MAKE_ENV =	REBOOT_CMD="/sbin/shutdown -r now"
+
 MAKE_FLAGS =	RCDIR=${PREFIX}/lib/X11 \
-		CFLAGS="${CFLAGS} -I./Xm -I${X11BASE}/include -I${LOCALBASE}/include"
+		CFLAGS="${CFLAGS} -DUNPRIVILEGED_SHUTDOWN \
+			-I./Xm -I${X11BASE}/include -I${LOCALBASE}/include"
 
 FAKE_FLAGS =	PREFIX=${WRKINST}${PREFIX} \
 		APPLRESDIR=${WRKINST}${PREFIX}/lib/X11/app-defaults \
diff --git a/x11/emwm-utils/pkg/PLIST b/x11/emwm-utils/pkg/PLIST
index 763b5a0e51f..36f96dc0494 100644
--- a/x11/emwm-utils/pkg/PLIST
+++ b/x11/emwm-utils/pkg/PLIST
@@ -10,3 +10,4 @@ lib/X11/app-defaults/XmToolbox
 lib/X11/toolboxrc
 @man man/man1/xmsm.1
 @man man/man1/xmtoolbox.1
+share/doc/pkg-readmes/${PKGSTEM}
diff --git a/x11/emwm-utils/pkg/README b/x11/emwm-utils/pkg/README
new file mode 100644
index 00000000000..60fed1ccd98
--- /dev/null
+++ b/x11/emwm-utils/pkg/README
@@ -0,0 +1,12 @@
++-------------------------------------------------------------------------------
+| Running ${PKGSTEM} on OpenBSD
++-------------------------------------------------------------------------------
+
+This package is not installed with SUID root; warnings about lacking SUID root
+can be ignored.
+
+- To enable shutdown and reboot, the user should be in _shutdown group.
+- To enable suspend, the user needs to be able to run zzz(8).
+
+Use usermod(8) to add the user to _shutdown group.
+Enable apmd(8) and check zzz(8) for details about the required permissions.

Reply via email to