[bug#33186,6/7] gnu: slang: Use a correct location for terminfo dirs.

Message ID 20181028124043.21773-7-m.othacehe@gmail.com
State Accepted
Commit 8243f4e55a9f87821370eb2198fa9b5c8eac6648
Headers show
Series
  • Preliminary installer work
Related show

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Mathieu Othacehe Oct. 28, 2018, 12:40 p.m. UTC
As termcap is disabled and no terminfo directory is given, slang is not able
to query terminal capabilities. Specifying a correct path for terminfo will
automatically disable termcap support in the configuration.

* gnu/packages/slang.scm (slang)[source]: Remove the snippet disabling
termcap.
[arguments]: Set MISC_TERMINFO_DIRS to a correct location.
---
 gnu/packages/slang.scm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

Ludovic Courtès Nov. 6, 2018, 3:40 p.m. UTC | #1
Mathieu Othacehe <m.othacehe@gmail.com> skribis:

> As termcap is disabled and no terminfo directory is given, slang is not able
> to query terminal capabilities. Specifying a correct path for terminfo will
> automatically disable termcap support in the configuration.
>
> * gnu/packages/slang.scm (slang)[source]: Remove the snippet disabling
> termcap.
> [arguments]: Set MISC_TERMINFO_DIRS to a correct location.

Note that ncurses honors the TERMINFO_DIRS environment variable, so I
suppose it would work to just set it at run time?

Now, if this change means that Slang will work out-of-the-box by
default, it’s probably preferable.

Thanks.
Mathieu Othacehe Nov. 7, 2018, 9:39 a.m. UTC | #2
Hey,

> Note that ncurses honors the TERMINFO_DIRS environment variable, so I
> suppose it would work to just set it at run time?

Slang uses this piece of code to locate terminfo directory:

--8<---------------cut here---------------start------------->8---
static SLCONST char *Terminfo_Dirs [] =
{
   "", /* $TERMINFO */
   "", /* $HOME/.terminfo */
#ifdef MISC_TERMINFO_DIRS
   MISC_TERMINFO_DIRS,  <---- set during configure
#endif
   "/usr/local/etc/terminfo",
   "/usr/local/share/terminfo",
   "/usr/local/lib/terminfo",
   "/etc/terminfo",
   "/usr/share/terminfo",
   "/usr/lib/terminfo",
   "/usr/share/lib/terminfo",
   "/lib/terminfo",
   NULL,
};
--8<---------------cut here---------------end--------------->8---

So TERMINFO_DIRS is not used sadly.

>
> Now, if this change means that Slang will work out-of-the-box by
> default, it’s probably preferable.

I'll stick with this patch then.

Pushed as 8243f4e55a9f87821370eb2198fa9b5c8eac6648.

Mathieu

Patch

diff --git a/gnu/packages/slang.scm b/gnu/packages/slang.scm
index 24eb5fa13..185d44191 100644
--- a/gnu/packages/slang.scm
+++ b/gnu/packages/slang.scm
@@ -50,13 +50,21 @@ 
                '(begin
                   (substitute* "src/Makefile.in"
                     (("/bin/ln") "ln"))
-                  (substitute* "configure"
-                    (("-ltermcap") ""))
                   #t))))
     (build-system gnu-build-system)
     (arguments
      '(#:parallel-tests? #f
-       #:parallel-build? #f)) ; there's at least one race
+       #:parallel-build? #f  ; there's at least one race
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'substitute-before-config
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((ncurses (assoc-ref inputs "ncurses")))
+               (substitute* "configure"
+                 (("MISC_TERMINFO_DIRS=\"\"")
+                  (string-append "MISC_TERMINFO_DIRS="
+                                 "\"" ncurses "/share/terminfo" "\"")))
+               #t))))))
     (inputs
      `(("readline" ,readline)
        ("zlib" ,zlib)