From 4ebb810a5722004ad1bf5b87240ae88a8f55e247 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 12 Apr 2016 15:47:54 +0200 Subject: [PATCH 7/9] gnu: ncurses: support mingw. * gnu/packages/patches/ncurses-mingw.patch: New file. * gnu/packages/ncurses.scm (ncurses)[MINGW]: Support mingw. --- gnu-system.am | 1 + gnu/packages/ncurses.scm | 42 ++++++++++++++++++++++++-------- gnu/packages/patches/ncurses-mingw.patch | 18 ++++++++++++++ 3 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 gnu/packages/patches/ncurses-mingw.patch diff --git a/gnu-system.am b/gnu-system.am index 49d322c..428e9db 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -620,6 +620,7 @@ dist_patch_DATA = \ gnu/packages/patches/mumps-build-parallelism.patch \ gnu/packages/patches/mupen64plus-ui-console-notice.patch \ gnu/packages/patches/mutt-store-references.patch \ + gnu/packages/patches/ncurses-mingw.patch \ gnu/packages/patches/net-tools-bitrot.patch \ gnu/packages/patches/ngircd-handle-zombies.patch \ gnu/packages/patches/ngircd-no-dns-in-tests.patch \ diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm index 147033a..1281af3 100644 --- a/gnu/packages/ncurses.scm +++ b/gnu/packages/ncurses.scm @@ -19,9 +19,11 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages ncurses) + #:use-module (gnu packages) #:use-module (guix licenses) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix utils) #:use-module (guix build-system gnu)) (define-public ncurses @@ -86,6 +88,16 @@ (call-with-output-file lib.so (lambda (p) (format p "INPUT (-l~aw)~%" lib))))) + '("curses" "ncurses" "form" "panel" "menu"))) + (with-directory-excursion (string-append out "/bin") + (for-each (lambda (lib) + (define lib.dll + (string-append "lib" lib ".dll")) + (define libw6.dll + (string-append "lib" lib "w6.dll")) + (when (file-exists? libw6.dll) + (format #t "creating symlinks for `lib~a'~%" lib) + (symlink libw6.dll lib.dll))) '("curses" "ncurses" "form" "panel" "menu"))))))) (package (name "ncurses") @@ -94,6 +106,7 @@ (method url-fetch) (uri (string-append "mirror://gnu/ncurses/ncurses-" version ".tar.gz")) + (patches (list (search-patch "ncurses-mingw.patch"))) (sha256 (base32 "0q3jck7lna77z5r42f13c4xglc7azd19pxfrjrpgp2yf615w4lgm")))) @@ -102,23 +115,32 @@ "doc")) ;1 MiB of man pages (arguments `(#:configure-flags - `("--with-shared" "--without-debug" "--enable-widec" + (append + `("--with-shared" "--without-debug" "--enable-widec" - ;; By default headers land in an `ncursesw' subdir, which is not - ;; what users expect. - ,(string-append "--includedir=" (assoc-ref %outputs "out") - "/include") - "--enable-overwrite" ;really honor --includedir + ;; By default headers land in an `ncursesw' subdir, which is not + ;; what users expect. + ,(string-append "--includedir=" (assoc-ref %outputs "out") + "/include") + "--enable-overwrite" ;really honor --includedir - ;; Make sure programs like 'tic', 'reset', and 'clear' have a - ;; correct RUNPATH. - ,(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") - "/lib")) + ;; Make sure programs like 'tic', 'reset', and 'clear' have a + ;; correct RUNPATH. + ,(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") + "/lib")) + (cond ((equal? ,(%current-target-system) "i686-w64-mingw32") + '("--enable-term-driver" + "--without-cxx" + "--without-cxx-binding")) + (else '()))) #:tests? #f ; no "check" target #:phases (modify-phases %standard-phases (replace 'configure ,configure-phase) (add-after 'install 'post-install ,post-install-phase) + ,@(cond ((equal? (%current-target-system) "i686-w64-mingw32") + `((delete 'validate-runpath))) + (else '())) (add-before 'configure 'patch-makefile-SHELL ,patch-makefile-phase) (add-after 'unpack 'remove-unneeded-shebang diff --git a/gnu/packages/patches/ncurses-mingw.patch b/gnu/packages/patches/ncurses-mingw.patch new file mode 100644 index 0000000..9801a81 --- /dev/null +++ b/gnu/packages/patches/ncurses-mingw.patch @@ -0,0 +1,18 @@ +--- ncurses-6.0.orig/include/curses.h.in 2014-08-09 22:39:44.000000000 +0200 ++++ ncurses-6.0/include/curses.h.in 2016-04-09 20:47:14.266679000 +0200 +@@ -1420,3 +1420,15 @@ + #define KEY_BREAK 0401 /* Break key (unreliable) */ + #define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ + #define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ ++ ++#ifdef __MINGW32__ ++/* Windows API headers, included e.g. by serial.h, define MOUSE_MOVED, ++ and so does PDCurses's curses.h, but for an entirely different ++ purpose. Since we don't use the Windows semantics of MOUSE_MOVED ++ anywhere, avoid compiler warnings by undefining MOUSE_MOVED before ++ including curses.h. */ ++#undef MOUSE_MOVED ++/* Likewise, KEY_EVENT is defined by ncurses.h, but also by Windows ++ API headers. */ ++#undef KEY_EVENT ++#endif -- 2.7.3