unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#37870] [PATCH] gnu: make-nsis: Fix cross-compilation.
@ 2019-10-22 16:14 Carl Dong
  2019-10-29 16:02 ` [bug#37870] [PATCH v2] " Carl Dong
  2019-10-29 20:11 ` [bug#37870] [PATCH v3] " Carl Dong
  0 siblings, 2 replies; 9+ messages in thread
From: Carl Dong @ 2019-10-22 16:14 UTC (permalink / raw)
  To: 37870

Hi all, here's the somewhat hacky patch from #37801, I will follow up on #30756
about using `-idirafter` as a potentially cleaner fix for #30756, but this
should make nsis work for now!

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

diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
index c987254d61..e5e38af152 100644
--- a/gnu/packages/installers.scm
+++ b/gnu/packages/installers.scm
@@ -92,7 +92,21 @@
                              ;; 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-append
+                                 (string-join
+                                  (map (lambda (x) (string-append (assoc-ref %build-inputs "xgcc") x))
+                                       `("/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
--
2.23.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#37870] [PATCH v2] gnu: make-nsis: Fix cross-compilation.
  2019-10-22 16:14 [bug#37870] [PATCH] gnu: make-nsis: Fix cross-compilation Carl Dong
@ 2019-10-29 16:02 ` Carl Dong
  2019-10-29 19:22   ` Efraim Flashner
  2019-10-29 20:11 ` [bug#37870] [PATCH v3] " Carl Dong
  1 sibling, 1 reply; 9+ messages in thread
From: Carl Dong @ 2019-10-29 16:02 UTC (permalink / raw)
  To: 37870@debbugs.gnu.org

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"))
+                                   ,(getenv "CROSS_CPATH"))
+                                 ":"))))
                     (add-before 'build 'fix-target-detection
                       (lambda _
                         ;; NSIS target detection is screwed up, manually
--
2.23.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#37870] [PATCH v2] gnu: make-nsis: Fix cross-compilation.
  2019-10-29 16:02 ` [bug#37870] [PATCH v2] " Carl Dong
@ 2019-10-29 19:22   ` Efraim Flashner
  2019-11-04 22:11     ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Efraim Flashner @ 2019-10-29 19:22 UTC (permalink / raw)
  To: Carl Dong; +Cc: 37870@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 2663 bytes --]

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
> 
> 
> 

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#37870] [PATCH v3] gnu: make-nsis: Fix cross-compilation.
  2019-10-22 16:14 [bug#37870] [PATCH] gnu: make-nsis: Fix cross-compilation Carl Dong
  2019-10-29 16:02 ` [bug#37870] [PATCH v2] " Carl Dong
@ 2019-10-29 20:11 ` Carl Dong
  2019-10-30  7:42   ` Efraim Flashner
                     ` (3 more replies)
  1 sibling, 4 replies; 9+ messages in thread
From: Carl Dong @ 2019-10-29 20:11 UTC (permalink / raw)
  To: 37870@debbugs.gnu.org

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
--
2.23.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#37870] [PATCH v3] gnu: make-nsis: Fix cross-compilation.
  2019-10-29 20:11 ` [bug#37870] [PATCH v3] " Carl Dong
@ 2019-10-30  7:42   ` Efraim Flashner
  2019-11-05 13:58   ` Ludovic Courtès
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Efraim Flashner @ 2019-10-30  7:42 UTC (permalink / raw)
  To: Carl Dong; +Cc: 37870@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 3758 bytes --]

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

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#37870] [PATCH v2] gnu: make-nsis: Fix cross-compilation.
  2019-10-29 19:22   ` Efraim Flashner
@ 2019-11-04 22:11     ` Ludovic Courtès
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2019-11-04 22:11 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 37870@debbugs.gnu.org, Carl Dong

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’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#37870] [PATCH v3] gnu: make-nsis: Fix cross-compilation.
  2019-10-29 20:11 ` [bug#37870] [PATCH v3] " Carl Dong
  2019-10-30  7:42   ` Efraim Flashner
@ 2019-11-05 13:58   ` Ludovic Courtès
  2019-11-16 16:25   ` bug#37870: " Ludovic Courtès
  2019-11-16 16:25   ` [bug#37870] " Ludovic Courtès
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2019-11-05 13:58 UTC (permalink / raw)
  To: Carl Dong; +Cc: 37870@debbugs.gnu.org

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’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37870: [PATCH v3] gnu: make-nsis: Fix cross-compilation.
  2019-10-29 20:11 ` [bug#37870] [PATCH v3] " Carl Dong
  2019-10-30  7:42   ` Efraim Flashner
  2019-11-05 13:58   ` Ludovic Courtès
@ 2019-11-16 16:25   ` Ludovic Courtès
  2019-11-16 16:25   ` [bug#37870] " Ludovic Courtès
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2019-11-16 16:25 UTC (permalink / raw)
  To: Carl Dong; +Cc: 37870@debbugs.gnu.org

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'.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#37870] [PATCH v3] gnu: make-nsis: Fix cross-compilation.
  2019-10-29 20:11 ` [bug#37870] [PATCH v3] " Carl Dong
                     ` (2 preceding siblings ...)
  2019-11-16 16:25   ` bug#37870: " Ludovic Courtès
@ 2019-11-16 16:25   ` Ludovic Courtès
  3 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2019-11-16 16:25 UTC (permalink / raw)
  To: Carl Dong; +Cc: 37870@debbugs.gnu.org

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'.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-11-16 16:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-22 16:14 [bug#37870] [PATCH] gnu: make-nsis: Fix cross-compilation Carl Dong
2019-10-29 16:02 ` [bug#37870] [PATCH v2] " Carl Dong
2019-10-29 19:22   ` Efraim Flashner
2019-11-04 22:11     ` Ludovic Courtès
2019-10-29 20:11 ` [bug#37870] [PATCH v3] " Carl Dong
2019-10-30  7:42   ` Efraim Flashner
2019-11-05 13:58   ` Ludovic Courtès
2019-11-16 16:25   ` bug#37870: " Ludovic Courtès
2019-11-16 16:25   ` [bug#37870] " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).