package/cryptopp: add a target variant

So far, cryptopp only had a host variant, but some use-cases require
this library on the target, so this adjusts the cryptopp package
accordingly.

One patch (submitted upstream) is needed to have the proper symlink
corresponding to the SONAME of the shared library.

Signed-off-by: Kamel Bouhara <kamel.bouhara@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Kamel Bouhara 2020-07-28 11:53:46 +02:00 committed by Thomas Petazzoni
parent 62c2da0e7a
commit bf4cf9de83
4 changed files with 102 additions and 0 deletions

View File

@ -1397,6 +1397,7 @@ menu "Crypto"
source "package/botan/Config.in"
source "package/ca-certificates/Config.in"
source "package/cryptodev/Config.in"
source "package/cryptopp/Config.in"
source "package/gcr/Config.in"
source "package/gnutls/Config.in"
source "package/libargon2/Config.in"

View File

@ -0,0 +1,62 @@
From e4c2e3bc8174f24cf63923619f5d06d85b84ae1d Mon Sep 17 00:00:00 2001
From: Kamel Bouhara <kamel.bouhara@bootlin.com>
Date: Fri, 7 Jan 2022 22:59:23 +0100
Subject: [PATCH] GNUmakefile: add missing shared library symlink
The GNUmakefile install-lib target currently installs the following
symlink:
libcryptopp.so -> libcryptopp.so.8.6.0
However, it does not create the following symlink:
libcryptopp.so.8 -> libcryptopp.so.8.6.0
This symlink is necessary at runtime because libcryptopp.so.8 is the
SONAME of the cryptopp library, and therefore this is what the dynamic
loader will search when starting a program that is linked against
cryptopp.
For native compilation, the 'ldconfig' invocation that immediately
follows will create that symlink, so everything works.
For cross-compilation however, ldconfig can't be used, and therefore
LDCONFIG is passed as /bin/true, and therefore it doesn't create the
symlink. So instead, create it directly inside the GNUmakefile,
without relying on ldconfig.
Upstream: https://github.com/weidai11/cryptopp/pull/1101
Signed-off-by: Kamel Bouhara <kamel.bouhara@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
GNUmakefile | 1 +
GNUmakefile-cross | 1 +
2 files changed, 2 insertions(+)
diff --git a/GNUmakefile b/GNUmakefile
index 23273edb..3b55e420 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1412,6 +1412,7 @@ ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
$(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
ifeq ($(HAS_SOLIB_VERSION),1)
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
+ -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
$(LDCONF) $(DESTDIR)$(LIBDIR)
endif
endif
diff --git a/GNUmakefile-cross b/GNUmakefile-cross
index 9847f04b..a2b87e4a 100644
--- a/GNUmakefile-cross
+++ b/GNUmakefile-cross
@@ -856,6 +856,7 @@ ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
$(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
ifeq ($(HAS_SOLIB_VERSION),1)
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
+ -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
$(LDCONF) $(DESTDIR)$(LIBDIR)
endif
endif
--
2.33.1

View File

@ -0,0 +1,8 @@
config BR2_PACKAGE_CRYPTOPP
bool "cryptopp"
depends on !BR2_STATIC_LIBS
help
A free C++ class library of cryptographic schemes
comment "cryptopp needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS

View File

@ -36,4 +36,35 @@ define HOST_CRYPTOPP_INSTALL_CMDS
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(HOST_DIR) install-lib
endef
define CRYPTOPP_EXTRACT_CMDS
$(UNZIP) $(CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D)
endef
CRYPTOPP_CXXFLAGS = $(TARGET_CXXFLAGS) -fPIC
# _mm256_broadcastsi128_si256 has been added only in gcc 4.9
ifneq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_9),y)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2
endif
CRYPTOPP_MAKE_OPTS = \
$(TARGET_CONFIGURE_OPTS) \
CXXFLAGS="$(CRYPTOPP_CXXFLAGS)"
define CRYPTOPP_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(CRYPTOPP_MAKE_OPTS) \
PREFIX=/usr shared libcryptopp.pc
endef
define CRYPTOPP_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=/usr DESTDIR=$(TARGET_DIR) \
LDCONFIG=/bin/true install-lib
endef
define CRYPTOPP_INSTALL_STAGING_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=/usr DESTDIR=$(STAGING_DIR) \
LDCONFIG=/bin/true install-lib
endef
$(eval $(generic-package))
$(eval $(host-generic-package))