diff mbox

libsodium: new package

Message ID 1431819535-9598-1-git-send-email-fhunleth@troodon-software.com
State Superseded
Headers show

Commit Message

Frank Hunleth May 16, 2015, 11:38 p.m. UTC
Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
---
 package/Config.in                |  1 +
 package/libsodium/Config.in      |  6 ++++++
 package/libsodium/libsodium.hash |  2 ++
 package/libsodium/libsodium.mk   | 14 ++++++++++++++
 4 files changed, 23 insertions(+)
 create mode 100644 package/libsodium/Config.in
 create mode 100644 package/libsodium/libsodium.hash
 create mode 100644 package/libsodium/libsodium.mk

Comments

Baruch Siach May 17, 2015, 3:34 a.m. UTC | #1
Hi Frank,

On Sat, May 16, 2015 at 07:38:55PM -0400, Frank Hunleth wrote:
> diff --git a/package/libsodium/libsodium.mk b/package/libsodium/libsodium.mk
> new file mode 100644
> index 0000000..9445f5a
> --- /dev/null
> +++ b/package/libsodium/libsodium.mk
> @@ -0,0 +1,14 @@
> +################################################################################
> +#
> +# libsodium
> +#
> +################################################################################
> +
> +LIBSODIUM_VERSION = 1.0.3
> +LIBSODIUM_SITE = https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VERSION}
> +LIBSODIUM_LICENSE = ISC
> +LIBSODIUM_LICENSE_FILES = LICENSE
> +LIBSODIUM_INSTALL_STAGING = YES
> +
> +$(eval $(autotools-package))
> +$(eval $(host-autotools-package))

What is the use of the host package?

baruch
Thomas Petazzoni May 17, 2015, 10:59 a.m. UTC | #2
Dear Frank Hunleth,

On Sat, 16 May 2015 19:38:55 -0400, Frank Hunleth wrote:

> diff --git a/package/libsodium/libsodium.mk b/package/libsodium/libsodium.mk
> new file mode 100644
> index 0000000..9445f5a
> --- /dev/null
> +++ b/package/libsodium/libsodium.mk
> @@ -0,0 +1,14 @@
> +################################################################################
> +#
> +# libsodium
> +#
> +################################################################################
> +
> +LIBSODIUM_VERSION = 1.0.3
> +LIBSODIUM_SITE = https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VERSION}

Use $() to reference make variables, not ${}.

> +LIBSODIUM_LICENSE = ISC
> +LIBSODIUM_LICENSE_FILES = LICENSE
> +LIBSODIUM_INSTALL_STAGING = YES
> +
> +$(eval $(autotools-package))
> +$(eval $(host-autotools-package))

As Baruch said, this host-autotools-package call seems useless.

Best regards,

Thomas
Romain Naour May 17, 2015, 11:43 a.m. UTC | #3
Hi Frank,

Le 17/05/2015 01:38, Frank Hunleth a écrit :
> Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
> ---
>  package/Config.in                |  1 +
>  package/libsodium/Config.in      |  6 ++++++
>  package/libsodium/libsodium.hash |  2 ++
>  package/libsodium/libsodium.mk   | 14 ++++++++++++++
>  4 files changed, 23 insertions(+)
>  create mode 100644 package/libsodium/Config.in
>  create mode 100644 package/libsodium/libsodium.hash
>  create mode 100644 package/libsodium/libsodium.mk
> 

Since you are adding a new library, some packages will try to link with it.
As far I know, zeromq can link with libsodium, so a new dependency should be
added in a follow up patch.

There is even an upstream path to disable libsodium in zeromq:
https://github.com/zeromq/zeromq4-x/commit/faaf4550263395b84e6a80d3f9d7ba8816cdd714

Care to take a look ?

Best regards,
Romain
Frank Hunleth May 17, 2015, 1:16 p.m. UTC | #4
Hi Baruch,

On Sat, May 16, 2015 at 11:34 PM, Baruch Siach <baruch@tkos.co.il> wrote:
> Hi Frank,
>
> On Sat, May 16, 2015 at 07:38:55PM -0400, Frank Hunleth wrote:
>> diff --git a/package/libsodium/libsodium.mk b/package/libsodium/libsodium.mk
>> new file mode 100644
>> index 0000000..9445f5a
>> --- /dev/null
>> +++ b/package/libsodium/libsodium.mk
>> @@ -0,0 +1,14 @@
>> +################################################################################
>> +#
>> +# libsodium
>> +#
>> +################################################################################
>> +
>> +LIBSODIUM_VERSION = 1.0.3
>> +LIBSODIUM_SITE = https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VERSION}
>> +LIBSODIUM_LICENSE = ISC
>> +LIBSODIUM_LICENSE_FILES = LICENSE
>> +LIBSODIUM_INSTALL_STAGING = YES
>> +
>> +$(eval $(autotools-package))
>> +$(eval $(host-autotools-package))
>
> What is the use of the host package?

