Skip to contentSkip to conversation

package/libargon2: conditionally shared/static lib build

PATCH Superseded Andreas Mohr via buildroot 1 participant 3 messages May 16 – May 18

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/libargon2: conditionally shared/static lib build

libargon2 build shared and static lib by default.

Add conditionally BR2_SHARED_LIBS and BR2_STATIC_LIBS support and add version to pkg-config.

---
Changes in v3:
- add version to pkg-config
Changes in v2:
- add conditionally shared lib build

---
 package/libargon2/Config.in    | 5 -----
 package/libargon2/libargon2.mk | 7 +++++++
 2 files changed, 7 insertions(+), 5 deletions(-)
package/libargon2/Config.in +0 -5
index 6bba74cfb2..73c1e0d777 100644
@@ -1,12 +1,7 @@
 config BR2_PACKAGE_LIBARGON2
 	bool "libargon2"
 	depends on BR2_USE_MMU
-	depends on !BR2_STATIC_LIBS
 	help
 	  A modern password hashing algorithm
 
 	  https://password-hashing.net/#argon2
-
-comment "libargon needs a toolchain w/ dynamic library"
-	depends on BR2_USE_MMU
-	depends on BR2_STATIC_LIBS
package/libargon2/libargon2.mk +7 -0
index b3f6e1b216..e968aa08a3 100644
@@ -11,6 +11,7 @@ LIBARGON2_LICENSE_FILES = LICENSE
 LIBARGON2_INSTALL_STAGING = YES
 
 LIBARGON2_OPTS = LIBRARY_REL=lib
+LIBARGON2_OPTS += ARGON2_VERSION=$(LIBARGON2_VERSION)
 
 # GCC_TARGET_ARCH is not defined for all architectures, but libargon2
 # only uses it to detect if some x86 optimizations can be used, and
@@ -23,6 +24,12 @@ ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
 LIBARGON2_OPTS += NO_THREADS=1
 endif
 
+ifeq ($(BR2_STATIC_LIBS),y)
+LIBARGON2_OPTS += LIB_SH= LINKED_LIB_SH=
+else ifeq ($(BR2_SHARED_LIBS),y)
+LIBARGON2_OPTS += LIB_ST=
+endif
+
 define LIBARGON2_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
 		$(LIBARGON2_OPTS)
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Andreas,

Sorry to give you feedback only when you're already at v3...

Quoted 4 lines · Andreas Mohr via buildroot

libargon2 build shared and static lib by default.

Add conditionally BR2_SHARED_LIBS and BR2_STATIC_LIBS support and add version to pkg-config.

That second part really should be a separate patch. With a bit more
explanation too because I don't understand what exactly this does, or what happens if you don't set this. Can be as simple as "Without this, pkg-config --package-version libargon2 reports Buildroot's version instead of libargon2's version" (if that is actually what happens, of course :-)

Quoted 17 lines

---
Changes in v3:
- add version to pkg-config
Changes in v2:
- add conditionally shared lib build

---
  package/libargon2/Config.in    | 5 -----
  package/libargon2/libargon2.mk | 7 +++++++
  2 files changed, 7 insertions(+), 5 deletions(-)
package/libargon2/Config.in +0 -0
index 6bba74cfb2..73c1e0d777 100644

package/libargon2/Config.in line 4

Quoted 4 lines
package/libargon2/Config.in +0 -1
@@ -1,12 +1,7 @@
  config BR2_PACKAGE_LIBARGON2
  	bool "libargon2"
  	depends on BR2_USE_MMU
-	depends on !BR2_STATIC_LIBS

This dependency was propagated to other symbols, e.g.
BR2_PACKAGE_PHP_EXT_LIBARGON2, BR2_PACKAGE_PYTHON_ARGON2_CFFI_BINDINGS, BR2_PACKAGE_CRYPTSETUP, and should be removed from there (or the comments updated).

Regards,
Arnout

Quoted 23 lines
package/libargon2/Config.in +0 -4
  	help
  	  A modern password hashing algorithm
 
  	  https://password-hashing.net/#argon2
-
-comment "libargon needs a toolchain w/ dynamic library"
-	depends on BR2_USE_MMU
-	depends on BR2_STATIC_LIBS
package/libargon2/libargon2.mk +1 -0
index b3f6e1b216..e968aa08a3 100644
@@ -11,6 +11,7 @@ LIBARGON2_LICENSE_FILES = LICENSE
  LIBARGON2_INSTALL_STAGING = YES
 
  LIBARGON2_OPTS = LIBRARY_REL=lib
