pkgsrc-WIP-changes archive

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

rio: fix NetBSD build and runtime; terminal now working



Module Name:	pkgsrc-wip
Committed By:	ci4ic4 <ci4ic4%gmail.com@localhost>
Pushed By:	ci4ic4
Date:		Sun May 24 19:23:45 2026 +0100
Changeset:	8f49a02ae8f99f79b901a2c52bef17b987ee1288

Modified Files:
	rio/Makefile
	rio/distinfo
	rio/patches/patch-teletypewriter_src_unix_mod.rs
Added Files:
	rio/patches/patch-misc_rio.desktop

Log Message:
rio: fix NetBSD build and runtime; terminal now working

Four changes to make rio-0.4.5 fully functional on NetBSD:

1. teletypewriter patch: set B38400 baud rate in create_termp() BSD termios
   branch.  c_ispeed/c_ospeed=0 (B0) caused NetBSD tty.c to send SIGHUP to
   the PTY session leader immediately on tcsetattr, killing the shell.

2. wgpu pre-configure patches: wgpu and wgpu-core hard-code platform
   allowlists (Windows/Linux/Android/Apple) for their Vulkan and GLES
   backends via cfg_aliases in build.rs.  The pre-configure Makefile target
   patches four vendor files at build time to include NetBSD:
   - wgpu/build.rs: add netbsd to vulkan and gles cfg conditions
   - wgpu-core/build.rs: add netbsd to windows_linux_android alias
   - wgpu-core/Cargo.toml: extend target dep cfg + activate wgpu-hal
     gles/vulkan features directly so the feature chain reaches wgpu-hal
   - wgpu-core-deps-windows-linux-android/Cargo.toml: make wgpu-hal an
     unconditional dependency (removes the Windows/Linux/Android restriction)
   Cargo vendor checksums are cleared (files:{}) for each modified crate
   so the integrity check is skipped for those entries.

3. Makefile RUSTFLAGS rpath: embed /usr/X11R7/lib in the binary RUNPATH so
   libEGL.so is found at runtime without LD_LIBRARY_PATH.

4. misc/rio.desktop patch: set EGL_LOG_LEVEL=fatal in Exec lines to suppress
   the harmless Mesa DRI2 authentication warning from the software EGL path.

Tested on NetBSD-current (amd64, Proxmox VM): rio launches from the MATE
application menu, renders via GLES/EGL software renderer, PTY and shell
work correctly.

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

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

diffstat:
 rio/Makefile                                     | 36 ++++++++++++++++++++++++
 rio/distinfo                                     |  3 +-
 rio/patches/patch-misc_rio.desktop               | 23 +++++++++++++++
 rio/patches/patch-teletypewriter_src_unix_mod.rs | 22 ++++++++++++---
 4 files changed, 79 insertions(+), 5 deletions(-)

diffs:
diff --git a/rio/Makefile b/rio/Makefile
index 7257d24cf2..4924339b89 100644
--- a/rio/Makefile
+++ b/rio/Makefile
@@ -39,6 +39,42 @@ INSTALLATION_DIRS=	bin \
 			share/applications \
 			share/icons/hicolor/scalable/apps
 
+# Patch vendor crates to enable wgpu GLES backend on NetBSD.
+#
+# wgpu and wgpu-core have explicit platform allowlists (Windows/Linux/Android/Apple)
+# for their Vulkan and GLES backends.  Each patched file is followed by a checksum
+# reset ("files":{}) so Cargo skips per-file verification of the modified entries.
+pre-configure:
+	# wgpu/build.rs: add NetBSD to vulkan and gles cfg platform conditions
+	${SED} -i \
+	    -e 's|target_os = "android"), feature = "vulkan")|target_os = "android", target_os = "netbsd"), feature = "vulkan")|' \
+	    -e 's|target_os = "android", Emscripten), feature = "gles")|target_os = "android", Emscripten, target_os = "netbsd"), feature = "gles")|' \
+	    ${WRKDIR}/vendor/wgpu-25.0.2/build.rs
+	${SED} -i 's/"files":{[^}]*}/"files":{}/' \
+	    ${WRKDIR}/vendor/wgpu-25.0.2/.cargo-checksum.json
+	# wgpu-core/build.rs: add NetBSD to windows_linux_android alias
+	${SED} -i \
+	    -e 's|target_os = "android") }|target_os = "android", target_os = "netbsd") }|' \
+	    ${WRKDIR}/vendor/wgpu-core-25.0.2/build.rs
+	# wgpu-core/Cargo.toml: add NetBSD to target dep + activate wgpu-hal features directly
+	${SED} -i \
+	    -e "s|'cfg(any(windows, target_os = \"linux\", target_os = \"android\"))'\.dependencies\.wgpu-core-deps|'cfg(any(windows, target_os = \"linux\", target_os = \"android\", target_os = \"netbsd\"))'.dependencies.wgpu-core-deps|" \
+	    -e 's|vulkan = \["wgpu-core-deps-windows-linux-android/vulkan"\]|vulkan = ["wgpu-core-deps-windows-linux-android/vulkan", "wgpu-hal/vulkan"]|' \
+	    ${WRKDIR}/vendor/wgpu-core-25.0.2/Cargo.toml
+	${AWK} '/"wgpu-core-deps-emscripten\/gles",$/ { print; print "    \"wgpu-hal/gles\","; next } { print }' \
+	    ${WRKDIR}/vendor/wgpu-core-25.0.2/Cargo.toml > \
+	    ${WRKDIR}/vendor/wgpu-core-25.0.2/Cargo.toml.new
+	${MV} ${WRKDIR}/vendor/wgpu-core-25.0.2/Cargo.toml.new \
+	    ${WRKDIR}/vendor/wgpu-core-25.0.2/Cargo.toml
+	${SED} -i 's/"files":{[^}]*}/"files":{}/' \
+	    ${WRKDIR}/vendor/wgpu-core-25.0.2/.cargo-checksum.json
+	# wgpu-core-deps-windows-linux-android/Cargo.toml: unconditional wgpu-hal dependency
+	${SED} -i \
+	    -e "s|\[target\.'cfg(any(windows, target_os = \"linux\", target_os = \"android\"))'\.dependencies\.wgpu-hal\]|[dependencies.wgpu-hal]|" \
+	    ${WRKDIR}/vendor/wgpu-core-deps-windows-linux-android-25.0.0/Cargo.toml
+	${SED} -i 's/"files":{[^}]*}/"files":{}/' \
+	    ${WRKDIR}/vendor/wgpu-core-deps-windows-linux-android-25.0.0/.cargo-checksum.json
+
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/target/release/rio \
 		${DESTDIR}${PREFIX}/bin/rio
