diff mbox series

[bug#49123,02/24] gnu: libolm: Add python bindings output.

Message ID 20210620010742.4259-2-0x2d@disroot.org
State New
Headers show
Series [bug#49123,01/24] gnu: Add pyotherside. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

slg June 20, 2021, 1:07 a.m. UTC
* gnu/packages/crypto.scm (libolm): Add python bindings
---
 gnu/packages/crypto.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

Comments

M June 21, 2021, 3:44 p.m. UTC | #1
Hi,

>           (replace 'check
>             (lambda _
>               (with-directory-excursion "tests"
> -               (invoke "ctest" ".")))))))
> +               (invoke "ctest" "."))))

I would make this

>           (replace 'check
>             (lambda* (#:key tests? #:allow-other-keys)
>               (with-directory-excursion "tests"
>                 (when tests?
> -                 (invoke "ctest" ".")
> +                 (invoke "ctest" ".")))))

That way, "guix build libolm --without-tests=libolm" should work.

Greetings,
Maxime.
diff mbox series

Patch

diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index 99455dc632..b1cfd46adc 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -1310,13 +1310,30 @@  Trusted comments are signed, thus verified, before being displayed.")
                 "0bixly6jqpwfx3p37c1qp1j685yg6m429r1nazwh43w4n527bs3y"))
               (file-name (git-file-name name version))))
     (build-system cmake-build-system)
+    (outputs '("out" "python"))
+    (propagated-inputs
+     `(("python-cffi" ,python-cffi)))
+    (native-inputs
+     `(("python" ,python-wrapper)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
          (replace 'check
            (lambda _
              (with-directory-excursion "tests"
-               (invoke "ctest" ".")))))))
+               (invoke "ctest" "."))))
+         (add-after 'install 'install-python-binding
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion "../source/python"
+               (invoke "make" "headers" "CPP=cpp") ;; Somehow default $(CPP) is cc?
+               (invoke "python" "setup.py" "build_ext"
+                       (string-append "--library-dirs="
+                                      (assoc-ref outputs "out")
+                                      "/lib"))
+               (invoke "python" "setup.py" "install"
+                       (string-append "--prefix="
+                                      (assoc-ref outputs "python"))
+                       "--root=/")))))))
     (synopsis "Implementation of the olm and megolm cryptographic ratchets")
     (description "The libolm library implements the Double Ratchet
 cryptographic ratchet.  It is written in C and C++11, and exposed as a C