unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Cross-compiling parts and not cross-compiling other parts of a package
@ 2017-09-04 13:57 Danny Milosavljevic
  2017-09-05 12:32 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Danny Milosavljevic @ 2017-09-04 13:57 UTC (permalink / raw)
  To: guix-devel

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.

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

end of thread, other threads:[~2017-09-05 12:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-04 13:57 Cross-compiling parts and not cross-compiling other parts of a package Danny Milosavljevic
2017-09-05 12:32 ` 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).