From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:41965) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4oLH-0001Ll-8Y for guix-patches@gnu.org; Mon, 02 Sep 2019 11:34:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4oLF-0002aN-RN for guix-patches@gnu.org; Mon, 02 Sep 2019 11:34:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49900) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i4oLF-0002a5-J1 for guix-patches@gnu.org; Mon, 02 Sep 2019 11:34:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i4oLF-0006RQ-CM for guix-patches@gnu.org; Mon, 02 Sep 2019 11:34:05 -0400 Subject: [bug#36477] [PATCH v3 02/48] gnu: openssl: Fix cross-compilation. Resent-Message-ID: From: Mathieu Othacehe Date: Mon, 2 Sep 2019 17:32:47 +0200 Message-Id: <20190902153333.11190-3-m.othacehe@gmail.com> In-Reply-To: <20190902153333.11190-1-m.othacehe@gmail.com> References: <20190902153333.11190-1-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 36477@debbugs.gnu.org Cc: Mathieu Othacehe * gnu/packages/tls.scm (openssl-next)[arguments]: Pass CROSS_COMPILE environment variable and target system to configure script. --- gnu/packages/tls.scm | 62 ++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm index f2e7f4ad0c..73aad0c230 100644 --- a/gnu/packages/tls.scm +++ b/gnu/packages/tls.scm @@ -13,6 +13,7 @@ ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2017 Rutger Helling ;;; Copyright © 2018 Clément Lassieur +;;; Copyright © 2019 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -300,6 +301,23 @@ required structures.") #:disallowed-references ,(list (canonical-package perl)) #:phases (modify-phases %standard-phases + ,@(if (%current-target-system) + '((add-before + 'configure 'set-cross-compile + (lambda* (#:key target outputs #:allow-other-keys) + (setenv "CROSS_COMPILE" (string-append target "-")) + (setenv "CONFIGURE_TARGET_ARCH" + (cond + ((string-prefix? "i686" target) + "linux-x86") + ((string-prefix? "x86_64" target) + "linux-x86_64") + ((string-prefix? "arm" target) + "linux-armv4") + ((string-prefix? "aarch64" target) + "linux-aarch64"))) + #t))) + '()) (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) @@ -309,7 +327,9 @@ required structures.") (("/usr/bin/env") (string-append (assoc-ref %build-inputs "coreutils") "/bin/env"))) - (invoke "./config" + (invoke ,@(if (%current-target-system) + '("./Configure") + '("./config")) "shared" ;build shared libraries "--libdir=lib" @@ -320,7 +340,10 @@ required structures.") "/share/openssl-" ,version) (string-append "--prefix=" out) - (string-append "-Wl,-rpath," lib))))) + (string-append "-Wl,-rpath," lib) + ,@(if (%current-target-system) + '((getenv "CONFIGURE_TARGET_ARCH")) + '()))))) (add-after 'install 'move-static-libraries (lambda* (#:key outputs #:allow-other-keys) ;; Move static libraries to the "static" output. @@ -416,21 +439,26 @@ required structures.") (("^MANDIR[[:blank:]]*=.*$") (string-append "MANDIR = " out "/share/man\n"))) #t))) - (replace 'configure - ;; Override this phase because OpenSSL 1.0 does not understand -rpath. - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) - (invoke "./config" - "shared" ;build shared libraries - "--libdir=lib" - - ;; The default for this catch-all directory is - ;; PREFIX/ssl. Change that to something more - ;; conventional. - (string-append "--openssldir=" out - "/share/openssl-" ,version) - - (string-append "--prefix=" out))))) + (replace 'configure + ;; Override this phase because OpenSSL 1.0 does not understand -rpath. + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (invoke ,@(if (%current-target-system) + '("./Configure") + '("./config")) + "shared" ;build shared libraries + "--libdir=lib" + + ;; The default for this catch-all directory is + ;; PREFIX/ssl. Change that to something more + ;; conventional. + (string-append "--openssldir=" out + "/share/openssl-" ,version) + + (string-append "--prefix=" out) + ,@(if (%current-target-system) + '((getenv "CONFIGURE_TARGET_ARCH")) + '()))))) (delete 'move-extra-documentation) (add-after 'install 'move-man3-pages (lambda* (#:key outputs #:allow-other-keys) -- 2.20.1