Alex Kost writes: >> + (add-before 'configure 'setenv >> + (lambda* (#:key inputs native-inputs #:allow-other-keys) > > It looks like 'native-inputs' is not needed, as it is not used further.
Indeed, dropped. >> + (let ((xgcc (assoc-ref inputs "xgcc"))) >> + (setenv "CPP" (string-append xgcc "/bin/" >> + ,target "-cpp")) >> + (setenv "CXXCPP" (string-append xgcc "/bin/" >> + ,target "-cpp"))) > > Since the values are the same, what about: > > (let* ((xgcc (assoc-ref inputs "xgcc")) > (xgcc-bin (string-append xgcc "/bin/" ,target "-cpp"))) > (setenv "CPP" xgcc-bin) > (setenv "CXXCPP" xgcc-bin)) That's better, thanks. >> + (for-each (lambda (var) >> + (and=> (getenv var) >> + (lambda (value) >> + (let ((cross >> + (string-append "CROSS_" >> var))) >> + (setenv cross value)) >> + (unsetenv var)))) >> + '("C_INCLUDE_PATH" >> + "CPLUS_INCLUDE_PATH" >> + "OBJC_INCLUDE_PATH" >> + "OBJCPLUS_INCLUDE_PATH" >> + "LIBRARY_PATH")) > > I have already seen this list of environment variables in an earlier > patch. Perhaps it would be reasonable to make some global variable with > this list and to put it in (guix build utils) or another appropriate > place, WDYT? I have quicke tested the additional patch below which seems to work. It would need some more testing. How do you like that? Greetings, Jan diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index f6c30ec..0d36143 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -45,6 +45,15 @@ ;; be 'gcc' and can be a specific variant such as 'gcc-4.8'. gcc) +(define gcc-include-paths + '("C_INCLUDE_PATH" + "CPLUS_INCLUDE_PATH" + "OBJC_INCLUDE_PATH" + "OBJCPLUS_INCLUDE_PATH")) + +(define gcc-cross-include-paths + (map (cut string-append "CROSS_" <>) gcc-include-paths)) + (define (cross p target) (package (inherit p) (name (string-append (package-name p) "-cross-" target)) @@ -204,10 +213,7 @@ may be either a libc package or #f.)" libc "/include" ":" libc "/i686-w64-mingw32/include"))) (for-each (cut setenv <> cpath) - '("CROSS_C_INCLUDE_PATH" - "CROSS_CPLUS_INCLUDE_PATH" - "CROSS_OBJC_INCLUDE_PATH" - "CROSS_OBJCPLUS_INCLUDE_PATH"))) + ',gcc-cross-include-paths)) ;; libc is false, so we are building xgcc-sans-libc ;; Add essential headers from mingw-w64. (let ((mingw-source (assoc-ref inputs "mingw-source"))) @@ -231,11 +237,9 @@ may be either a libc package or #f.)" ":" mingw-headers "/crt" ":" mingw-headers "/defaults/include"))) (for-each (cut setenv <> cpath) - '("CROSS_C_INCLUDE_PATH" - "CROSS_CPLUS_INCLUDE_PATH" - "CROSS_OBJC_INCLUDE_PATH" - "CROSS_OBJCPLUS_INCLUDE_PATH" - "CROSS_LIBRARY_PATH")))) + (cons + "CROSS_LIBRARY_PATH" + ',gcc-cross-include-paths)))) (when libc (setenv "CROSS_LIBRARY_PATH" (string-append @@ -251,11 +255,7 @@ may be either a libc package or #f.)" (native-path (list->search-path-as-string (remove cross? path) ":"))) (setenv var native-path))))) - '("C_INCLUDE_PATH" - "CPLUS_INCLUDE_PATH" - "OBJC_INCLUDE_PATH" - "OBJCPLUS_INCLUDE_PATH" - "LIBRARY_PATH")) + (cons "LIBRARY_PATH" ',gcc-include-paths)) #t))))) (libc `(alist-cons-before @@ -272,11 +272,7 @@ may be either a libc package or #f.)" (let ((cpath (string-append libc "/include" ":" kernel "/include"))) - (for-each (cut setenv <> cpath) - '("CROSS_C_INCLUDE_PATH" - "CROSS_CPLUS_INCLUDE_PATH" - "CROSS_OBJC_INCLUDE_PATH" - "CROSS_OBJCPLUS_INCLUDE_PATH"))) + (for-each (cut setenv <> cpath) ',gcc-cross-include-paths)) (setenv "CROSS_LIBRARY_PATH" (string-append libc "/lib:" kernel "/lib")) ;for Hurd's libihash @@ -288,11 +284,7 @@ may be either a libc package or #f.)" (native-path (list->search-path-as-string (remove cross? path) ":"))) (setenv var native-path))))) - '("C_INCLUDE_PATH" - "CPLUS_INCLUDE_PATH" - "OBJC_INCLUDE_PATH" - "OBJCPLUS_INCLUDE_PATH" - "LIBRARY_PATH")) + (cons "LIBRARY_PATH" ',gcc-include-paths)) #t)) ,phases)) (else phases)))))))) @@ -382,21 +374,16 @@ GCC that does not target a libc; otherwise, target that libc." ;; Only search target inputs, not host inputs. ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'. (search-paths - (list (search-path-specification - (variable "CROSS_C_INCLUDE_PATH") - (files '("include"))) - (search-path-specification - (variable "CROSS_CPLUS_INCLUDE_PATH") - (files '("include"))) - (search-path-specification - (variable "CROSS_OBJC_INCLUDE_PATH") - (files '("include"))) - (search-path-specification - (variable "CROSS_OBJCPLUS_INCLUDE_PATH") - (files '("include"))) - (search-path-specification - (variable "CROSS_LIBRARY_PATH") - (files '("lib" "lib64"))))) + (cons + (search-path-specification + (variable "CROSS_LIBRARY_PATH") + (files '("lib" "lib64"))) + (map + (lambda (path) + (search-path-specification + (variable path) + (files '("include")))) + gcc-cross-include-paths))) (native-search-paths '()))) (define* (cross-libc target @@ -458,11 +445,7 @@ XBINUTILS and the cross tool chain." (lambda* (#:key inputs #:allow-other-keys) (let* ((kernel (assoc-ref inputs "kernel-headers")) (cpath (string-append kernel "/include"))) - (for-each (cut setenv <> cpath) - '("CROSS_C_INCLUDE_PATH" - "CROSS_CPLUS_INCLUDE_PATH" - "CROSS_OBJC_INCLUDE_PATH" - "CROSS_OBJCPLUS_INCLUDE_PATH")) + (for-each (cut setenv <> cpath) ',gcc-cross-include-paths) #t)) ,phases)))) @@ -509,12 +492,12 @@ XBINUTILS and the cross tool chain." ;; As we are setup as a cross package, PATHs get setup ;; without the CROSS_ prefix. Change that here. (add-before 'configure 'setenv - (lambda* (#:key inputs native-inputs #:allow-other-keys) - (let ((xgcc (assoc-ref inputs "xgcc"))) - (setenv "CPP" (string-append xgcc "/bin/" - ,target "-cpp")) - (setenv "CXXCPP" (string-append xgcc "/bin/" - ,target "-cpp"))) + (lambda* (#:key inputs #:allow-other-keys) + (let* ((xgcc (assoc-ref inputs "xgcc")) + (xgcc-bin (string-append xgcc "/bin/" + ,target "-cpp"))) + (setenv "CPP" xgcc-bin) + (setenv "CXXCPP" xgcc-bin)) (for-each (lambda (var) (and=> (getenv var) (lambda (value) @@ -522,11 +505,7 @@ XBINUTILS and the cross tool chain." (string-append "CROSS_" var))) (setenv cross value)) (unsetenv var)))) - '("C_INCLUDE_PATH" - "CPLUS_INCLUDE_PATH" - "OBJC_INCLUDE_PATH" - "OBJCPLUS_INCLUDE_PATH" - "LIBRARY_PATH")) + (cons "LIBRARY_PATH" ',gcc-include-paths)) #t))))))) (define (native-libc target) -- Jan Nieuwenhuizen <jann...@gnu.org> | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.nl