unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 47741@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#47741] [PATCH 1/3] gnu: opendht: Add Python bindings, tools.
Date: Tue, 13 Apr 2021 00:17:08 -0400	[thread overview]
Message-ID: <20210413041710.1708-1-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20210413041500.1223-1-maxim.cournoyer@gmail.com>

* gnu/packages/networking.scm (opendht)
[outputs]: Add tools and debug outputs.
[native-inputs]: Add python and python-cython.
[imported-modules, modules, phases]: New arguments.
[configure-flags]: Disable static compilation.  Enable Python support and the
tools.
[synopsis]: Update synopsis.
[description]: Expound description.
---
 gnu/packages/networking.scm | 75 ++++++++++++++++++++++++++++++++-----
 1 file changed, 66 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index baaa9c5707..b3a51c4b82 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -3436,6 +3436,7 @@ and targeted primarily for asynchronous processing of HTTP-requests.")
                (base32
                 "1wc0f6cnvnlmhxnx64nxqgsx93k4g7ljdaqjl40ml74jg3nqrzcl"))))
     ;; Since 2.0, the gnu-build-system does not seem to work anymore, upstream bug?
+    (outputs '("out" "tools" "debug"))
     (build-system cmake-build-system)
     (inputs
      `(("argon2" ,argon2)
@@ -3452,23 +3453,79 @@ and targeted primarily for asynchronous processing of HTTP-requests.")
      `(("autoconf" ,autoconf)
        ("automake" ,automake)
        ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-cython" ,python-cython)
        ("libtool" ,libtool)
        ("cppunit" ,cppunit)))
     (arguments
-     `(#:tests? #f                      ; Tests require network connection.
+     `(#:imported-modules ((guix build python-build-system) ;for site-packages
+                           ,@%cmake-build-system-modules)
+       #:modules (((guix build python-build-system) #:prefix python:)
+                  (guix build cmake-build-system)
+                  (guix build utils))
+       #:tests? #f                      ; Tests require network connection.
        #:configure-flags
-       '(;;"-DOPENDHT_TESTS=on"
-         "-DOPENDHT_TOOLS=off"
-         "-DOPENDHT_PYTHON=off"
+       '( ;;"-DOPENDHT_TESTS=on"
+         "-DOPENDHT_STATIC=off"
+         "-DOPENDHT_TOOLS=on"
+         "-DOPENDHT_PYTHON=on"
          "-DOPENDHT_PROXY_SERVER=on"
          "-DOPENDHT_PUSH_NOTIFICATIONS=on"
          "-DOPENDHT_PROXY_SERVER_IDENTITY=on"
-         "-DOPENDHT_PROXY_CLIENT=on")))
+         "-DOPENDHT_PROXY_CLIENT=on")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-python-installation-prefix
+           ;; Specify the installation prefix for the compiled Python module
+           ;; that would otherwise attempt to installs itself to Python's own
+           ;; site-packages directory.
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (substitute* "python/CMakeLists.txt"
+               (("--root=\\\\\\$ENV\\{DESTDIR\\}")
+                (string-append "--root=/ --single-version-externally-managed "
+                               "--prefix=${CMAKE_INSTALL_PREFIX}")))))
+         (add-after 'unpack 'specify-runpath-for-python-module
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* "python/setup.py.in"
+                 (("extra_link_args=\\[(.*)\\]" _ args)
+                  (string-append "extra_link_args=[" args
+                                 ", '-Wl,-rpath=" out "/lib']"))))))
+         (add-after 'install 'move-and-wrap-tools
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (tools (assoc-ref outputs "tools"))
+                   (site-packages (python:site-packages inputs outputs)))
+               (mkdir tools)
+               (rename-file (string-append out "/bin")
+                            (string-append tools "/bin"))
+               (wrap-program (string-append tools "/bin/dhtcluster")
+                 `("PYTHONPATH" prefix (,site-packages)))))))))
     (home-page "https://github.com/savoirfairelinux/opendht/")
-    (synopsis "Distributed Hash Table (DHT) library")
-    (description "OpenDHT is a Distributed Hash Table (DHT) library.  It may
-be used to manage peer-to-peer network connections as needed for real time
-communication.")
+    (synopsis "Lightweight Distributed Hash Table (DHT) library")
+    (description "OpenDHT provides an easy to use distributed in-memory data
+store.  Every node in the network can read and write values to the store.
+Values are distributed over the network, with redundancy.  It includes the
+following features:
+@itemize
+@item Lightweight and scalable, designed for large networks and small devices;
+@item High resilience to network disruption;
+@item Public key cryptography layer providing optional data signature and
+encryption (using GnuTLS);
+@item IPv4 and IPv6 support;
+@item Clean and powerful C++14 map API;
+@item Bindings for C, Rust & Python 3;
+@item REST API with an optional HTTP client and server with push notification
+support.
+@end itemize
+The following tools are also included:
+@table @command
+@item dhtnode
+A command line tool to run a DHT node and perform operations supported by the
+library (get, put, etc.) with text values.
+@item dhtchat
+A very simple IM client working over the DHT.
+@end table")
     (license license:gpl3+)))
 
 (define-public frrouting
-- 
2.31.1





  reply	other threads:[~2021-04-13  4:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13  4:14 [bug#47741] [PATCH 0/3] Add a service for OpenDHT Maxim Cournoyer
2021-04-13  4:17 ` Maxim Cournoyer [this message]
2021-04-13  4:17   ` [bug#47741] [PATCH 2/3] services: configuration: Add syntactic sugar to easily generate documentation Maxim Cournoyer
2021-04-13  4:17   ` [bug#47741] [PATCH 3/3] services: Add opendht Maxim Cournoyer
2021-05-18  3:59     ` bug#47741: [PATCH 0/3] Add a service for OpenDHT Maxim Cournoyer

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20210413041710.1708-1-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=47741@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).