diff mbox series

[bug#37870,v2] gnu: make-nsis: Fix cross-compilation.

Message ID fKmAv1iXglLD_OTXBc8baRszgK0qQ0IcuOCTswisQymd2_89W5R7rNTuB8QB0FHjBmC-ZByc104-Sbua4aQsfo8jqYNwYrkkSsO-C_vzh6Q=@carldong.me
State Accepted
Headers show
Series [bug#37870,v2] gnu: make-nsis: Fix cross-compilation. | expand

Commit Message

Carl Dong Oct. 29, 2019, 4:02 p.m. UTC
Updated the patch to make it look a little better :-)
Will push to master tomorrow if no objections.

-----

* gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
ordering of search paths (mingw-w64 last).
---
 gnu/packages/installers.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

--
2.23.0

Comments

Efraim Flashner Oct. 29, 2019, 7:22 p.m. UTC | #1
On Tue, Oct 29, 2019 at 04:02:01PM +0000, Carl Dong wrote:
> Updated the patch to make it look a little better :-)
> Will push to master tomorrow if no objections.
> 
> -----
> 
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).
> ---
>  gnu/packages/installers.scm | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
> index c987254d61..035d38ac5a 100644
> --- a/gnu/packages/installers.scm
> +++ b/gnu/packages/installers.scm
> @@ -48,6 +48,7 @@
>        (arguments
>         `(#:scons ,scons-python2
>           #:modules ((srfi srfi-1)
> +                    (srfi srfi-26)
>                      (guix build utils)
>                      (guix build scons-build-system))
>           #:tests? #f
> @@ -92,7 +93,19 @@
>                               ;; CROSS_-prefixed version of env vars
>                               (setenv (string-append "CROSS_" env-name)
>                                       (filter-delimited-string env-val mingw-path?))))
> -                         '("CPLUS_INCLUDE_PATH" "LIBRARY_PATH" "C_INCLUDE_PATH"))))
> +                         '("CPATH" "LIBRARY_PATH"))
> +                        ;; Hack to place mingw-w64 path at the end of search
> +                        ;; paths.  Could probably use a specfile and dirafter
> +                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
> +                                (string-join
> +                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
> +                                          `("/include/c++"
> +                                            ,(string-append "/include/c++/" ,triplet)
> +                                            "/include/c++/backward"
> +                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include"
> +                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include-fixed"))
I'm going to suggest not hardcoding 7.4.0 here


> +                                   ,(getenv "CROSS_CPATH"))
> +                                 ":"))))
>                      (add-before 'build 'fix-target-detection
>                        (lambda _
>                          ;; NSIS target detection is screwed up, manually
> --
> 2.23.0
> 
> 
>
Ludovic Courtès Nov. 4, 2019, 10:11 p.m. UTC | #2
Hi,

Efraim Flashner <efraim@flashner.co.il> skribis:

> On Tue, Oct 29, 2019 at 04:02:01PM +0000, Carl Dong wrote:
>> Updated the patch to make it look a little better :-)
>> Will push to master tomorrow if no objections.

[...]

>> +                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
>> +                                (string-join
>> +                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
>> +                                          `("/include/c++"
>> +                                            ,(string-append "/include/c++/" ,triplet)
>> +                                            "/include/c++/backward"
>> +                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include"
>> +                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include-fixed"))
> I'm going to suggest not hardcoding 7.4.0 here

Agreed.  I guess you could extract the version number by calling
‘package-version’ on the dependency or something like that (on the
“host side”).

Thanks,
Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
index c987254d61..035d38ac5a 100644
--- a/gnu/packages/installers.scm
+++ b/gnu/packages/installers.scm
@@ -48,6 +48,7 @@ 
       (arguments
        `(#:scons ,scons-python2
          #:modules ((srfi srfi-1)
+                    (srfi srfi-26)
                     (guix build utils)
                     (guix build scons-build-system))
          #:tests? #f
@@ -92,7 +93,19 @@ 
                              ;; CROSS_-prefixed version of env vars
                              (setenv (string-append "CROSS_" env-name)
                                      (filter-delimited-string env-val mingw-path?))))
-                         '("CPLUS_INCLUDE_PATH" "LIBRARY_PATH" "C_INCLUDE_PATH"))))
+                         '("CPATH" "LIBRARY_PATH"))
+                        ;; Hack to place mingw-w64 path at the end of search
+                        ;; paths.  Could probably use a specfile and dirafter
+                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                                (string-join
+                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
+                                          `("/include/c++"
+                                            ,(string-append "/include/c++/" ,triplet)
+                                            "/include/c++/backward"
+                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include"
+                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include-fixed"))
+                                   ,(getenv "CROSS_CPATH"))
+                                 ":"))))
                     (add-before 'build 'fix-target-detection
                       (lambda _
                         ;; NSIS target detection is screwed up, manually