Skip to contentSkip to conversation

rxvt-unicode: Fix installing of terminfo

PATCH Superseded [email protected] 2 participants 4 messages Feb 27, 2024 – Feb 28, 2024

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 rxvt-unicode: Fix installing of terminfo

From: Changqing Li <[email protected]>

For cross compile, TIC will be native tic in recipe-sysroot-native, and the terminfo path will be native path, the rxvt-unicode terminfo will be wrongly installed to native path.

disable the terminfo installation by setting TIC to : and use qemu to install terminfo to make sure ncurses on target env use the correct terminfo

---
 .../rxvt-unicode/rxvt-unicode.inc             | 20 +++++++++-
 ...ble-the-terminfo-installation-by-set.patch | 37 +++++++++++++++++++
 2 files changed, 55 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-sato/rxvt-unicode/rxvt-unicode/0001-Makefile.in-disable-the-terminfo-installation-by-set.patch
meta/recipes-sato/rxvt-unicode/rxvt-unicode.inc +18 -2
index e7d520ebef..e6ca10f6e0 100644
@@ -11,9 +11,11 @@ DEPENDS = "virtual/libx11 libxt libxft gdk-pixbuf libxmu libptytty"
 SRC_URI = "http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${PV}.tar.bz2 \
 	   file://xwc.patch \
 	   file://rxvt.desktop \
-	   file://rxvt.png"
+	   file://rxvt.png \
+	   file://0001-Makefile.in-disable-the-terminfo-installation-by-set.patch \
+"
 
-inherit autotools pkgconfig update-alternatives
+inherit autotools pkgconfig update-alternatives qemu
 
 PROVIDES = "virtual/x-terminal-emulator"
 ALTERNATIVE:${PN} = "x-terminal-emulator"
@@ -53,6 +55,20 @@ do_install:append () {
 
 	install -m 0644 ${WORKDIR}/rxvt.png ${D}/${datadir}/pixmaps
 	install -m 0644 ${WORKDIR}/rxvt.desktop ${D}/${datadir}/applications
+
+	install -d ${D}/${sysconfdir}
+	install -m 0644 ${S}/doc/etc/rxvt-unicode.terminfo ${D}/${sysconfdir}/rxvt-unicode.terminfo
+}
+
+RDEPENDS:${PN} = "ncurses-tools"
+PACKAGE_WRITE_DEPS += "qemu-native"
+pkg_postinst:${PN} () {
+	if [ -n "$D" ]; then
+		if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
+			outdir=$(${@qemu_run_binary(d, '$D', '${bindir}/tic')} -D 2>&1 | sed -n "2p" | awk '{ print $2 }')
+			${@qemu_run_binary(d, '$D', '${bindir}/tic')} -x ${sysconfdir}/rxvt-unicode.terminfo -o $D$outdir
+		fi
+	fi
 }
 
 FILES:${PN} += "${datadir}/applications/rxvt.desktop ${datadir}/pixmaps/rxvt.png"
meta/recipes-sato/rxvt-unicode/rxvt-unicode/0001-Makefile.in-disable-the-terminfo-installation-by-set.patch new file +37 -0
new file mode 100644
index 0000000000..6bdbedb3c4
@@ -0,0 +1,37 @@
+From ff5c75995485ee9c5331e52bb9bf3aa5db6d8837 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Wed, 7 Feb 2024 10:35:23 +0800
+Subject: [PATCH] Makefile.in: disable the terminfo installation by setting TIC
+ to :
+
+For cross compile, TIC will be native tic in recipe-sysroot-native, and
+the terminfo path will be native path, the rxvt-unicode terminfo will be
+installed to native path.
+
+disable the terminfo installation by setting TIC to :
+
+Upstream-Status: Inappropriate [ oe specific ]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ doc/Makefile.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/doc/Makefile.in b/doc/Makefile.in
+index e3d1fe8..1961c93 100644
+--- a/doc/Makefile.in
++++ b/doc/Makefile.in
+@@ -100,8 +100,8 @@ install: all
+ 	$(INSTALL_DATA) rxvtd.1.man   $(DESTDIR)$(man1dir)/$(RXVTNAME)d.$(man1ext)
+ 	$(INSTALL_DATA) rxvt.7.man    $(DESTDIR)$(man7dir)/$(RXVTNAME).$(man7ext)
+ 	$(INSTALL_DATA) rclock.1.man  $(DESTDIR)$(man1dir)/urclock.$(man1ext)
+-	@TIC@ -x $(srcdir)/etc/rxvt-unicode.terminfo || \
+-           @TIC@ $(srcdir)/etc/rxvt-unicode.terminfo
++	: -x $(srcdir)/etc/rxvt-unicode.terminfo || \
++           : $(srcdir)/etc/rxvt-unicode.terminfo
+ 
+ distdepend: alldoc
+ 
+-- 
+2.25.1
+
Signature · 1 line
2.25.1
#1 lore raw
Quoted 5 lines · Changqing Li
meta/recipes-sato/rxvt-unicode/rxvt-unicode.inc +5 -0
+
+       install -d ${D}/${sysconfdir}
+       install -m 0644 ${S}/doc/etc/rxvt-unicode.terminfo ${D}/${sysconfdir}/rxvt-unicode.terminfo
+}
+

