guix-devel
[Top][All Lists]
Advanced

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

[PATCH 08/10] gnu: readline: support mingw.


From: Jan Nieuwenhuizen
Subject: [PATCH 08/10] gnu: readline: support mingw.
Date: Fri, 29 Apr 2016 17:12:29 +0200

* gnu/packages/patches/readline-6.3-mingw.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/readline.scm (readline): Support mingw.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/patches/readline-6.3-mingw.patch | 128 ++++++++++++++++++++++++++
 gnu/packages/readline.scm                     |  17 +++-
 3 files changed, 143 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/readline-6.3-mingw.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index eb59fea..26685e2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -724,6 +724,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/qt4-ldflags.patch                       \
   gnu/packages/patches/ratpoison-shell.patch                   \
   gnu/packages/patches/readline-link-ncurses.patch             \
+  gnu/packages/patches/readline-6.3-mingw.patch                        \
   gnu/packages/patches/ripperx-missing-file.patch              \
   gnu/packages/patches/rsem-makefile.patch                     \
   gnu/packages/patches/sed-hurd-path-max.patch                 \
diff --git a/gnu/packages/patches/readline-6.3-mingw.patch 
b/gnu/packages/patches/readline-6.3-mingw.patch
new file mode 100644
index 0000000..28064bb
--- /dev/null
+++ b/gnu/packages/patches/readline-6.3-mingw.patch
@@ -0,0 +1,128 @@
+Mingw lacks some SIG*.  Taken from
+
+    wget 
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-readline/readline-6.3-mingw.patch
+
+some updates to make it apply.
+
+Upstream status: Not presented to upstream.
+
+--- colors.c~  2013-03-20 11:19:08.000000000 -0400
++++ colors.c   2015-07-20 12:44:31.821014500 -0400
+@@ -37,6 +37,10 @@
+ #include "posixstat.h" // stat related macros (S_ISREG, ...)
+ #include <fcntl.h> // S_ISUID
+ 
++#ifndef S_ISDIR
++#define       S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
++#endif
++
+ // strlen()
+ #if defined (HAVE_STRING_H)
+ #  include <string.h>
+@@ -151,12 +155,17 @@
+       if (S_ISREG (mode))
+         {
+           colored_filetype = C_FILE;
+-
++#ifdef S_ISUID
+           if ((mode & S_ISUID) != 0 && is_colored (C_SETUID))
+             colored_filetype = C_SETUID;
+-          else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
++              else
++#endif
++#ifdef S_ISGID
++          if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
+             colored_filetype = C_SETGID;
+-          else if (is_colored (C_CAP) && 0) //f->has_capability)
++          else
++#endif
++                if (is_colored (C_CAP) && 0) //f->has_capability)
+             colored_filetype = C_CAP;
+           else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC))
+             colored_filetype = C_EXEC;
+@@ -180,15 +189,19 @@
+             colored_filetype = C_STICKY;
+ #endif
+         }
++      #ifdef S_ISLNK
+       else if (S_ISLNK (mode))
+         colored_filetype = ((linkok == 0
+                  && (!strncmp (_rl_color_indicator[C_LINK].string, "target", 
6)
+                      || _rl_color_indicator[C_ORPHAN].string))
+                 ? C_ORPHAN : C_LINK);
++      #endif
+       else if (S_ISFIFO (mode))
+         colored_filetype = C_FIFO;
++      #ifdef S_ISSOCK
+       else if (S_ISSOCK (mode))
+         colored_filetype = C_SOCK;
++#endif
+       else if (S_ISBLK (mode))
+         colored_filetype = C_BLK;
+       else if (S_ISCHR (mode))
+--- signals.c~ 2014-01-10 15:06:48.000000000 -0500
++++ signals.c  2015-07-20 12:33:07.437472100 -0400
+@@ -216,7 +216,9 @@
+       /* FALLTHROUGH */
+ 
+     case SIGTERM:
++#if defined (SIGHUP)
+     case SIGHUP:
++#endif
+ #if defined (SIGTSTP)
+     case SIGTSTP:
+     case SIGTTOU:
+@@ -397,7 +399,9 @@
+ 
+       sigaddset (&bset, SIGINT);
+       sigaddset (&bset, SIGTERM);
++#ifdef SIGHUP
+       sigaddset (&bset, SIGHUP);
++#endif
+ #if defined (SIGQUIT)
+       sigaddset (&bset, SIGQUIT);
+ #endif
+@@ -426,7 +430,9 @@
+ 
+       rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
+       rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
++#ifdef SIGHUP
+       rl_maybe_set_sighandler (SIGHUP, rl_signal_handler, &old_hup);
++#endif
+ #if defined (SIGQUIT)
+       rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
+ #endif
+@@ -491,7 +497,9 @@
+        overhead */
+       rl_maybe_restore_sighandler (SIGINT, &old_int);
+       rl_maybe_restore_sighandler (SIGTERM, &old_term);
++#ifdef SIGHUP
+       rl_maybe_restore_sighandler (SIGHUP, &old_hup);
++#endif
+ #if defined (SIGQUIT)
+       rl_maybe_restore_sighandler (SIGQUIT, &old_quit);
+ #endif
+--- input.c~   1970-01-01 01:00:00.000000000 +0100
++++ input.c    2016-04-01 20:13:24.293063372 +0200
+@@ -532,11 +532,18 @@
+        Otherwise (not EINTR), some error occurred, also signifying EOF. */
+       if (errno != EINTR)
+       return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
+-      else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM)
++      else if (
++#ifdef SIGHUP
++        _rl_caught_signal == SIGHUP ||
++#endif
++        _rl_caught_signal == SIGTERM)
+       return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
+-      else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT)
++      else if (_rl_caught_signal == SIGINT
++#ifdef SIGQUIT
++        || _rl_caught_signal == SIGQUIT
++#endif
++        )
+         RL_CHECK_SIGNALS ();
+-
+       if (rl_signal_event_hook)
+       (*rl_signal_event_hook) ();
+     }
diff --git a/gnu/packages/readline.scm b/gnu/packages/readline.scm
index db469db..eaf84e1 100644
--- a/gnu/packages/readline.scm
+++ b/gnu/packages/readline.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <address@hidden>
+;;; Copyright © 2016 Jan Nieuwenhuizen <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,7 +23,8 @@
   #:use-module (gnu packages ncurses)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (guix utils))
 
 (define-public readline
   (let ((post-install-phase
@@ -46,21 +48,30 @@
                (sha256
                 (base32
                  "0hzxr9jxqqx5sxsv9vmlxdnvlr9vi4ih1avjb869hbs6p5qn1fjn"))
-               (patches (search-patches "readline-link-ncurses.patch"))
+               (patches (search-patches "readline-link-ncurses.patch"
+                                        "readline-6.3-mingw.patch"))
                (patch-flags '("-p0"))))
       (build-system gnu-build-system)
       (propagated-inputs `(("ncurses" ,ncurses)))
       (arguments `(#:configure-flags
                    (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
                                         (assoc-ref %build-inputs "ncurses")
-                                        "/lib")
+                                        ,(if (mingw-target?) "/bin" "/lib"))
 
                          ;; This test does an 'AC_TRY_RUN', which aborts when
                          ;; cross-compiling, so provide the correct answer.
                          ,@(if (%current-target-system)
                                '("bash_cv_wcwidth_broken=no")
+                               '())
+                         ;; MinGW: ncurses provides the termcap api.
+                         ,@(if (mingw-target?)
+                               '("bash_cv_termcap_lib=ncurses")
                                '()))
 
+                   #:make-flags (list ,@(if (mingw-target?)
+                                            ;; MinGW: termcap in ncurses
+                                            '("TERMCAP_LIB=-lncurses")
+                                            '()))
                    #:phases (alist-cons-after
                              'install 'post-install
                              ,post-install-phase
-- 
2.7.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]