+LIBARGON2_OPTS += ARGON2_VERSION=$(LIBARGON2_VERSION)
 
  # GCC_TARGET_ARCH is not defined for all architectures, but libargon2
  # only uses it to detect if some x86 optimizations can be used, and
@@ -23,6 +24,12 @@ ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
  LIBARGON2_OPTS += NO_THREADS=1
  endif

package/libargon2/libargon2.mk ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),) · line 35

Quoted 10 lines
package/libargon2/libargon2.mk +6 -0
 
+ifeq ($(BR2_STATIC_LIBS),y)
+LIBARGON2_OPTS += LIB_SH= LINKED_LIB_SH=
+else ifeq ($(BR2_SHARED_LIBS),y)
+LIBARGON2_OPTS += LIB_ST=
+endif
+
  define LIBARGON2_BUILD_CMDS
  	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
  		$(LIBARGON2_OPTS)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hi Arnout,

Am 18.05.26 um 20:41 schrieb Arnout Vandecappelle via buildroot:

Quoted 4 lines

 Hi Andreas,

 Sorry to give you feedback only when you're already at v3...

Quoted 8 lines
Quoted 4 lines · Andreas Mohr via buildroot

libargon2 build shared and static lib by default.

Add conditionally BR2_SHARED_LIBS and BR2_STATIC_LIBS support and add version to pkg-config.

 That second part really should be a separate patch. With a bit more explanation too because I don't understand what exactly this does, or what happens if you don't set this. Can be as simple as "Without this, pkg-config --package-version libargon2 reports Buildroot's version instead of libargon2's version" (if that is actually what happens, of course :-)

LIBARGON2_OPTS += ARGON2_VERSION=$(LIBARGON2_VERSION)

ensure correct version string at file usr/lib/pkgconfig/libargon2.pc

Current:

# grep Version libargon2.pc
Version: ZERO
Quoted 12 lines
Quoted 12 lines

---
Changes in v3:
- add version to pkg-config
Changes in v2:
- add conditionally shared lib build
---
  package/libargon2/Config.in    | 5 -----
  package/libargon2/libargon2.mk | 7 +++++++

  2 files changed, 7 insertions(+), 5 deletions(-)
Quoted 12 lines
Quoted 9 lines
package/libargon2/Config.in +0 -0
index 6bba74cfb2..73c1e0d777 100644
@@ -1,12 +1,7 @@

  config BR2_PACKAGE_LIBARGON2
      bool "libargon2"
      depends on BR2_USE_MMU
-    depends on !BR2_STATIC_LIBS

 This dependency was propagated to other symbols, e.g. BR2_PACKAGE_PHP_EXT_LIBARGON2, BR2_PACKAGE_PYTHON_ARGON2_CFFI_BINDINGS, BR2_PACKAGE_CRYPTSETUP, and should be removed from there (or the comments updated).

Once the static build libargon2 patch has been accepted, I will send the next patch for the libargon2 dependent packages, such as cryptsetup, to relax their static build blocking.

Quoted 24 lines

 Regards,
 Arnout

Quoted 21 lines

      help
        A modern password hashing algorithm
          https://password-hashing.net/#argon2

package/libargon2/Config.in +0 -4
-
-comment "libargon needs a toolchain w/ dynamic library"
-    depends on BR2_USE_MMU
-    depends on BR2_STATIC_LIBS
package/libargon2/libargon2.mk +0 -0
index b3f6e1b216..e968aa08a3 100644
@@ -11,6 +11,7 @@ LIBARGON2_LICENSE_FILES = LICENSE

  LIBARGON2_INSTALL_STAGING = YES
    LIBARGON2_OPTS = LIBRARY_REL=lib
+LIBARGON2_OPTS += ARGON2_VERSION=$(LIBARGON2_VERSION)
    # GCC_TARGET_ARCH is not defined for all architectures, but libargon2

  # only uses it to detect if some x86 optimizations can be used, and
package/libargon2/libargon2.mk +0 -0
@@ -23,6 +24,12 @@ ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)

  LIBARGON2_OPTS += NO_THREADS=1
  endif
  +ifeq ($(BR2_STATIC_LIBS),y)

Quoted 8 lines
Quoted 8 lines
package/libargon2/libargon2.mk +5 -0
+LIBARGON2_OPTS += LIB_SH= LINKED_LIB_SH=
+else ifeq ($(BR2_SHARED_LIBS),y)
+LIBARGON2_OPTS += LIB_ST=
+endif
+

  define LIBARGON2_BUILD_CMDS
      $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
          $(LIBARGON2_OPTS)

I will create v4 to address the minor pkg-config version issue and the major static-build blocking issue.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot