gnu: make-nsis: Fix cross-compilation.

* gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
ordering of search paths (mingw-w64 last).
This commit is contained in:
Carl Dong 2019-10-22 11:09:46 -04:00
parent dae206f1f2
commit 2148674372
No known key found for this signature in database
GPG key ID: 0CC52153197991A5

View file

@ -28,7 +28,10 @@ (define-module (gnu packages installers)
#:use-module (guix utils)) #:use-module (guix utils))
(define (make-nsis machine target-arch nsis-target-type) (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 (package
(name (string-append "nsis-" machine)) (name (string-append "nsis-" machine))
(version "3.04") (version "3.04")
@ -41,13 +44,14 @@ (define (make-nsis machine target-arch nsis-target-type)
"1xgllk2mk36ll2509hd31mfq6blgncmdzmwxj3ymrwshdh23d5b0")) "1xgllk2mk36ll2509hd31mfq6blgncmdzmwxj3ymrwshdh23d5b0"))
(patches (search-patches "nsis-env-passthru.patch")))) (patches (search-patches "nsis-env-passthru.patch"))))
(build-system scons-build-system) (build-system scons-build-system)
(native-inputs `(("xgcc" ,(cross-gcc triplet #:libc (cross-libc triplet))) (native-inputs `(("xgcc" ,xgcc)
("xbinutils" ,(cross-binutils triplet)) ("xbinutils" ,xbinutils)
("mingw-w64" ,(cross-libc triplet)))) ("mingw-w64" ,xlibc)))
(inputs `(("zlib" ,zlib))) (inputs `(("zlib" ,zlib)))
(arguments (arguments
`(#:scons ,scons-python2 `(#:scons ,scons-python2
#:modules ((srfi srfi-1) #:modules ((srfi srfi-1)
(srfi srfi-26)
(guix build utils) (guix build utils)
(guix build scons-build-system)) (guix build scons-build-system))
#:tests? #f #:tests? #f
@ -92,7 +96,20 @@ (define (mingw-path? path)
;; CROSS_-prefixed version of env vars ;; CROSS_-prefixed version of env vars
(setenv (string-append "CROSS_" env-name) (setenv (string-append "CROSS_" env-name)
(filter-delimited-string env-val mingw-path?)))) (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 (add-before 'build 'fix-target-detection
(lambda _ (lambda _
;; NSIS target detection is screwed up, manually ;; NSIS target detection is screwed up, manually