Patchwork [07/11] gnu: ncurses: support mingw.

mail settings
Submitter Jan Nieuwenhuizen
Date Aug. 10, 2016, 1:08 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/14469/
State New
Headers show


Jan Nieuwenhuizen - Aug. 10, 2016, 1:08 p.m.
Alex Kost writes:


> Jan Nieuwenhuizen (2016-08-09 18:59 +0300) wrote:
>> Alex Kost writes:
>>>> +                  (mingw-target? (lambda* (#:optional (target target))
>>>> +                                   (and target
>>>> +                                        (string-suffix? "-mingw32" target))))
>>> IIUC you don't use the same 'mingw-target?' procedure you added in an
>>> earlier patch, because it is placed in (guix utils), right?
>> Yes, something like that: the function needs to be present at in the
>> builder, but I'm not sure how we can make that so.  I tried several
>> things but could not find a way to avoid this duplication.
>> mingw-target? is passed the TARGET from the post-install-phase.
>>> I don't know if (guix build utils) would be a better place for it ,
>> How would that work?  mingw-target? uses %current-build-system which is
>> defined in (guix utils).  I agree that it would be nice to remove this
>> duplication.
> I just had the same thought ("it would be nice to remove duplication"),
> but I see the problem you faced and I also don't know how to achieve
> the goal, so let's forget about this for now, it shouldn't prevent to
> merge this patchset, thanks!

Hmm...the patch removes the duplication, it also rebuilds everything of
course.  Would this be the way to do it, would we want to have this in
core-updates or is there a better way?

Is a mingw test important enough to have in and export from build utils?

Greetings, Jan

--8<---------------cut here---------------start------------->8---
--8<---------------cut here---------------end--------------->8---
Mark H Weaver - Aug. 10, 2016, 6:04 p.m.
Jan Nieuwenhuizen <> writes:

> Hmm...the patch removes the duplication, it also rebuilds everything of
> course.  Would this be the way to do it, would we want to have this in
> core-updates or is there a better way?

Even just modifying the existing 'ncurses' derivations will force ~10000
rebuilds, which is far too much outside of core-updates.

In theory, it should be possible to arrange for the 'ncurses'
derivations to be unchanged when not targetting mingw, by doing these
tests on the client side instead of the build side.  Remember that these
backquoted excerpts of code are being generated on the client side to be
run later on the build side, so we should be able to arrange for this
generated code to be unchanged except on mingw.  However, dealing with
the patch will be a bit ugly.  The job of modifying would
have to be moved to a phase.

I'll try to find time in the next day or two to attempt this, and see if
it can be done reasonably or if the resulting code would be too nasty to

Thanks for working on this.



diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
index cf502f4..3af1700 100644
--- a/gnu/packages/ncurses.scm
+++ b/gnu/packages/ncurses.scm
@@ -71,15 +71,12 @@ 
          `(lambda* (#:key outputs target #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
-                  (mingw-target? (lambda* (#:optional (target target))
-                                   (and target
-                                        (string-suffix? "-mingw32" target))))
                   (libraries '("curses" "ncurses" "form" "panel" "menu")))
               ;; When building a wide-character (Unicode) build, create backward
               ;; compatibility links from the the "normal" libraries to the
               ;; wide-character libraries (e.g. to
-               ((mingw-target? target)
+               ((explicit-mingw-target? target)
                 (with-directory-excursion (string-append out "/bin")
                    (lambda (lib)
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 2988193..8b1c417 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -41,6 +41,7 @@ 
+            explicit-mingw-target?
@@ -140,6 +141,10 @@  introduce the version part."
     (and s
          (not (zero? (logand (stat:mode s) #o100))))))
+(define (explicit-mingw-target? target)
+  (and target
+       (string-suffix? "-mingw32" target)))
 (define (symbolic-link? file)
   "Return #t if FILE is a symbolic link (aka. \"symlink\".)"
   (eq? (stat:type (lstat file)) 'symlink))
diff --git a/guix/utils.scm b/guix/utils.scm
index e44504c..ebd9a0d 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -33,7 +33,7 @@ 
   #:use-module (rnrs io ports)
   #:use-module ((rnrs bytevectors) #:select (bytevector-u8-set!))
   #:use-module (guix combinators)
-  #:use-module ((guix build utils) #:select (dump-port))
+  #:use-module ((guix build utils) #:select (dump-port explicit-mingw-target?))
   #:use-module ((guix build syscalls) #:select (mkdtemp! fdatasync))
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 format)
@@ -489,8 +489,7 @@  returned by `config.guess'."
   (make-parameter #f))
 (define* (mingw-target? #:optional (target (%current-target-system)))
-  (and target
-       (string-suffix? "-mingw32" target)))
+  (explicit-mingw-target? target))
 (define (package-name->name+version spec)
   "Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"