I have a project that was using it for part of the build process so I
needed libsodium for both the host and target. I wasn't sure what the
Buildroot policy was for seemingly unnecessary host packages like
this. It's not a big deal for me to patch locally.

Thanks,
Frank

>
> baruch
>
> --
>      http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
> =}------------------------------------------------ooO--U--Ooo------------{=
>    - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
Frank Hunleth May 17, 2015, 6:25 p.m. UTC | #5
Hi Romain,

On Sun, May 17, 2015 at 7:43 AM, Romain Naour <romain.naour@openwide.fr> wrote:
> Hi Frank,
>
> Le 17/05/2015 01:38, Frank Hunleth a écrit :
>> Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
>> ---
>>  package/Config.in                |  1 +
>>  package/libsodium/Config.in      |  6 ++++++
>>  package/libsodium/libsodium.hash |  2 ++
>>  package/libsodium/libsodium.mk   | 14 ++++++++++++++
>>  4 files changed, 23 insertions(+)
>>  create mode 100644 package/libsodium/Config.in
>>  create mode 100644 package/libsodium/libsodium.hash
>>  create mode 100644 package/libsodium/libsodium.mk
>>
>
> Since you are adding a new library, some packages will try to link with it.
> As far I know, zeromq can link with libsodium, so a new dependency should be
> added in a follow up patch.

Thanks. I didn't know about the zeromq dependency. Before I submit a
new patch, do you know of an easy way to figure out what other
packages have a hidden dependency like this?

> There is even an upstream path to disable libsodium in zeromq:
> https://github.com/zeromq/zeromq4-x/commit/faaf4550263395b84e6a80d3f9d7ba8816cdd714

I looked at it. I'm not a zeromq user, so I don't really understand
why someone would want to have libsodium support disabled if they have
it. It seems simpler for now to make sure the dependency is there in
BR if libsodium is enabled. Maybe this is more of a desktop need?

Thanks,
Frank


>
> Care to take a look ?
>
> Best regards,
> Romain
Romain Naour May 17, 2015, 8:57 p.m. UTC | #6
Hi Frank,

Le 17/05/2015 20:25, Frank Hunleth a écrit :
> Hi Romain,
> 
> On Sun, May 17, 2015 at 7:43 AM, Romain Naour <romain.naour@openwide.fr> wrote:
>> Hi Frank,
>>
>> Le 17/05/2015 01:38, Frank Hunleth a écrit :
>>> Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
>>> ---
>>>  package/Config.in                |  1 +
>>>  package/libsodium/Config.in      |  6 ++++++
>>>  package/libsodium/libsodium.hash |  2 ++
>>>  package/libsodium/libsodium.mk   | 14 ++++++++++++++
>>>  4 files changed, 23 insertions(+)
>>>  create mode 100644 package/libsodium/Config.in
>>>  create mode 100644 package/libsodium/libsodium.hash
>>>  create mode 100644 package/libsodium/libsodium.mk
>>>
>>
>> Since you are adding a new library, some packages will try to link with it.
>> As far I know, zeromq can link with libsodium, so a new dependency should be
>> added in a follow up patch.
> 
> Thanks. I didn't know about the zeromq dependency. Before I submit a
> new patch, do you know of an easy way to figure out what other
> packages have a hidden dependency like this?

There is no easy way, maybe by using the package manager from your GNU/Linux
distribution to find some hit.

Something like (debian8): sudo apt-cache rdepends libsodium13
libsodium13
Reverse Depends:
  libzmq3
  libzmq3
  libsodium-dev
  libsodium-dbg

> 
>> There is even an upstream path to disable libsodium in zeromq:
>> https://github.com/zeromq/zeromq4-x/commit/faaf4550263395b84e6a80d3f9d7ba8816cdd714
> 
> I looked at it. I'm not a zeromq user, so I don't really understand
> why someone would want to have libsodium support disabled if they have
> it. It seems simpler for now to make sure the dependency is there in
> BR if libsodium is enabled. Maybe this is more of a desktop need?

It's sometime required to do this construct in .mk files in order to handle
properly the package dependency. (from nmap.mk)

ifeq ($(BR2_PACKAGE_OPENSSL),y)
NMAP_CONF_OPTS += --with-openssl="$(STAGING_DIR)/usr"
NMAP_DEPENDENCIES += openssl
else
NMAP_CONF_OPTS += --without-openssl
endif

It's also depends if the option is on/off by default.

But you're right, you need only something like this since libsodium is not
enabled by default.

ifeq ($(BR2_PACKAGE_LIBSODIUM),y)
ZEROMQ_DEPENDENCIES += libsodium
ZEROMQ_CONF_OPTS += --with-libsodium="$(STAGING_DIR)/usr"
endif

Best regards,
Romain

> 
> Thanks,
> Frank
> 
> 
>>
>> Care to take a look ?
>>
>> Best regards,
>> Romain
Frank Hunleth May 18, 2015, 1:20 p.m. UTC | #7
Hi Romain,

On Sun, May 17, 2015 at 4:57 PM, Romain Naour <romain.naour@openwide.fr> wrote:
> Hi Frank,
>
> Le 17/05/2015 20:25, Frank Hunleth a écrit :
>> Hi Romain,
>>
>> On Sun, May 17, 2015 at 7:43 AM, Romain Naour <romain.naour@openwide.fr> wrote:
>>> Hi Frank,
>>>
>>> Le 17/05/2015 01:38, Frank Hunleth a écrit :
>>>> Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
>>>> ---
>>>>  package/Config.in                |  1 +
>>>>  package/libsodium/Config.in      |  6 ++++++
>>>>  package/libsodium/libsodium.hash |  2 ++
>>>>  package/libsodium/libsodium.mk   | 14 ++++++++++++++
>>>>  4 files changed, 23 insertions(+)
>>>>  create mode 100644 package/libsodium/Config.in
>>>>  create mode 100644 package/libsodium/libsodium.hash
>>>>  create mode 100644 package/libsodium/libsodium.mk
>>>>
>>>
>>> Since you are adding a new library, some packages will try to link with it.
>>> As far I know, zeromq can link with libsodium, so a new dependency should be
>>> added in a follow up patch.
>>
>> Thanks. I didn't know about the zeromq dependency. Before I submit a
>> new patch, do you know of an easy way to figure out what other
>> packages have a hidden dependency like this?
>
> There is no easy way, maybe by using the package manager from your GNU/Linux
> distribution to find some hit.
>
> Something like (debian8): sudo apt-cache rdepends libsodium13
> libsodium13
> Reverse Depends:
>   libzmq3
>   libzmq3
>   libsodium-dev
>   libsodium-dbg

I see basically the same list on my system. I did some searching
around and didn't see anything else.

>>> There is even an upstream path to disable libsodium in zeromq:
>>> https://github.com/zeromq/zeromq4-x/commit/faaf4550263395b84e6a80d3f9d7ba8816cdd714
>>
>> I looked at it. I'm not a zeromq user, so I don't really understand
>> why someone would want to have libsodium support disabled if they have
>> it. It seems simpler for now to make sure the dependency is there in
>> BR if libsodium is enabled. Maybe this is more of a desktop need?
>
> It's sometime required to do this construct in .mk files in order to handle
> properly the package dependency. (from nmap.mk)
>
> ifeq ($(BR2_PACKAGE_OPENSSL),y)
> NMAP_CONF_OPTS += --with-openssl="$(STAGING_DIR)/usr"
> NMAP_DEPENDENCIES += openssl
> else
> NMAP_CONF_OPTS += --without-openssl
> endif
>
> It's also depends if the option is on/off by default.
>
> But you're right, you need only something like this since libsodium is not
> enabled by default.
>
> ifeq ($(BR2_PACKAGE_LIBSODIUM),y)
> ZEROMQ_DEPENDENCIES += libsodium
> ZEROMQ_CONF_OPTS += --with-libsodium="$(STAGING_DIR)/usr"
> endif

I'm sending a followup patch series with this shortly.

Thanks,
Frank
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index e0c2e2a..5b99639 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -723,6 +723,7 @@  menu "Crypto"
 	source "package/libnss/Config.in"
 	source "package/libsecret/Config.in"
 	source "package/libsha1/Config.in"
+	source "package/libsodium/Config.in"
 	source "package/libssh2/Config.in"
 	source "package/nettle/Config.in"
 	source "package/openssl/Config.in"
diff --git a/package/libsodium/Config.in b/package/libsodium/Config.in
new file mode 100644
index 0000000..47b9bb3
--- /dev/null
+++ b/package/libsodium/Config.in
@@ -0,0 +1,6 @@ 
+config BR2_PACKAGE_LIBSODIUM
+	bool "libsodium"
+	help
+	  A modern and easy-to-use crypto library.
+
+	  http://libsodium.org/
diff --git a/package/libsodium/libsodium.hash b/package/libsodium/libsodium.hash
new file mode 100644
index 0000000..089dc03
--- /dev/null
+++ b/package/libsodium/libsodium.hash
@@ -0,0 +1,2 @@ 
+# Locally computed:
+sha256	cbcfc63cc90c05d18a20f229a62c7e7054a73731d0aa858c0517152c549b1288	libsodium-1.0.3.tar.gz
diff --git a/package/libsodium/libsodium.mk b/package/libsodium/libsodium.mk
new file mode 100644
index 0000000..9445f5a
--- /dev/null
+++ b/package/libsodium/libsodium.mk
@@ -0,0 +1,14 @@ 
+################################################################################
+#
+# libsodium
+#
+################################################################################
+
+LIBSODIUM_VERSION = 1.0.3
+LIBSODIUM_SITE = https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VERSION}
+LIBSODIUM_LICENSE = ISC
+LIBSODIUM_LICENSE_FILES = LICENSE
+LIBSODIUM_INSTALL_STAGING = YES
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))