From 85b23114e7abaf225d1bce2c8981a18e47bfc23f Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 12 Jan 2022 00:00:33 -0500 Subject: gnu: opendht: Use the GNU build system. Autotools is still supported; use it, so that it remains well tested and at feature parity with the CMake build system it also supports. * gnu/packages/networking.scm (opendht)[build-system]: Switch to gnu-build-system. [arguments]: Move field above inputs. [imported-modules, modules]: Adjust accordingly. [configure-flags]: Likewise. [phases]: Use G-Exp, and adjust accordingly. --- gnu/packages/networking.scm | 93 +++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 46 deletions(-) (limited to 'gnu/packages/networking.scm') diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm index 1825d64a89..a89b1262b6 100644 --- a/gnu/packages/networking.scm +++ b/gnu/packages/networking.scm @@ -67,6 +67,7 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix build-system cmake) #:use-module (guix build-system glib-or-gtk) @@ -3378,9 +3379,53 @@ and targeted primarily for asynchronous processing of HTTP-requests.") (sha256 (base32 "07x8vw999qpfl6qwj5k5l2mcjy1vp32sd567f6imbsnh9vlx2bdv")))) - ;; Since 2.0, the gnu-build-system does not seem to work anymore, upstream bug? (outputs '("out" "tools" "debug")) - (build-system cmake-build-system) + (build-system gnu-build-system) + (arguments + (list + #:imported-modules `((guix build python-build-system) ;for site-packages + ,@%gnu-build-system-modules) + #:modules '(((guix build python-build-system) #:prefix python:) + (guix build gnu-build-system) + (guix build utils)) + #:tests? #f ;tests require networking + #:configure-flags + #~(list "--enable-tests" + "--enable-proxy-server" + "--enable-push-notifications" + "--enable-proxy-server-identity" + "--enable-proxy-client") + #: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 _ + (substitute* "python/Makefile.am" + (("--root=\\$\\(DESTDIR)/") + (string-append "--root=/ --single-version-externally-managed " + "--prefix=" #$output))))) + (add-after 'unpack 'specify-runpath-for-python-module + (lambda _ + (substitute* "python/setup.py.in" + (("extra_link_args=\\[(.*)\\]" _ args) + (string-append "extra_link_args=[" args + ", '-Wl,-rpath=" #$output "/lib']"))))) + (add-after 'install 'move-and-wrap-tools + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((tools (assoc-ref outputs "tools")) + (dhtcluster (string-append tools "/bin/dhtcluster")) + (site-packages (python:site-packages inputs outputs))) + (mkdir tools) + (rename-file (string-append #$output "/bin") + (string-append tools "/bin")) + ;; TODO: Contribute a patch to python/Makefile.am to + ;; automate this. + (copy-file "python/tools/dhtcluster.py" dhtcluster) + (chmod dhtcluster #o555) + (wrap-program dhtcluster + `("GUIX_PYTHONPATH" prefix (,site-packages))))))))) (inputs (list bash-minimal fmt readline)) (propagated-inputs (list msgpack ;included in several installed headers @@ -3400,50 +3445,6 @@ and targeted primarily for asynchronous processing of HTTP-requests.") python-cython libtool cppunit)) - (arguments - `(#: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 networking - #:configure-flags - '( ;;"-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") - #: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") - `("GUIX_PYTHONPATH" prefix (,site-packages))))))))) (home-page "https://github.com/savoirfairelinux/opendht/") (synopsis "Lightweight Distributed Hash Table (DHT) library") (description "OpenDHT provides an easy to use distributed in-memory data -- cgit v1.2.3 kages) #:use-module (guix download) #:use-module (guix build-system gnu) #:use-module (gnu packages) #:use-module (gnu packages perl) #:use-module (gnu packages xml) #:use-module (gnu packages autotools)) (define-public apr (package (name "apr") (version "1.7.0") (source (origin (method url-fetch) (uri (string-append "mirror://apache/apr/apr-" version ".tar.bz2")) (sha256 (base32 "1spp6r2a3xcl5yajm9safhzyilsdzgagc2dadif8x6z9nbq4iqg2")) (patches (search-patches "apr-skip-getservbyname-test.patch")) (patch-flags '("-p0")))) (build-system gnu-build-system) (arguments ;; Sometimes we end up with two processes concurrently trying to make ;; 'libmod_test.la': <http://hydra.gnu.org/build/60266/nixlog/2/raw>. ;; Thus, build sequentially. '(#:parallel-build? #f #:parallel-tests? #f)) (inputs (list perl libltdl)) (home-page "https://apr.apache.org/") (synopsis "The Apache Portable Runtime Library") (description "The mission of the Apache Portable Runtime (APR) project is to create and maintain software libraries that provide a predictable and consistent interface to underlying platform-specific implementations. The primary goal is to provide an API to which software developers may code and be assured of predictable if not identical behaviour regardless of the platform on which their software is built, relieving them of the need to code special-case conditions to work around or take advantage of platform-specific deficiencies or features.") (license l:asl2.0))) (define-public apr-util (package (name "apr-util") (version "1.6.1") (source (origin (method url-fetch) (uri (string-append "mirror://apache/apr/apr-util-" version ".tar.bz2")) (sha256 (base32 "0nq3s1yn13vplgl6qfm09f7n0wm08malff9s59bqf9nid9xjzqfk")))) (build-system gnu-build-system) (inputs (list apr)) (propagated-inputs (list expat)) (arguments '(#:phases (modify-phases %standard-phases (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (apr (assoc-ref inputs "apr")) (expat (assoc-ref inputs "expat"))) (setenv "CONFIG_SHELL" (which "bash")) (invoke "./configure" (string-append "--prefix=" out) (string-append "--with-apr=" apr) (string-append "--with-expat=" expat)))))) ;; There are race conditions during 'make check'. Typically, the ;; 'testall' executable is not built yet by the time 'make check' tries ;; to run it. See ;; <http://lists.gnu.org/archive/html/guix-devel/2014-03/msg00261.html>. #:parallel-tests? #f)) (home-page "https://apr.apache.org/") (synopsis "One of the Apache Portable Runtime Library companions") (description "APR-util provides a number of helpful abstractions on top of APR.") (license l:asl2.0)))