all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: 39943@debbugs.gnu.org
Cc: Efraim Flashner <efraim@flashner.co.il>
Subject: [bug#39943] [PATCH v2 1/4] gnu: grpc: Build shared libraries.
Date: Tue, 10 Mar 2020 10:31:02 +0200	[thread overview]
Message-ID: <20200310083105.21013-2-efraim@flashner.co.il> (raw)
In-Reply-To: <20200310083105.21013-1-efraim@flashner.co.il>

* 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 <rekado@elephly.net>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
@@ -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)
-- 
2.25.1

  reply	other threads:[~2020-03-10  8:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06  9:23 [bug#39943] [PATCH 0/3] WIP: Hyperledger Iroha Pierre Neidhardt
2020-03-06  9:41 ` [bug#39943] [PATCH 1/3] gnu: Add fmt-5 Pierre Neidhardt
2020-03-06  9:41   ` [bug#39943] [PATCH 2/3] gnu: Add hyperledger-iroha-ed25519 Pierre Neidhardt
2020-03-10  8:31 ` [bug#39943] [PATCH v2 0/4] WIP: Hyperledger Iroha Efraim Flashner
2020-03-10  8:31   ` Efraim Flashner [this message]
2020-03-10  8:31   ` [bug#39943] [PATCH v2 2/4] gnu: Add hyperledger-iroha-ed25519 Efraim Flashner
2020-03-10  8:31   ` [bug#39943] [PATCH v2 3/4] gnu: Add boost-1.69 Efraim Flashner
2020-03-10  8:31   ` [bug#39943] [PATCH v2 4/4] gnu: Add hyperledger-iroha Efraim Flashner
2020-03-11 14:13     ` Pierre Neidhardt
2020-03-12 13:40       ` bug#39943: " Efraim Flashner
2020-03-12 13:45         ` [bug#39943] " Pierre Neidhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200310083105.21013-2-efraim@flashner.co.il \
    --to=efraim@flashner.co.il \
    --cc=39943@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.