pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

rio: fix shell detection, terminfo, man pages, options framework



Module Name:	pkgsrc-wip
Committed By:	ci4ic4 <ci4ic4%gmail.com@localhost>
Pushed By:	ci4ic4
Date:		Sun May 24 22:30:08 2026 +0100
Changeset:	c7525d45f11db102da0b33ab6785820d3be33dec

Modified Files:
	rio/Makefile
	rio/PLIST
	rio/distinfo
	rio/patches/patch-misc_rio.desktop
	rio/patches/patch-teletypewriter_src_unix_mod.rs
Added Files:
	rio/options.mk
	rio/patches/patch-misc_rio.terminfo
	rio/patches/patch-rio-backend_src_config_defaults.rs

Log Message:
rio: fix shell detection, terminfo, man pages, options framework

- patch-teletypewriter_src_unix_mod.rs: add NetBSD shell override so rio
  starts the shell from /etc/passwd rather than inheriting $SHELL=/bin/ksh
  from the display manager; also fix use-spawn on NetBSD so --login arg
  is passed (patch-rio-backend_src_config_defaults.rs)
- patch-misc_rio.terminfo: remove the "rio" entry; ncurses already ships
  share/terminfo/r/rio, compiling it here caused a pkg_add PLIST conflict;
  tic now produces only rio+base and xterm-rio (unique to this package)
- options.mk: new file; add "man" option (on by default) to build rio.1,
  rio.5, rio-bindings.5 from scdoc source in extra/man/
- Makefile: INSTALLATION_DIRS+= (not =) so options.mk additions are kept;
  add man/man1 and man/man5 dirs via options.mk; run tic for terminfo;
  conditional scdoc installs guarded by !empty(PKG_OPTIONS:Mman)
- PLIST: use ${PLIST.man} token for conditional man page entries;
  track share/terminfo/r/rio+base and share/terminfo/x/xterm-rio only
- patch-misc_rio.desktop: set TERMINFO_DIRS=@PREFIX@/share/terminfo and
  EGL_LOG_LEVEL=fatal in Exec lines; PREFIX substituted via SUBST block
- distinfo: regenerate for all new and updated patches

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c7525d45f11db102da0b33ab6785820d3be33dec

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 rio/Makefile                                       | 27 +++++++++++++++++--
 rio/PLIST                                          |  5 ++++
 rio/distinfo                                       |  6 +++--
 rio/options.mk                                     | 16 ++++++++++++
 rio/patches/patch-misc_rio.desktop                 | 11 ++++----
 rio/patches/patch-misc_rio.terminfo                | 30 ++++++++++++++++++++++
 .../patch-rio-backend_src_config_defaults.rs       | 24 +++++++++++++++++
 rio/patches/patch-teletypewriter_src_unix_mod.rs   | 19 ++++++++++++++
 8 files changed, 129 insertions(+), 9 deletions(-)

diffs:
diff --git a/rio/Makefile b/rio/Makefile
index 8f21752c1b..d0dc383bf1 100644
--- a/rio/Makefile
+++ b/rio/Makefile
@@ -25,6 +25,8 @@ USE_LANGUAGES=	c c++
 
 USE_TOOLS+=	pkg-config
 
+.include "options.mk"
+
 # Force pkg-config to see only buildlink'd .pc files so fontconfig-sys picks
 # up pkgsrc's libfontconfig.so.1 instead of X11R7's .so.2.
 PKGSRC_MAKE_ENV+=	PKG_CONFIG_LIBDIR=${BUILDLINK_DIR}/lib/pkgconfig
@@ -35,9 +37,18 @@ RUSTFLAGS+=	-C link-arg=-Wl,-rpath,/usr/X11R7/lib
 
 ICON_THEMES=	yes
 
-INSTALLATION_DIRS=	bin \
+# Substitute PREFIX into the .desktop Exec line so TERMINFO_DIRS points to
+# the installed terminfo directory at runtime.
+SUBST_CLASSES+=			terminfo-dirs
+SUBST_STAGE.terminfo-dirs=	post-patch
+SUBST_FILES.terminfo-dirs=	misc/rio.desktop
+SUBST_VARS.terminfo-dirs=	PREFIX
+
+INSTALLATION_DIRS+=	bin \
 			share/applications \
-			share/icons/hicolor/scalable/apps
+			share/icons/hicolor/scalable/apps \
+			share/terminfo
+
 
 # Patch vendor crates to enable wgpu GLES backend on NetBSD.
 #