diff --git a/rio/distinfo b/rio/distinfo
index bb5f894264..bd600d3521 100644
--- a/rio/distinfo
+++ b/rio/distinfo
@@ -1984,4 +1984,5 @@ 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-teletypewriter_src_unix_mod.rs) = 3c0e64c74f324d4ea40bc40ac28074268faad1f5
+SHA1 (patch-misc_rio.desktop) = d8387842ecc07b2736dbdef5aeaa58e05be095fc
+SHA1 (patch-teletypewriter_src_unix_mod.rs) = cbd68c55a6442743840f1608d297a951c863f4e3
diff --git a/rio/patches/patch-misc_rio.desktop b/rio/patches/patch-misc_rio.desktop
new file mode 100644
index 0000000000..5838321e08
--- /dev/null
+++ b/rio/patches/patch-misc_rio.desktop
@@ -0,0 +1,23 @@
+$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).
+
+--- misc/rio.desktop.orig
++++ misc/rio.desktop
+@@ -1,7 +1,7 @@
+ [Desktop Entry]
+ Type=Application
+ TryExec=rio
+-Exec=rio
++Exec=env EGL_LOG_LEVEL=fatal rio
+ Icon=rio
+ Terminal=false
+ Categories=System;TerminalEmulator;
+@@ -14,4 +14,4 @@
+ 
+ [Desktop Action New]
+ Name=New Terminal
+-Exec=rio
++Exec=env EGL_LOG_LEVEL=fatal rio
diff --git a/rio/patches/patch-teletypewriter_src_unix_mod.rs b/rio/patches/patch-teletypewriter_src_unix_mod.rs
index 7806710eaa..f7d6d32049 100644
--- a/rio/patches/patch-teletypewriter_src_unix_mod.rs
+++ b/rio/patches/patch-teletypewriter_src_unix_mod.rs
@@ -2,7 +2,9 @@ $NetBSD$
 
 Add NetBSD support to teletypewriter: TIOCSWINSZ constant (same value as
 FreeBSD), BSD termios branch, and exclude NetBSD from the Linux/macOS-only
-IUTF8 flag (not defined in NetBSD libc).
+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).
 
 --- teletypewriter/src/unix/mod.rs.orig
 +++ teletypewriter/src/unix/mod.rs
@@ -15,7 +17,7 @@ IUTF8 flag (not defined in NetBSD libc).
  
  #[link(name = "util")]
  extern "C" {
-@@ -289,7 +291,7 @@
+@@ -289,25 +291,25 @@
          c_line: 0,
      };
  
@@ -24,8 +26,20 @@ IUTF8 flag (not defined in NetBSD libc).
      let mut term = libc::termios {
          c_iflag: libc::ICRNL | libc::IXON | libc::IXANY | libc::IMAXBEL | libc::BRKINT,
          c_oflag: libc::OPOST | libc::ONLCR,
-@@ -307,7 +309,7 @@
-         c_ospeed: Default::default(),
+         c_cflag: libc::CREAD | libc::CS8 | libc::HUPCL,
+         c_lflag: libc::ICANON
+             | libc::ISIG
+             | libc::IEXTEN
+             | libc::ECHO
+             | libc::ECHOE
+             | libc::ECHOK
+             | libc::ECHOKE
+             | libc::ECHOCTL,
+         c_cc: Default::default(),
+-        c_ispeed: Default::default(),
+-        c_ospeed: Default::default(),
++        c_ispeed: libc::B38400 as libc::c_int,
++        c_ospeed: libc::B38400 as libc::c_int,
      };
  
 -    #[cfg(not(target_os = "freebsd"))]


Home | Main Index | Thread Index | Old Index