meta/recipes-sato/rxvt-unicode/rxvt-unicode.inc do_install:append () { · line 72

Quoted 10 lines
meta/recipes-sato/rxvt-unicode/rxvt-unicode.inc +9 -0
+RDEPENDS:${PN} = "ncurses-tools"
+PACKAGE_WRITE_DEPS += "qemu-native"
+pkg_postinst:${PN} () {
+       if [ -n "$D" ]; then
+               if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
+                       outdir=$(${@qemu_run_binary(d, '$D', '${bindir}/tic')} -D 2>&1 | sed -n "2p" | awk '{ print $2 }')
+                       ${@qemu_run_binary(d, '$D', '${bindir}/tic')} -x ${sysconfdir}/rxvt-unicode.terminfo -o $D$outdir
+               fi
+       fi
 }

I would really prefer to make native tic do the right thing, if the only problem is that it installs the needed items into the wrong location.

qemu usermode is notoriously brittle, and isn't available on some targets at all.

Alex

#2 lore raw
Quoted 15 lines · Alexander Kanavin

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 10 lines · Changqing Li
meta/recipes-sato/rxvt-unicode/rxvt-unicode.inc +10 -0
+
+       install -d ${D}/${sysconfdir}
+       install -m 0644 ${S}/doc/etc/rxvt-unicode.terminfo ${D}/${sysconfdir}/rxvt-unicode.terminfo
+}
+
+RDEPENDS:${PN} = "ncurses-tools"
+PACKAGE_WRITE_DEPS += "qemu-native"
+pkg_postinst:${PN} () {
+       if [ -n "$D" ]; then
+               if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
Quoted 8 lines

meta/recipes-sato/rxvt-unicode/rxvt-unicode.inc do_install:append () { · line 72

Quoted 5 lines
meta/recipes-sato/rxvt-unicode/rxvt-unicode.inc +4 -0
+                       outdir=$(${@qemu_run_binary(d, '$D', '${bindir}/tic')} -D 2>&1 | sed -n "2p" | awk '{ print $2 }')
+                       ${@qemu_run_binary(d, '$D', '${bindir}/tic')} -x ${sysconfdir}/rxvt-unicode.terminfo -o $D$outdir
+               fi
+       fi
  }

I would really prefer to make native tic do the right thing, if the only problem is that it installs the needed items into the wrong location.

Yes, the wrong location is the only problem. V4 patch is a way to make native tic install to  a right location.

but this solution (hardcode output dir to $(DESTDIR)$(datadir)/terminfo) is rejected by upstream.

if use V4 patch,  we need to make it an oe specific patch.

upstream said that to it is better to use target tic to generate the terminfo to make sure ncurses in the

target environment can get the correct terminfo. That's why I changed to use target tic. but we do will met

"some targets don't support usermode" problem.

So what's your suggestion about this? use V4 patch?

if you think the hardcode path $(DESTDIR)$(datadir)/terminfo) is not good in v4,  I can do some change for V4.

Since native tic and target tic is from the same recipe, the TERMINFO should be the same except native tic is under ${RECIPE_SYSROOT_NATIVE}.

how about like what I did in this patch,  get the native outputdir from native tic, cut ${RECIPE_SYSROOT_NATIVE} to get target outputdir, then pass it to nativetic .. -o  ${DESTDIR}${target outputdir}

//Changqing

Quoted 5 lines

qemu usermode is notoriously brittle, and isn't available on some targets at all.

Alex

#3 lore raw
Quoted 7 lines · Changqing Li

Yes, the wrong location is the only problem. V4 patch is a way to make native tic install to a right location.

but this solution (hardcode output dir to $(DESTDIR)$(datadir)/terminfo) is rejected by upstream.

if use V4 patch, we need to make it an oe specific patch.

Quoted 7 lines

upstream said that to it is better to use target tic to generate the terminfo to make sure ncurses in the

target environment can get the correct terminfo. That's why I changed to use target tic. but we do will met

"some targets don't support usermode" problem.

So what's your suggestion about this? use V4 patch?

I would suggest this:

- recipe needs to depend on ncurses-native, otherwise we have a floating dependency on tic executable

- drop the patch, and instead just add a manual tic invocation into do_install:append () that places the output into correct directory in ${D}. As far as I understand, what doc/Makefile does is harmless, but you can additionally set environment variable TIC to : or /usr/bin/true as suggested by upstream to avoid that happening.

Alex