diff mbox

[4/10] argon2: Install pkg-config file.

Message ID 8737l41qnj.fsf@openmailbox.org
State New
Headers show

Commit Message

Lukas Gradl Sept. 13, 2016, 2:26 a.m. UTC
None

Comments

Danny Milosavljevic Sept. 15, 2016, 9:24 p.m. UTC | #1
> +       (snippet
> +        '(let ((p (open-file "argon2.pc" "a")))
...                                          ^ why?

> +           (begin
> +             (display
> +              (string-append "prefix=/usr/local\n"
> +                             "exec_prefix=${prefix}\n"
> +                             "includedir=${prefix}/include\n"
> +                             "libdir=${prefix}/lib\n\n"
> +                             "Name: Argon2\n"
> +                             "Description: "
> +                             "The Argon2 password hashing algorithm\n"
> +                             "Version: 1.0.0\n"
> +                             "Cflags: -I${includedir}/\n"
> +                             "Libs: -L${libdir} -largon2\n") p)
> +             (close-output-port p))))

Ok but please try to upstream this as well.

> +               (zero? (system* "ln" "-s"
> +                               (string-append out "/lib/libargon2.so")
> +                               (string-append out "/lib/libargon2.so.0")))

The result of this will be ignored. Did you mean "(and ...)"?

> +               (zero? (system* ; Fix compatability for libtool based builds.
> +                       "ln" "-s"
> +                       (string-append out "/lib/libargon2.so")
> +                       (string-append out "/lib/libargon2.so.0.0.0")))))))))

Doesn't this have a soversion other than 0? I mean it's OK, I'm just asking to be sure - because the pkg-config file lists 1.0.0 and the name of the pkg-config file contains no soversion at all.
Lukas Gradl Sept. 17, 2016, 4:47 p.m. UTC | #2
Thank you for your review!

Danny Milosavljevic <dannym@scratchpost.org> writes:

>> +       (snippet
>> +        '(let ((p (open-file "argon2.pc" "a")))
> ...                                          ^ why?
>
>> +           (begin
>> +             (display
>> +              (string-append "prefix=/usr/local\n"
>> +                             "exec_prefix=${prefix}\n"
>> +                             "includedir=${prefix}/include\n"
>> +                             "libdir=${prefix}/lib\n\n"
>> +                             "Name: Argon2\n"
>> +                             "Description: "
>> +                             "The Argon2 password hashing algorithm\n"
>> +                             "Version: 1.0.0\n"
>> +                             "Cflags: -I${includedir}/\n"
>> +                             "Libs: -L${libdir} -largon2\n") p)
>> +             (close-output-port p))))
>
> Ok but please try to upstream this as well.

OK, I will look into that.

>
>> +               (zero? (system* "ln" "-s"
>> +                               (string-append out "/lib/libargon2.so")
>> +                               (string-append out "/lib/libargon2.so.0")))
>
> The result of this will be ignored. Did you mean "(and ...)"?

Oops! Yes, I will send an updated patch later today.

>
>> +               (zero? (system* ; Fix compatability for libtool based builds.
>> +                       "ln" "-s"
>> +                       (string-append out "/lib/libargon2.so")
>> +                       (string-append out "/lib/libargon2.so.0.0.0")))))))))
>
> Doesn't this have a soversion other than 0? I mean it's OK, I'm just
> asking to be sure - because the pkg-config file lists 1.0.0 and the
> name of the pkg-config file contains no soversion at all.

I am actually not sure about this.  I noticed that one of the packages
that depends on opendht (I think libring, but need to make sure) is
looking for 'libargon2.so.0.0.0'.  I did not find a way to convince it
to use 'libargon2.so' other than creating this symlink.  I am not sure
if this is a good/acceptable way to solve this, it is probably not the
intended way.  I also could not find documentation on this issue and i
am not sure which part of the toolchain is responsible for making the
'.so.X.X.X' versions of a library.

Thank you!

Best,
Lukas
diff mbox

Patch

From 9850d4ef481b134d43d2380904b5db8e0d7fdd98 Mon Sep 17 00:00:00 2001
From: Lukas Gradl <lgradl@openmailbox.org>
Date: Tue, 9 Aug 2016 16:49:19 -0500
Subject: [PATCH 04/10] gnu: argon2: Install pkg-config file.

* gnu/packages/password-utils.scm (argon2)[source]: Create pkg-config file.
[arguments]: Install it.
---
 gnu/packages/password-utils.scm | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 7288da6..42b116f 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -311,6 +311,21 @@  through the pass command.")
          "https://codeload.github.com/P-H-C/phc-winner-"
          name "/tar.gz/" version))
        (file-name (string-append name "-" version ".tar.gz"))
+       (snippet
+        '(let ((p (open-file "argon2.pc" "a")))
+           (begin
+             (display
+              (string-append "prefix=/usr/local\n"
+                             "exec_prefix=${prefix}\n"
+                             "includedir=${prefix}/include\n"
+                             "libdir=${prefix}/lib\n\n"
+                             "Name: Argon2\n"
+                             "Description: "
+                             "The Argon2 password hashing algorithm\n"
+                             "Version: 1.0.0\n"
+                             "Cflags: -I${includedir}/\n"
+                             "Libs: -L${libdir} -largon2\n") p)
+             (close-output-port p))))
        (sha256
         (base32
          "0g6wa94sh639xl1qc8z21q43r1mp8y77r1zf8nwx5pfsxd8fmyzv"))))
@@ -321,14 +336,28 @@  through the pass command.")
        #:phases
        (modify-phases %standard-phases
          (delete 'configure)
+         (add-after 'unpack 'fix-pkg-config
+           (lambda _
+             (substitute* "argon2.pc"
+               (("/usr/local")
+                (assoc-ref %outputs "out")))))
          (replace 'install
            (lambda _
              (let ((out (assoc-ref %outputs "out")))
                (install-file "argon2" (string-append out "/bin"))
                (install-file "libargon2.a" (string-append out "/lib"))
                (install-file "libargon2.so" (string-append out "/lib"))
+               (install-file "argon2.pc"
+                             (string-append out "/lib/pkgconfig"))
                (copy-recursively "include"
-                                 (string-append out "/include"))))))))
+                                 (string-append out "/include"))
+               (zero? (system* "ln" "-s"
+                               (string-append out "/lib/libargon2.so")
+                               (string-append out "/lib/libargon2.so.0")))
+               (zero? (system* ; Fix compatability for libtool based builds.
+                       "ln" "-s"
+                       (string-append out "/lib/libargon2.so")
+                       (string-append out "/lib/libargon2.so.0.0.0")))))))))
     (home-page "https://www.argon2.com/")
     (synopsis "Password hashing library")
     (description "Argon2 provides a key derivation function that was declared
-- 
2.9.0