From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <20170904155731.117569c4@scratchpost.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dorsm-0002ic-KL for guix-devel@gnu.org; Mon, 04 Sep 2017 09:57:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dorsh-0001ia-Md for guix-devel@gnu.org; Mon, 04 Sep 2017 09:57:44 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:43134) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dorsh-0001hT-FU for guix-devel@gnu.org; Mon, 04 Sep 2017 09:57:39 -0400 Received: from localhost (77.118.189.105.wireless.dyn.drei.com [77.118.189.105]) by dd1012.kasserver.com (Postfix) with ESMTPSA id 27D5C1CA06A8 for ; Mon, 4 Sep 2017 15:57:36 +0200 (CEST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" 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.