package/cryptopp: add a target build configuration
PATCH 1/1 package/cryptopp: add a target build configuration
Currently only a host build is supported for cryptopp, this add a new configuration and build support for the make target.
--- package/Config.in | 1 + ...ied-SONAME-to-shared-object-for-Linu.patch | 27 ++++++++++++++ package/cryptopp/Config.in | 4 +++ package/cryptopp/Config.in.host | 4 +++ package/cryptopp/cryptopp.mk | 36 ++++++++++++++----- 5 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch create mode 100644 package/cryptopp/Config.in create mode 100644 package/cryptopp/Config.in.host
package/Config.in +1 -0
@@ -1279,6 +1279,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"
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch new file +27 -0
@@ -0,0 +1,27 @@ +From 78eb43f50978ffd780cf31b1cea6736dadc6b155 Mon Sep 17 00:00:00 2001 +From: Kamel Bouhara <[email protected]> +Date: Mon, 6 Jul 2020 17:10:55 +0200 +Subject: [PATCH] Add fully-qualified SONAME to shared object for Linux + +From: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html + +Signed-off-by: Kamel Bouhara <[email protected]> +--- + GNUmakefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/GNUmakefile b/GNUmakefile +index e7b7b3a6..730e2a6f 100755 +--- a/GNUmakefile ++++ b/GNUmakefile +@@ -1256,6 +1256,7 @@ ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),) + $(CHMOD) 0755 $(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.26.2 +
package/cryptopp/Config.in new file +4 -0
@@ -0,0 +1,4 @@ +config BR2_PACKAGE_CRYPTOPP + bool "cryptopp" + help + A free C++ class library of cryptographic schemes
package/cryptopp/Config.in.host new file +4 -0
@@ -0,0 +1,4 @@ +config BR2_PACKAGE_HOST_CRYPTOPP + bool "cryptopp" + help + A free C++ class library of cryptographic schemes
package/cryptopp/cryptopp.mk +28 -8
@@ -12,26 +12,46 @@ CRYPTOPP_LICENSE_FILES = License.txt CRYPTOPP_INSTALL_STAGING = YES define HOST_CRYPTOPP_EXTRACT_CMDS - $(UNZIP) $(HOST_CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D) + $(UNZIP) $(HOST_CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D) endef -HOST_CRYPTOPP_CXXFLAGS = $(HOST_CFLAGS) -fPIC - # _mm256_broadcastsi128_si256 has been added only in gcc 4.9 ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9),y) -HOST_CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2 + CRYPTOPP_CXXFLAGS = -DCRYPTOPP_DISABLE_AVX2 endif HOST_CRYPTOPP_MAKE_OPTS = \ - $(HOST_CONFIGURE_OPTS) \ - CXXFLAGS="$(HOST_CRYPTOPP_CXXFLAGS)" + $(HOST_CONFIGURE_OPTS) \ + CXXFLAGS="$(HOST_CFLAGS) -fPIC $(CRYPTOPP_CXXFLAGS)" define HOST_CRYPTOPP_BUILD_CMDS - $(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_CRYPTOPP_MAKE_OPTS) shared + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_CRYPTOPP_MAKE_OPTS) shared endef define HOST_CRYPTOPP_INSTALL_CMDS - $(HOST_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(HOST_DIR) install-lib + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(HOST_DIR) install-lib +endef + +CRYPTOPP_MAKE_OPTS = \ + $(TARGET_CONFIGURE_OPTS) \ + CXXFLAGS="$(TARGET_CFLAGS) -fPIC $(CRYPTOPP_CXXFLAGS)" + +define CRYPTOPP_EXTRACT_CMDS + $(UNZIP) $(CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D) +endef + +define CRYPTOPP_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(CRYPTOPP_MAKE_OPTS) shared +endef + +define CRYPTOPP_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(TARGET_DIR) install-lib +endef + +define CRYPTOPP_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(STAGING_DIR)/usr libcryptopp.pc + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(STAGING_DIR)/usr install-lib endef +$(eval $(generic-package)) $(eval $(host-generic-package))
Signature · 1 line
2.26.2
PATCH 1/1 package/cryptopp: add a target build configuration
Hello,
Thanks for the patch! See below for some comments.
Quoted 4 lines · On Mon, 6 Jul 2020 17:31:28 +0200 Kamel Bouhara <[email protected]>…
package/Config.in | 1 + ...ied-SONAME-to-shared-object-for-Linu.patch | 27 ++++++++++++++ package/cryptopp/Config.in | 4 +++ package/cryptopp/Config.in.host | 4 +++
This file is added, but not used anywhere. In fact, we don't need it at all.
Quoted 17 lines
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch new file +11
-0@@ -0,0 +1,27 @@ +From 78eb43f50978ffd780cf31b1cea6736dadc6b155 Mon Sep 17 00:00:00 2001 +From: Kamel Bouhara <[email protected]> +Date: Mon, 6 Jul 2020 17:10:55 +0200 +Subject: [PATCH] Add fully-qualified SONAME to shared object for Linux + +From: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html + +Signed-off-by: Kamel Bouhara <[email protected]> +--- + GNUmakefile | 1 + + 1 file changed, 1 insertion(+)
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch line 21
Quoted 10 lines
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch new file +10
-0+ +diff --git a/GNUmakefile b/GNUmakefile +index e7b7b3a6..730e2a6f 100755 +--- a/GNUmakefile ++++ b/GNUmakefile +@@ -1256,6 +1256,7 @@ ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),) + $(CHMOD) 0755 $(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)
Is there something creating the .so symlink then ?
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 15
Quoted 11 lines
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch new file +1
-0+ A free C++ class library of cryptographic schemespackage/cryptopp/cryptopp.mk +1
-1@@ -12,26 +12,46 @@ CRYPTOPP_LICENSE_FILES = License.txt CRYPTOPP_INSTALL_STAGING = YES define HOST_CRYPTOPP_EXTRACT_CMDS - $(UNZIP) $(HOST_CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D) + $(UNZIP) $(HOST_CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D)
You've broken the indentation here: a TAB is correct, your change to spaces is not. This is an issue globally.
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 19
Quoted 6 lines
package/cryptopp/cryptopp.mk +0
-2endef -HOST_CRYPTOPP_CXXFLAGS = $(HOST_CFLAGS) -fPIC - # _mm256_broadcastsi128_si256 has been added only in gcc 4.9 ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9),y)
So you're testing the host compiler capabilities...
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 20
Quoted 2 lines
package/cryptopp/cryptopp.mk +1
-1-HOST_CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2 + CRYPTOPP_CXXFLAGS = -DCRYPTOPP_DISABLE_AVX2
... to then decide something compiled for the target ? Not good.
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 21
Quoted 1 line
package/cryptopp/cryptopp.mk +0
-0endif
You need to keep separate HOST_CRYPTOPP_CXXFLAGS and CRYPTOPP_CXXFLAGS, and test on the compiler version separately, as the host compiler and target compiler can be different.
Note that on the target variant, you need to test a configuration with static libraries only, because you're passing unconditionally -fPIC and the Makefile seems to be building only shared libraries, so that will likely fail on static only configuration. Perhaps a "depends on !BR2_STATIC_LIBS" is needed in the Config.in.
Quoted 5 lines
package/cryptopp/cryptopp.mk +2
-2HOST_CRYPTOPP_MAKE_OPTS = \ - $(HOST_CONFIGURE_OPTS) \ - CXXFLAGS="$(HOST_CRYPTOPP_CXXFLAGS)" + $(HOST_CONFIGURE_OPTS) \ + CXXFLAGS="$(HOST_CFLAGS) -fPIC $(CRYPTOPP_CXXFLAGS)"
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 33
Quoted 10 lines
package/cryptopp/cryptopp.mk +3
-2define HOST_CRYPTOPP_BUILD_CMDS - $(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_CRYPTOPP_MAKE_OPTS) shared + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_CRYPTOPP_MAKE_OPTS) shared endef define HOST_CRYPTOPP_INSTALL_CMDS - $(HOST_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(HOST_DIR) install-lib + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(HOST_DIR) install-lib +endef
Please fix the indentation. It seems like you didn't review the diff you're sending.
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 44
Quoted 10 lines
package/cryptopp/cryptopp.mk +10
-0+CRYPTOPP_MAKE_OPTS = \ + $(TARGET_CONFIGURE_OPTS) \ + CXXFLAGS="$(TARGET_CFLAGS) -fPIC $(CRYPTOPP_CXXFLAGS)" + +define CRYPTOPP_EXTRACT_CMDS + $(UNZIP) $(CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D) +endef + +define CRYPTOPP_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(CRYPTOPP_MAKE_OPTS) shared
Ah, there's a "shared" target, so in fact perhaps it can also build a static library ?
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 53
Quoted 7 lines
package/cryptopp/cryptopp.mk +7
-0+define CRYPTOPP_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(TARGET_DIR) install-lib +endef + +define CRYPTOPP_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(STAGING_DIR)/usr libcryptopp.pc + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(STAGING_DIR)/usr install-lib
It is strange that the PREFIX is just $(TARGET_DIR) in one case, and $(STAGING_DIR)/usr in the other. Could you explain ?
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 package/cryptopp: add a target build configuration
Quoted 2 lines · Thomas Petazzoni
Hello,
Hello,
Quoted 5 lines
Thanks for the patch! See below for some comments.
On Mon, 6 Jul 2020 17:31:28 +0200
Kamel Bouhara <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
package/Config.in | 1 + ...ied-SONAME-to-shared-object-for-Linu.patch | 27 ++++++++++++++ package/cryptopp/Config.in | 4 +++ package/cryptopp/Config.in.host | 4 +++This file is added, but not used anywhere. In fact, we don't need it at all.
Ok thanks.
Quoted 22 lines
Quoted 22 lines
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch new file +15
-0@@ -0,0 +1,27 @@ +From 78eb43f50978ffd780cf31b1cea6736dadc6b155 Mon Sep 17 00:00:00 2001 +From: Kamel Bouhara <[email protected]> +Date: Mon, 6 Jul 2020 17:10:55 +0200 +Subject: [PATCH] Add fully-qualified SONAME to shared object for Linux + +From: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html + +Signed-off-by: Kamel Bouhara <[email protected]> +--- + GNUmakefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/GNUmakefile b/GNUmakefile +index e7b7b3a6..730e2a6f 100755 +--- a/GNUmakefile
Quoted 9 lines
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch line 21
Quoted 6 lines
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch new file +6
-0++++ b/GNUmakefile +@@ -1256,6 +1256,7 @@ ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),) + $(CHMOD) 0755 $(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)Is there something creating the .so symlink then ?
Actually the .so is the realname here which is not the way it should be as I understand the shared libs conventions, here it should be:
- libcryptopp.so$(SOLIB_VERSION_SUFFIX} -> realname, not a symlink
- libcryptopp.so -> symlink to realname
- libcryptopp.so$(SOLIB_COMPAT_SUFFIX) -> symlink to realname
Is it right ?
Quoted 9 lines
Quoted 9 lines
package/cryptopp/0001-Add-fully-qualified-SONAME-to-shared-object-for-Linu.patch new file +1
-0+ A free C++ class library of cryptographic schemespackage/cryptopp/cryptopp.mk +0
-0@@ -12,26 +12,46 @@ CRYPTOPP_LICENSE_FILES = License.txt CRYPTOPP_INSTALL_STAGING = YES
Quoted 6 lines
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 15
Quoted 3 lines
package/cryptopp/cryptopp.mk +1
-1define HOST_CRYPTOPP_EXTRACT_CMDS - $(UNZIP) $(HOST_CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D) + $(UNZIP) $(HOST_CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D)You've broken the indentation here: a TAB is correct, your change to spaces is not. This is an issue globally.
Sorry, I'll fix that.
Quoted 15 lines
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 19
Quoted 7 lines
package/cryptopp/cryptopp.mk +0
-2endef -HOST_CRYPTOPP_CXXFLAGS = $(HOST_CFLAGS) -fPIC - # _mm256_broadcastsi128_si256 has been added only in gcc 4.9 ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9),y)So you're testing the host compiler capabilities...
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 20
Quoted 2 lines
package/cryptopp/cryptopp.mk +1
-1-HOST_CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2 + CRYPTOPP_CXXFLAGS = -DCRYPTOPP_DISABLE_AVX2... to then decide something compiled for the target ? Not good.
Quoted 6 lines
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 21
Quoted 1 line
package/cryptopp/cryptopp.mk +0
-0endifYou need to keep separate
HOST_CRYPTOPP_CXXFLAGSandCRYPTOPP_CXXFLAGS, and test on the compiler version separately, as the host compiler and target compiler can be different.
Indeed, I missed that for the target
Quoted 25 lines
Note that on the target variant, you need to test a configuration with static libraries only, because you're passing unconditionally -fPIC and the
Makefileseems to be building only shared libraries, so that will likely fail on static only configuration. Perhaps a "depends on !BR2_STATIC_LIBS" is needed in the Config.in.Quoted 5 lines
package/cryptopp/cryptopp.mk +2
-2HOST_CRYPTOPP_MAKE_OPTS = \ - $(HOST_CONFIGURE_OPTS) \ - CXXFLAGS="$(HOST_CRYPTOPP_CXXFLAGS)" + $(HOST_CONFIGURE_OPTS) \ + CXXFLAGS="$(HOST_CFLAGS) -fPIC $(CRYPTOPP_CXXFLAGS)"package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 33
Quoted 10 lines
package/cryptopp/cryptopp.mk +3
-2define HOST_CRYPTOPP_BUILD_CMDS - $(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_CRYPTOPP_MAKE_OPTS) shared + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_CRYPTOPP_MAKE_OPTS) shared endef define HOST_CRYPTOPP_INSTALL_CMDS - $(HOST_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(HOST_DIR) install-lib + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(HOST_DIR) install-lib +endefPlease fix the indentation. It seems like you didn't review the diff you're sending.
Quoted 14 lines
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 44
Quoted 10 lines
package/cryptopp/cryptopp.mk +10
-0+CRYPTOPP_MAKE_OPTS = \ + $(TARGET_CONFIGURE_OPTS) \ + CXXFLAGS="$(TARGET_CFLAGS) -fPIC $(CRYPTOPP_CXXFLAGS)" + +define CRYPTOPP_EXTRACT_CMDS + $(UNZIP) $(CRYPTOPP_DL_DIR)/$(CRYPTOPP_SOURCE) -d $(@D) +endef + +define CRYPTOPP_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(CRYPTOPP_MAKE_OPTS) sharedAh, there's a "shared" target, so in fact perhaps it can also build a static library ?
Yes, by default the static library is built.
Quoted 11 lines
package/cryptopp/cryptopp.mk CRYPTOPP_LICENSE_FILES = License.txt · line 53
Quoted 7 lines
package/cryptopp/cryptopp.mk +7
-0+define CRYPTOPP_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(TARGET_DIR) install-lib +endef + +define CRYPTOPP_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(STAGING_DIR)/usr libcryptopp.pc + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) PREFIX=$(STAGING_DIR)/usr install-libIt is strange that the PREFIX is just $(TARGET_DIR) in one case, and $(STAGING_DIR)/usr in the other. Could you explain ?
This shall be "/usr" in any case.
Thanks for the review,
Best regards,
Kamel
Quoted 7 lines
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
--
Kamel Bouhara, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com