Bug 250036

Summary: x11/xterm: fixup pixmap directory path
Product: Ports & Packages Reporter: sigsys
Component: Individual Port(s)Assignee: Emanuel Haupt <ehaupt>
Status: Closed FIXED    
Severity: Affects Only Me CC: dickey
Priority: --- Flags: bugzilla: maintainer-feedback? (ehaupt)
Version: Latest   
Hardware: Any   
OS: Any   

Description sigsys 2020-10-01 23:59:51 UTC
The path for pixmap files in misc.c doesn't match where they end up being installed:

#ifndef PIXMAP_ROOTDIR                                                        
#define PIXMAP_ROOTDIR "/usr/share/pixmaps/"       
#endif

This makes the "iconHint" resource not work (when attempting to set it explicitly).  It always fallsback to default because it can't find the file.


Index: x11/xterm/Makefile
===================================================================
--- x11/xterm/Makefile	(revision 550760)
+++ x11/xterm/Makefile	(working copy)
@@ -89,6 +89,10 @@
 		${WRKDIR}/bsd-xterm-icons-1/*.xpm \
 			${WRKSRC}/icons/
 
+post-patch:
+	@${REINPLACE_CMD} -e "s|\"/usr/share/pixmaps/\"|\"${LOCALBASE}/share/pixmaps/\"|g" \
+		"${WRKSRC}/misc.c"
+
 post-install:
 .for f in koi8rxterm resize uxterm xterm
 	@${CHMOD} ${BINMODE} ${STAGEDIR}${PREFIX}/bin/${f}
Comment 1 Emanuel Haupt freebsd_committer freebsd_triage 2020-10-02 15:50:53 UTC
Good catch. I am patching it for now.

Thomas, do you think you could set the patch based on a configure flag?
Comment 2 Emanuel Haupt freebsd_committer freebsd_triage 2020-10-02 15:51:24 UTC
s/patch/path/
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-10-02 16:03:43 UTC
A commit references this bug:

Author: ehaupt
Date: Fri Oct  2 16:03:31 UTC 2020
New revision: 551218
URL: https://svnweb.freebsd.org/changeset/ports/551218

Log:
  Fix hardcoded pixmap directory path

  PR:		250036
  Submitted by:	sigsys@gmail.com

Changes:
  head/x11/xterm/Makefile
Comment 4 sigsys 2020-10-02 19:17:31 UTC
I tried to find a better way to fix it too.  What's interesting is that the pixmap path is set correctly in the man page.  The configure script detects it and substitutes it there.

I tried to make it use that path in misc.c but I couldn't figure it out.

--- aclocal.m4.orig	2020-09-16 20:31:25.000000000 -0400
+++ aclocal.m4	2020-10-02 14:02:26.251904000 -0400
@@ -4276,6 +4276,11 @@
 fi
 AC_MSG_RESULT($PIXMAPDIR)
 AC_SUBST(PIXMAPDIR)
+CF_PATH_SYNTAX(cf_path)
+CF_PATH_SYNTAX(cf_path)
+CF_PATH_SYNTAX(cf_path)
+CF_PATH_SYNTAX(cf_path)
+AC_DEFINE_UNQUOTED(PIXMAP_ROOTDIR,"$cf_path",[Path to pixmap directory])
 
 no_pixmapdir=
 if test "$PIXMAPDIR" = no

The multiple CF_PATH_SYNTAX() calls are because each invocation only expands one layer of nested variable references (and in this case there are many).  Would be better if CF_PATH_SYNTAX() had a loop that expanded variables until there are no more.

This sets PIXMAP_ROOTDIR correctly in xtermcfg.h but I can't get it to build after running autoreconf.  I'm not too familiar with autoconf so dunno if I'm doing something dumb there.  It fails to build because it doesn't detect xaw the same way.  Apparently xterm always needs some kind of xaw library, be that the regular xaw or xaw3d/xaw3dxft.  With the old configure script, it has HAVE_LIB_XAW defined to 1 in xtermcfg.h.  With the regenerated configure script, HAVE_LIB_XAW is undefined and that makes it not include some header files later on and then there are references to undeclared identifiers (scrollbarWidgetClass, simpleMenuWidgetClass).  Don't know if that's because it's not the same autoconf version or what.
Comment 5 Emanuel Haupt freebsd_committer freebsd_triage 2020-10-03 09:38:25 UTC
I was experiencing the same thing you've described.

I tried to use autoreconf:

#USES=          cpe localbase ncurses tar:tgz xorg
USES=           cpe localbase ncurses tar:tgz xorg autoreconf

but I noticed that different autoconf versions are used:

--- /tmp/stock/configure        2020-09-19 18:54:14.000000000 +0200
+++ /tmp/autoreconf/configure   2020-10-03 11:32:14.158071000 +0200
@@ -1,150 +1,897 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by Autoconf 2.52.20200802.
+# Generated by GNU Autoconf 2.69.

The new autoconf version seems to open another can of worms.
Comment 6 Thomas E. Dickey 2020-10-03 19:57:48 UTC
The symbol PIXMAPDIR which is substituted in the Makefile could be used,
e.g., adding -DPIXMAP_ROOTDIR=\"@PIXMAPDIR@\" to the CPPFLAGS line.
Comment 7 Emanuel Haupt freebsd_committer freebsd_triage 2020-10-04 08:36:59 UTC
That would be helpful.
Comment 8 Thomas E. Dickey 2020-10-04 09:14:41 UTC
I've added it to my to-do list (and expect it in #361 in a week or so).
At the moment I'm investigating this:
https://lists.gnu.org/archive/html/help-gnu-emacs/2020-09/msg00340.html
Comment 9 Emanuel Haupt freebsd_committer freebsd_triage 2020-10-04 17:48:39 UTC
Thank you.
Comment 10 commit-hook freebsd_committer freebsd_triage 2020-10-15 21:55:37 UTC
A commit references this bug:

Author: ehaupt
Date: Thu Oct 15 21:54:41 UTC 2020
New revision: 552482
URL: https://svnweb.freebsd.org/changeset/ports/552482

Log:
  - Update to 361
  - Use new preprocessor option to set the pixmaps directory

  PR:		250036 (related)
  Changelog:	https://invisible-island.net/xterm/xterm.log.html#xterm_361

Changes:
  head/x11/xterm/Makefile
  head/x11/xterm/distinfo