[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Cross-compiling parts and not cross-compiling other parts of a package
From: |
Danny Milosavljevic |
Subject: |
Cross-compiling parts and not cross-compiling other parts of a package |
Date: |
Mon, 4 Sep 2017 15:57:31 +0200 |
Hi,
I've now needed custom modifications in order to enable cross-compilation of a
part of a package in two packages, sunxi-tools and rustc.
Both have this part in a custom phase:
(define (cross? x)
(string-contains x "cross-"))
(setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
(setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
(setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
(for-each
(lambda (env-name)
(let* ((env-value (getenv env-name))
(search-path (search-path-as-string->list env-value))
(new-search-path (filter (lambda (e) (not (cross? e)))
search-path))
(new-env-value (list->search-path-as-string
new-search-path ":")))
(setenv env-name new-env-value)))
'("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
Would it be possible and advisable to have this as a default phase one day?
Regardless of whether default or not, it can then be used like this:
(native-inputs
...
("cross-gcc" ,(cross-gcc "i686-linux-gnu"
#:xbinutils (cross-binutils "i686-linux-gnu")
#:libc (cross-libc "i686-linux-gnu")))
("cross-libc" ,(cross-libc "i686-linux-gnu")))))
The cross-* compilers would use the CROSS_* environment variables and the
native compiler would use the non-CROSS_* environment variables.
- Cross-compiling parts and not cross-compiling other parts of a package,
Danny Milosavljevic <=