@@ -82,6 +93,18 @@ do-install:
 		${DESTDIR}${PREFIX}/share/applications/rio.desktop
 	${INSTALL_DATA} ${WRKSRC}/misc/logo.svg \
 		${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/rio.svg
+	# Install terminfo so programs inside rio recognise TERM=xterm-rio.
+	${LOCALBASE}/bin/tic -x -o ${DESTDIR}${PREFIX}/share/terminfo \
+		${WRKSRC}/misc/rio.terminfo
+.if !empty(PKG_OPTIONS:Mman)
+	# Build and install man pages from scdoc source in extra/man/.
+	${SCDOC} < ${WRKSRC}/extra/man/rio.1.scd > \
+		${DESTDIR}${PREFIX}/man/man1/rio.1
+	${SCDOC} < ${WRKSRC}/extra/man/rio.5.scd > \
+		${DESTDIR}${PREFIX}/man/man5/rio.5
+	${SCDOC} < ${WRKSRC}/extra/man/rio-bindings.5.scd > \
+		${DESTDIR}${PREFIX}/man/man5/rio-bindings.5
+.endif
 
 .include "cargo-depends.mk"
 
diff --git a/rio/PLIST b/rio/PLIST
index 303fdb5083..e20391352c 100644
--- a/rio/PLIST
+++ b/rio/PLIST
@@ -2,3 +2,8 @@
 bin/rio
 share/applications/rio.desktop
 share/icons/hicolor/scalable/apps/rio.svg
+share/terminfo/r/rio+base
+share/terminfo/x/xterm-rio
+${PLIST.man}man/man1/rio.1
+${PLIST.man}man/man5/rio-bindings.5
+${PLIST.man}man/man5/rio.5
diff --git a/rio/distinfo b/rio/distinfo
index bd600d3521..907d0fbfff 100644
--- a/rio/distinfo
+++ b/rio/distinfo
@@ -1984,5 +1984,7 @@ BLAKE2s (zvariant_utils-2.1.0.crate) = b142d63425365aedf109bafac551bf52a32897836
 SHA512 (zvariant_utils-2.1.0.crate) = 345b70d1106b37df41426efdb1ba49bf270e00898381c2a8021b5761c59efdea55def45cb2e2598b130b6cba8733503f3997a55578bca90867ab3e8f2346f80e
 Size (zvariant_utils-2.1.0.crate) = 7043 bytes
 SHA1 (patch-corcovado_src_sys_unix_kqueue.rs) = c5a2374e7c057de0ce4fc17601eb5b764aff1d16
-SHA1 (patch-misc_rio.desktop) = d8387842ecc07b2736dbdef5aeaa58e05be095fc
-SHA1 (patch-teletypewriter_src_unix_mod.rs) = cbd68c55a6442743840f1608d297a951c863f4e3
+SHA1 (patch-misc_rio.desktop) = 655e7c74c047fa5f56f236a43a41537f05e839d6
+SHA1 (patch-misc_rio.terminfo) = 02f01e059fb12abca4afa19663f113aad2660c38
+SHA1 (patch-rio-backend_src_config_defaults.rs) = bdeff9740019828df6a6c9b14102ecd910deac11
+SHA1 (patch-teletypewriter_src_unix_mod.rs) = b536464928c784ada680aacf8dffafb0be86f634
diff --git a/rio/options.mk b/rio/options.mk
new file mode 100644
index 0000000000..5599912c85
--- /dev/null
+++ b/rio/options.mk
@@ -0,0 +1,16 @@
+# $NetBSD$
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.rio
+PKG_SUPPORTED_OPTIONS=	man
+PKG_SUGGESTED_OPTIONS=	man
+
+.include "../../mk/bsd.options.mk"
+
+PLIST_VARS+=	man
+
+.if !empty(PKG_OPTIONS:Mman)
+PLIST.man=		yes
+BUILD_DEPENDS+=		scdoc>=1.11.0:../../textproc/scdoc
+SCDOC=			${LOCALBASE}/bin/scdoc
+INSTALLATION_DIRS+=	man/man1 man/man5
+.endif
diff --git a/rio/patches/patch-misc_rio.desktop b/rio/patches/patch-misc_rio.desktop
index 5838321e08..016bc008ad 100644
--- a/rio/patches/patch-misc_rio.desktop
+++ b/rio/patches/patch-misc_rio.desktop
@@ -1,8 +1,9 @@
 $NetBSD$
 
-Wrap Exec with env EGL_LOG_LEVEL=fatal to suppress the harmless Mesa DRI2
-authentication warning that appears on systems using software EGL (e.g. VMs
-without a DRI2-capable X driver).
+Wrap Exec with env to:
+- suppress the harmless Mesa DRI2 authentication warning on software EGL
+- set TERMINFO_DIRS so rio and programs running inside it find the rio
+  terminfo entry installed by this package under @PREFIX@/share/terminfo
 
 --- misc/rio.desktop.orig
 +++ misc/rio.desktop
@@ -11,7 +12,7 @@ without a DRI2-capable X driver).
  Type=Application
  TryExec=rio
 -Exec=rio
