all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: guix-devel@gnu.org
Subject: [PATCH 08/10] gnu: readline: support mingw.
Date: Fri, 29 Apr 2016 17:12:29 +0200	[thread overview]
Message-ID: <1461942751-23883-8-git-send-email-janneke@gnu.org> (raw)
In-Reply-To: <1461942751-23883-1-git-send-email-janneke@gnu.org>

* 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 <ludo@gnu.org>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; 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

  parent reply	other threads:[~2016-04-29 15:13 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 02/10] gnu: bootstrap: Add i686-mingw Jan Nieuwenhuizen
2016-04-29 15:34   ` Manolis Ragkousis
2016-04-29 18:28     ` Jan Nieuwenhuizen
2016-05-01 11:02       ` Manolis Ragkousis
2016-04-29 15:12 ` [PATCH 03/10] gnu: Add mingw-w64 Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target Jan Nieuwenhuizen
2016-05-02  8:06   ` Andy Wingo
2016-05-02 18:34     ` Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 05/10] gnu: gmp: build shared library for mingw Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 06/10] gnu: Add libiconv Jan Nieuwenhuizen
2016-05-01 17:07   ` Manolis Ragkousis
2016-05-01 17:43     ` John Darrington
2016-05-01 18:58       ` Jan Nieuwenhuizen
2016-05-01 19:07         ` John Darrington
2016-05-03 12:19         ` Ludovic Courtès
2016-05-01 18:27     ` Jan Nieuwenhuizen
2016-05-03 12:20     ` Ludovic Courtès
2016-05-03 16:55       ` [PATCH 06a/10] " Jan Nieuwenhuizen
2016-05-05 14:56         ` Ludovic Courtès
2016-05-03 16:56       ` [PATCH 06b/10] gnu: Add function libiconv-if-needed Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 07/10] gnu: ncurses: support mingw Jan Nieuwenhuizen
2016-05-02  8:09   ` Andy Wingo
2016-05-02 18:41     ` Jan Nieuwenhuizen
2016-04-29 15:12 ` Jan Nieuwenhuizen [this message]
2016-05-02  8:12   ` [PATCH 08/10] gnu: readline: " Andy Wingo
2016-05-02 18:52     ` Jan Nieuwenhuizen
2016-05-02 19:25     ` Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 09/10] gnu: libunistring: support mingw: propagate libiconv if needed Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 10/10] gnu: guile-2.0: support mingw Jan Nieuwenhuizen
2016-05-02  8:04 ` [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Andy Wingo
2016-05-02 17:59   ` Jan Nieuwenhuizen
2016-05-03 12:06   ` Ludovic Courtès
2016-05-03 13:27     ` Andy Wingo
2016-05-03 12:16 ` Ludovic Courtès
2016-05-14  5:29 ` Mark H Weaver
2016-05-14  6:37   ` Jan Nieuwenhuizen
2016-05-14  8:25     ` FIXUP: " Jan Nieuwenhuizen
2016-05-14 20:05       ` Ludovic Courtès
2016-05-14 20:50         ` Jan Nieuwenhuizen
2016-05-16 21:02           ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461942751-23883-8-git-send-email-janneke@gnu.org \
    --to=janneke@gnu.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.