From patchwork Mon Jul 8 09:58:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 14509 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E2012171D4; Mon, 8 Jul 2019 11:00:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 91BEB171D2 for ; Mon, 8 Jul 2019 11:00:20 +0100 (BST) Received: from localhost ([::1]:39996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkQRY-0005H4-4K for patchwork@mira.cbaines.net; Mon, 08 Jul 2019 06:00:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54708) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkQRN-00054I-9y for guix-patches@gnu.org; Mon, 08 Jul 2019 06:00:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkQRL-00030k-Ny for guix-patches@gnu.org; Mon, 08 Jul 2019 06:00:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49033) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hkQRL-00030Q-F6 for guix-patches@gnu.org; Mon, 08 Jul 2019 06:00:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hkQRK-0004sj-Vy for guix-patches@gnu.org; Mon, 08 Jul 2019 06:00:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#36477] [PATCH 02/31] gnu: python: Fix cross compilation. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Jul 2019 10:00:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36477 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 36477@debbugs.gnu.org Received: via spool by 36477-submit@debbugs.gnu.org id=B36477.156257997718358 (code B ref 36477); Mon, 08 Jul 2019 10:00:06 +0000 Received: (at 36477) by debbugs.gnu.org; 8 Jul 2019 09:59:37 +0000 Received: from localhost ([127.0.0.1]:57778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkQQn-0004lM-8d for submit@debbugs.gnu.org; Mon, 08 Jul 2019 05:59:37 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:42734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkQQm-0004kj-2T for 36477@debbugs.gnu.org; Mon, 08 Jul 2019 05:59:32 -0400 Received: by mail-wr1-f45.google.com with SMTP id a10so15230520wrp.9 for <36477@debbugs.gnu.org>; Mon, 08 Jul 2019 02:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4xZdoEDGHsADRH8szcihC5nhMfmn1KgFlVP2qHne3wU=; b=spkc95A1mSiWzQseJdymHr0pJJdkQ6p+P26wLVPLN4yGwFXfFAKl6vAyGS6QXU2v8A NajEYOvq2SxL3tpBo30PklWdG6Zsyv92i7IOxvwA/RXg7sIiOOPQde/0k1QFwtQT8oZp 4S4SwA2u2uMWqODOYJX/7H2sZP53y5Ebs7j14fdei1s+ItvO/Kc7c/Ls29/if533p1no 1igdrtWW4ygR3jkyQMZ0lCGYf+Of8Zn7E84zDiqBl0dTRry3Vvv1N+2rTMqL8uR437j5 nMbtblgzEvLFA7rjaNTndaqOVQhn+qMlLNKCuA2LB5y/qzADlPbTv1VjJVkHbYivSRt5 Zl8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4xZdoEDGHsADRH8szcihC5nhMfmn1KgFlVP2qHne3wU=; b=S9bhMhLyrngWPoelWVQ35N271i9qAZSyT5t5m1tB4LEk8DNRjKc/kZEpvpGIYSMXqM aXKrRM0AjR981TwJt06dw5mSSLQlMfEmQGWyBxmO2iEa1iu2hEp2ezKOhp+WOCLancwX rfBz36kkodSnidapGv34nBw4wSNW++4i/NJDXqPAbaLWogHNwxMPbXMOkmZWri1j35l2 Qhg2v9mUQemw4Q7X89Sk92vsTJ9Tk17/+b7zzndG5MXjFTtvd7ge8CHxdPBrTLeFb12m ExHEr3qi+czLmQe/KCQEgJ+RgPHtgEyvQ/xUjnrJ7m637J+R087pEugPLIpKNcnTJG7r JueQ== X-Gm-Message-State: APjAAAVQoG3ZlnF1W3w3axNxdBA24LBFqZKrDbCCes7IvKE+6hn+yfGh 9pSeuUA8oEd/lVhoMngn5B5BOSjT X-Google-Smtp-Source: APXvYqxtJuH0xD+nutcXcOJNe5uN+3E1k99AM+sFHwMQqU+QYnaSq59y2b9PNfZhpaKHHILLsl0Itg== X-Received: by 2002:adf:ef8d:: with SMTP id d13mr17394846wro.60.1562579965925; Mon, 08 Jul 2019 02:59:25 -0700 (PDT) Received: from fuji.Parrot.Biz (smtp.parrot.biz. [62.23.167.188]) by smtp.gmail.com with ESMTPSA id i66sm3165127wmi.11.2019.07.08.02.59.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 02:59:25 -0700 (PDT) From: Mathieu Othacehe Date: Mon, 8 Jul 2019 11:58:44 +0200 Message-Id: <20190708095913.3460-3-m.othacehe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190708095913.3460-1-m.othacehe@gmail.com> References: <20190708095913.3460-1-m.othacehe@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mathieu Othacehe Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/python.scm (python-2.7)[arguments]: Add a configure flag to disable a check failing when cross-compiling. This is covered here: https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html, [native-inputs]: Add self and which when cross-compiling, (python-3.7)[arguments]: Refer to native python when cross-compiling. --- gnu/packages/python.scm | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index aa92e82ac2..1a8cd39de2 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -38,7 +38,7 @@ ;;; Copyright © 2017 Frederick M. Muriithi ;;; Copyright © 2017, 2018 Adriano Peluso ;;; Copyright © 2017 Ben Sturmfels -;;; Copyright © 2017, 2018 Mathieu Othacehe +;;; Copyright © 2017, 2018, 2019 Mathieu Othacehe ;;; Copyright © 2017 José Miguel Sánchez García ;;; Copyright © 2017 Roel Janssen ;;; Copyright © 2017, 2018 Kei Kebreau @@ -76,6 +76,7 @@ (define-module (gnu packages python) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages compression) #:use-module (gnu packages dbm) @@ -134,6 +135,13 @@ "--with-system-ffi" ;build ctypes "--with-ensurepip=install" ;install pip and setuptools "--enable-unicode=ucs4" + ;; Disable runtime check failing if cross-compiling, see: + ;; https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html + ,@(if (%current-target-system) + '("ac_cv_buggy_getaddrinfo=no" + "ac_cv_file__dev_ptmx=no" + "ac_cv_file__dev_ptc=no") + '()) (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib")) @@ -246,7 +254,12 @@ ("tcl" ,tcl) ("tk" ,tk))) ; for tkinter (native-inputs - `(("pkg-config" ,pkg-config))) + `(("pkg-config" ,pkg-config) + ;; When cross-compiling, a native version of Python itself is needed. + ,@(if (%current-target-system) + `(("self" ,this-package) + ("which" ,which)) + '()))) (native-search-paths (list (search-path-specification (variable "PYTHONPATH") @@ -342,13 +355,16 @@ data types.") (if (null? opt) "none" (car opt))) (for-each (lambda (file) (apply invoke - `(,(string-append out "/bin/python3") - ,@opt - "-m" "compileall" - "-f" ; force rebuild - ;; Don't build lib2to3, because it's Python 2 code. - "-x" "lib2to3/.*" - ,file))) + `(,,(if (%current-target-system) + "python3" + '(string-append out + "/bin/python3")) + ,@opt + "-m" "compileall" + "-f" ; force rebuild + ;; Don't build lib2to3, because it's Python 2 code. + "-x" "lib2to3/.*" + ,file))) (find-files out "\\.py$"))) (list '() '("-O") '("-OO"))) #t)))))))