-+Exec=env EGL_LOG_LEVEL=fatal rio
++Exec=env EGL_LOG_LEVEL=fatal TERMINFO_DIRS=@PREFIX@/share/terminfo rio
  Icon=rio
  Terminal=false
  Categories=System;TerminalEmulator;
@@ -20,4 +21,4 @@ without a DRI2-capable X driver).
  [Desktop Action New]
  Name=New Terminal
 -Exec=rio
-+Exec=env EGL_LOG_LEVEL=fatal rio
++Exec=env EGL_LOG_LEVEL=fatal TERMINFO_DIRS=@PREFIX@/share/terminfo rio
diff --git a/rio/patches/patch-misc_rio.terminfo b/rio/patches/patch-misc_rio.terminfo
new file mode 100644
index 0000000000..338e2a6f2d
--- /dev/null
+++ b/rio/patches/patch-misc_rio.terminfo
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Remove the "rio" terminfo entry from the source.  pkgsrc ncurses already
+ships share/terminfo/r/rio (and rio-direct); compiling it here would cause
+a PLIST conflict at pkg_add time.  The rio+base and xterm-rio entries are
+unique to this package and are compiled normally.
+
+--- misc/rio.terminfo.orig
++++ misc/rio.terminfo
+@@ -1,20 +1,6 @@
+ xterm-rio,
+     use=rio+base,
+ 
+-rio,
+-    use=xterm-rio,
+-    rs1=\Ec\E]104\007,
+-    ccc,
+-    colors#0x100, pairs#0x7FFF,
+-    initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*
+-          %{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
+-    oc=\E]104\007,
+-    setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;
+-          5;%p1%d%;m,
+-    setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5
+-          ;%p1%d%;m,
+-    setb@, setf@,
+-
+ rio+base,
+     OTbs, am, bce, km, mir, msgr, xenl, AX, XT,
+     colors#8, cols#80, it#8, lines#24, pairs#64,
diff --git a/rio/patches/patch-rio-backend_src_config_defaults.rs b/rio/patches/patch-rio-backend_src_config_defaults.rs
new file mode 100644
index 0000000000..18d5d3179e
--- /dev/null
+++ b/rio/patches/patch-rio-backend_src_config_defaults.rs
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Use spawn (not fork) on NetBSD to ensure configured shell args (e.g.
+--login) are actually passed when launching the PTY shell.  The fork path
+(create_pty_with_fork) never forwards args to execvp; the spawn path
+(create_pty_with_spawn) does.  macOS already uses spawn for the same reason.
+
+--- rio-backend/src/config/defaults.rs.orig
++++ rio-backend/src/config/defaults.rs
+@@ -60,11 +60,11 @@
+ 
+ #[inline]
+ pub fn default_use_fork() -> bool {
+-    #[cfg(target_os = "macos")]
++    #[cfg(any(target_os = "macos", target_os = "netbsd"))]
+     {
+         false
+     }
+ 
+-    #[cfg(not(target_os = "macos"))]
++    #[cfg(not(any(target_os = "macos", target_os = "netbsd")))]
+     {
+         true
+     }
diff --git a/rio/patches/patch-teletypewriter_src_unix_mod.rs b/rio/patches/patch-teletypewriter_src_unix_mod.rs
index f7d6d32049..67bd7a9cc5 100644
--- a/rio/patches/patch-teletypewriter_src_unix_mod.rs
+++ b/rio/patches/patch-teletypewriter_src_unix_mod.rs
@@ -6,6 +6,11 @@ IUTF8 flag (not defined in NetBSD libc).  Also set B38400 baud rate in the
 PTY termios to prevent NetBSD tty.c B0 hangup semantics (c_ospeed=0 triggers
 ttysig(SIGHUP) to the session leader via the kernel PTY path).
 
+On NetBSD, $SHELL in graphical sessions is often inherited from the display
+manager (/bin/ksh) rather than reflecting the user's configured login shell.
+Override with pw_shell from getpwuid_r so rio always starts the shell from
+/etc/passwd, matching the documented "user's login shell" behaviour.
+
 --- teletypewriter/src/unix/mod.rs.orig
 +++ teletypewriter/src/unix/mod.rs
 @@ -34,6 +34,8 @@
@@ -47,3 +52,17 @@ ttysig(SIGHUP) to the session leader via the kernel PTY path).
      {
          // Enable utf8 support if requested
          if utf8 {
+@@ -381,6 +381,13 @@
+             },
+         };
+ 
++        #[cfg(target_os = "netbsd")]
++        if let Ok(ref pw) = pw {
++            if !pw.shell.is_empty() {
++                shell = pw.shell.to_owned();
++            }
++        }
++
+         Ok(Self { user, home, shell })
+     }
+ }


Home | Main Index | Thread Index | Old Index