[bug#36477,09/31] gnu: http-parser: Fix cross-compilation.
diff mbox series

Message ID 20190708095913.3460-10-m.othacehe@gmail.com
State New
Headers show
Series
  • Fix cross-compilation issues
Related show

Commit Message

Mathieu Othacehe July 8, 2019, 9:58 a.m. UTC
* gnu/packages/web.scm (http-parser)[arguments]: Set CC and AR variables in
Makefile in order to fix cross-compilation.
---
 gnu/packages/web.scm | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Marius Bakke July 8, 2019, 5:46 p.m. UTC | #1
Mathieu Othacehe <m.othacehe@gmail.com> writes:

> * gnu/packages/web.scm (http-parser)[arguments]: Set CC and AR variables in
> Makefile in order to fix cross-compilation.

[...]

> @@ -5171,10 +5172,18 @@ into your tests.  It automatically starts up a HTTP server in a separate thread
>         #:make-flags
>         (list (string-append "PREFIX="
>                              (assoc-ref %outputs "out"))
> -             "CC=gcc" "library")
> +             "library")
>         #:phases
>         (modify-phases %standard-phases
> -         (delete 'configure))))
> +         (replace 'configure
> +           (lambda* (#:key target #:allow-other-keys)
> +             (when ,(%current-target-system)
> +               (substitute* (find-files "." "Makefile")
> +                 (("CC\\?=.*$")
> +                  (string-append "CC=" target "-gcc\n"))
> +                 (("AR\\?=.*$")
> +                  (string-append "AR=" target "-ar\n"))))
> +             #t)))))

I would prefer to splice in this phase instead of adding a noop phase to
the native build.  LGTM otherwise.

(so I guess CC=gcc was not needed for native builds?)

Patch
diff mbox series

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 1d9190ef63..589997e832 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -33,6 +33,7 @@ 
 ;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2019 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5171,10 +5172,18 @@  into your tests.  It automatically starts up a HTTP server in a separate thread
        #:make-flags
        (list (string-append "PREFIX="
                             (assoc-ref %outputs "out"))
-             "CC=gcc" "library")
+             "library")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (replace 'configure
+           (lambda* (#:key target #:allow-other-keys)
+             (when ,(%current-target-system)
+               (substitute* (find-files "." "Makefile")
+                 (("CC\\?=.*$")
+                  (string-append "CC=" target "-gcc\n"))
+                 (("AR\\?=.*$")
+                  (string-append "AR=" target "-ar\n"))))
+             #t)))))
     (synopsis "HTTP request/response parser for C")
     (description "This is a parser for HTTP messages written in C.  It parses
 both requests and responses.  The parser is designed to be used in