From patchwork Tue Mar 10 08:31:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 20620 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 5DA8827BBE4; Tue, 10 Mar 2020 08:37:45 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 05B6F27BBE4 for ; Tue, 10 Mar 2020 08:37:45 +0000 (GMT) Received: from localhost ([::1]:55342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBaOW-0004Us-Io for patchwork@mira.cbaines.net; Tue, 10 Mar 2020 04:37:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40747) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBaK1-0005Bx-Rg for guix-patches@gnu.org; Tue, 10 Mar 2020 04:33:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBaK0-0004jk-4q for guix-patches@gnu.org; Tue, 10 Mar 2020 04:33:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jBaJy-0004i0-5V for guix-patches@gnu.org; Tue, 10 Mar 2020 04:33:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jBaJy-0001v9-3U for guix-patches@gnu.org; Tue, 10 Mar 2020 04:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#39943] [PATCH v2 1/4] gnu: grpc: Build shared libraries. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 10 Mar 2020 08:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39943 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39943@debbugs.gnu.org Cc: Efraim Flashner Received: via spool by 39943-submit@debbugs.gnu.org id=B39943.15838291537335 (code B ref 39943); Tue, 10 Mar 2020 08:33:02 +0000 Received: (at 39943) by debbugs.gnu.org; 10 Mar 2020 08:32:33 +0000 Received: from localhost ([127.0.0.1]:51805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBaJR-0001uA-Tq for submit@debbugs.gnu.org; Tue, 10 Mar 2020 04:32:33 -0400 Received: from flashner.co.il ([178.62.234.194]:46290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBaJO-0001tX-4N for 39943@debbugs.gnu.org; Tue, 10 Mar 2020 04:32:27 -0400 Received: from localhost (unknown [141.226.13.108]) by flashner.co.il (Postfix) with ESMTPSA id 4A42240248; Tue, 10 Mar 2020 08:32:20 +0000 (UTC) From: Efraim Flashner Date: Tue, 10 Mar 2020 10:31:02 +0200 Message-Id: <20200310083105.21013-2-efraim@flashner.co.il> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200310083105.21013-1-efraim@flashner.co.il> References: <20200310083105.21013-1-efraim@flashner.co.il> 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/machine-learning.scm (grpc)[outputs]: Add static. [arguments]: Copy configure-flags from cmake-build-system. Add custom phases 'configure-shared, 'install-shared-libraries and 'move-static-libs to build shared libs and move static libs to their own output. (tensorflow)[native-inputs]: Add grpc:static. --- gnu/packages/machine-learning.scm | 43 ++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 50c41dc113..52e639723b 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus -;;; Copyright © 2016 Efraim Flashner +;;; Copyright © 2016, 2020 Efraim Flashner ;;; Copyright © 2016, 2017 Marius Bakke ;;; Copyright © 2016 Hartmut Goebel ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice @@ -1285,6 +1285,7 @@ Python.") (package (name "grpc") (version "1.16.1") + (outputs '("out" "static")) (source (origin (method git-fetch) (uri (git-reference @@ -1301,7 +1302,42 @@ Python.") (list "-DgRPC_ZLIB_PROVIDER=package" "-DgRPC_CARES_PROVIDER=package" "-DgRPC_SSL_PROVIDER=package" - "-DgRPC_PROTOBUF_PROVIDER=package"))) + "-DgRPC_PROTOBUF_PROVIDER=package" + (string-append "-DCMAKE_INSTALL_PREFIX=" + (assoc-ref %outputs "out")) + "-DCMAKE_INSTALL_LIBDIR=lib" + (string-append "-DCMAKE_INSTALL_RPATH=" + (assoc-ref %outputs "out") "/lib") + "-DCMAKE_VERBOSE_MAKEFILE=ON") + #:phases + (modify-phases %standard-phases + (add-before 'configure 'configure-shared + (lambda* (#:key (configure-flags '()) #:allow-other-keys) + (mkdir "../build-shared") + (with-directory-excursion "../build-shared" + (apply invoke + "cmake" "../source" + "-DBUILD_SHARED_LIBS=ON" + configure-flags) + (apply invoke "make" + `("-j" ,(number->string (parallel-job-count))))))) + (add-after 'install 'install-shared-libraries + (lambda _ + (with-directory-excursion "../build-shared" + (invoke "make" "install")))) + (add-before 'strip 'move-static-libs + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (static (assoc-ref outputs "static"))) + (mkdir-p (string-append static "/lib")) + (with-directory-excursion + (string-append out "/lib") + (for-each + (lambda (file) + (rename-file file + (string-append static "/lib/" file))) + (find-files "." "\\.a$")))) + #t))))) (inputs `(("c-ares" ,c-ares/cmake) ("openssl" ,openssl) @@ -1731,6 +1767,7 @@ INSTALL_RPATH " (assoc-ref outputs "out") "/lib)\n"))) (sha256 (base32 "161g9841rjfsy5pn52fcis0s9hdr7rxvb06pad38j5rppfihvign"))))) + ("grpc" ,grpc "static") ("googletest" ,googletest) ("swig" ,swig) ("unzip" ,unzip))) @@ -1752,7 +1789,7 @@ INSTALL_RPATH " (assoc-ref outputs "out") "/lib)\n"))) ("libjpeg" ,libjpeg) ("libpng" ,libpng) ("giflib" ,giflib) - ("grpc" ,grpc) + ("grpc:bin" ,grpc) ("jsoncpp" ,jsoncpp-for-tensorflow) ("snappy" ,snappy) ("sqlite" ,sqlite)