diff mbox series

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

Message ID EQNLmjJBBcJXGAF1D92CqQkWfqqQkZopkruRXOCXxhntb-csvlu86yS1euXz9CvWa47WdcK_SWVRJH7t5-FY3z4466749_jGiX6BXXHFwC0=@carldong.me
State Accepted
Headers show
Series [bug#37870,v3] gnu: make-nsis: Fix cross-compilation. | expand

Commit Message

Carl Dong Oct. 29, 2019, 8:11 p.m. UTC
Updated the patch to address Efraim's suggestion.

-----

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

--
2.23.0

Comments

Efraim Flashner Oct. 30, 2019, 7:42 a.m. UTC | #1
On Tue, Oct 29, 2019 at 08:11:22PM +0000, Carl Dong wrote:
> Updated the patch to address Efraim's suggestion.
> 
> -----
> 
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).
> ---
>  gnu/packages/installers.scm | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
> index c987254d61..9229359fdf 100644
> --- a/gnu/packages/installers.scm
> +++ b/gnu/packages/installers.scm
> @@ -28,7 +28,10 @@
>    #:use-module (guix utils))
> 
>  (define (make-nsis machine target-arch nsis-target-type)
> -  (let ((triplet (string-append machine "-" "w64-mingw32")))
> +  (let* ((triplet (string-append machine "-" "w64-mingw32"))
> +         (xbinutils (cross-binutils triplet))
> +         (xlibc (cross-libc triplet))
> +         (xgcc (cross-gcc triplet #:libc xlibc)))
>      (package
>        (name (string-append "nsis-" machine))
>        (version "3.04")
> @@ -41,13 +44,14 @@
>                    "1xgllk2mk36ll2509hd31mfq6blgncmdzmwxj3ymrwshdh23d5b0"))
>                  (patches (search-patches "nsis-env-passthru.patch"))))
>        (build-system scons-build-system)
> -      (native-inputs `(("xgcc" ,(cross-gcc triplet #:libc (cross-libc triplet)))
> -                       ("xbinutils" ,(cross-binutils triplet))
> -                       ("mingw-w64" ,(cross-libc triplet))))
> +      (native-inputs `(("xgcc" ,xgcc)
> +                       ("xbinutils" ,xbinutils)
> +                       ("mingw-w64" ,xlibc)))
>        (inputs `(("zlib" ,zlib)))
>        (arguments
>         `(#:scons ,scons-python2
>           #:modules ((srfi srfi-1)
> +                    (srfi srfi-26)
>                      (guix build utils)
>                      (guix build scons-build-system))
>           #:tests? #f
> @@ -92,7 +96,20 @@
>                               ;; 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"
> +                                            ,@(map (cut string-append "/lib/gcc/" ,triplet "/" ,(package-version xgcc) <>)
> +                                                   '("/include"
> +                                                     "/include-fixed"))))
> +                                   ,(getenv "CROSS_CPATH"))
> +                                 ":"))))
>                      (add-before 'build 'fix-target-detection
>                        (lambda _
>                          ;; NSIS target detection is screwed up, manually

I haven't tested it, but it looks good to me
Ludovic Courtès Nov. 5, 2019, 1:58 p.m. UTC | #2
Hi,

Carl Dong <contact@carldong.me> skribis:

> Updated the patch to address Efraim's suggestion.
>
> -----
>
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).

LGTM as well!

(I replied yesterday and hadn’t seen you had already posted an updated
patch—sorry about that!)

Ludo’.
Ludovic Courtès Nov. 16, 2019, 4:25 p.m. UTC | #3
Carl Dong <contact@carldong.me> skribis:

> Updated the patch to address Efraim's suggestion.
>
> -----
>
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).
> ---
>  gnu/packages/installers.scm | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)

That was pushed as 2148674372cacc58fbb9d9914010cf0bd9376f1b, closing!

Ludo'.
Ludovic Courtès Nov. 16, 2019, 4:25 p.m. UTC | #4
Carl Dong <contact@carldong.me> skribis:

> Updated the patch to address Efraim's suggestion.
>
> -----
>
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).
> ---
>  gnu/packages/installers.scm | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)

That was pushed as 2148674372cacc58fbb9d9914010cf0bd9376f1b, closing!

Ludo'.
diff mbox series

Patch

diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
index c987254d61..9229359fdf 100644
--- a/gnu/packages/installers.scm
+++ b/gnu/packages/installers.scm
@@ -28,7 +28,10 @@ 
   #:use-module (guix utils))

 (define (make-nsis machine target-arch nsis-target-type)
-  (let ((triplet (string-append machine "-" "w64-mingw32")))
+  (let* ((triplet (string-append machine "-" "w64-mingw32"))
+         (xbinutils (cross-binutils triplet))
+         (xlibc (cross-libc triplet))
+         (xgcc (cross-gcc triplet #:libc xlibc)))
     (package
       (name (string-append "nsis-" machine))
       (version "3.04")
@@ -41,13 +44,14 @@ 
                   "1xgllk2mk36ll2509hd31mfq6blgncmdzmwxj3ymrwshdh23d5b0"))
                 (patches (search-patches "nsis-env-passthru.patch"))))
       (build-system scons-build-system)
-      (native-inputs `(("xgcc" ,(cross-gcc triplet #:libc (cross-libc triplet)))
-                       ("xbinutils" ,(cross-binutils triplet))
-                       ("mingw-w64" ,(cross-libc triplet))))
+      (native-inputs `(("xgcc" ,xgcc)
+                       ("xbinutils" ,xbinutils)
+                       ("mingw-w64" ,xlibc)))
       (inputs `(("zlib" ,zlib)))
       (arguments
        `(#:scons ,scons-python2
          #:modules ((srfi srfi-1)
+                    (srfi srfi-26)
                     (guix build utils)
                     (guix build scons-build-system))
          #:tests? #f
@@ -92,7 +96,20 @@ 
                              ;; 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"
+                                            ,@(map (cut string-append "/lib/gcc/" ,triplet "/" ,(package-version xgcc) <>)
+                                                   '("/include"
+                                                     "/include-fixed"))))
+                                   ,(getenv "CROSS_CPATH"))
+                                 ":"))))
                     (add-before 'build 'fix-target-detection
                       (lambda _
                         ;; NSIS target detection is screwed up, manually