Skip to contentSkip to conversation

package/zxing-cpp: add options for enabling readers and/or writers

PATCH Superseded Dario Binacchi 2 participants 2 messages May 18, 2024

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/zxing-cpp: add options for enabling readers and/or writers

The patch allows you to choose whether to build encoding (BUILD_WRITERS), decoding (BUILD_READERS) or both. At least one of the two options must be enabled. This way, it's possible to keep the library size at minimum. By default, to ensure backward compatibility, both are compiled.

---
Changes v1 -> v2:
- Drop BR2_PACKAGE_ZXING_CPP_READERS_AND_WRITERS selection

 package/zxing-cpp/Config.in    | 17 +++++++++++++++++
 package/zxing-cpp/zxing-cpp.mk | 14 ++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
package/zxing-cpp/Config.in +17 -0
index b72a00ec35f9..511c21e7360a 100644
@@ -17,3 +17,20 @@ config BR2_PACKAGE_ZXING_CPP
 	  compiles the C++ port.
 
 	  https://github.com/zxing-cpp/zxing-cpp
+
+if BR2_PACKAGE_ZXING_CPP
+comment "At least one of readers/writers must be enabled"
+
+config BR2_PACKAGE_ZXING_CPP_READERS
+	bool "readers support"
+	default y
+	help
+	  Build with readers (decoders) support
+
+config BR2_PACKAGE_ZXING_CPP_WRITERS
+	bool "writers support"
+	default y
+	help
+	  Build with writers (encoders) support
+
+endif # BR2_PACKAGE_ZXING_CPP
package/zxing-cpp/zxing-cpp.mk +12 -2
index 86a1ef96806d..077d7e75d3dd 100644
@@ -12,8 +12,6 @@ ZXING_CPP_INSTALL_STAGING = YES
 ZXING_CPP_SUPPORTS_IN_SOURCE_BUILD = NO
 ZXING_CPP_DEPENDENCIES = host-pkgconf stb
 ZXING_CPP_CONF_OPTS = \
-	-DBUILD_READERS=ON \
-	-DBUILD_WRITERS=ON \
 	-DBUILD_BLACKBOX_TESTS=OFF \
 	-DBUILD_UNIT_TESTS=OFF \
 	-DBUILD_DEPENDENCIES=LOCAL
@@ -28,4 +26,16 @@ else
 ZXING_CPP_CONF_OPTS += -DBUILD_PYTHON_MODULE=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_ZXING_CPP_READERS),y)
+ZXING_CPP_CONF_OPTS += -DBUILD_READERS=ON
+else
+ZXING_CPP_CONF_OPTS += -DBUILD_READERS=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_ZXING_CPP_WRITERS),y)
+ZXING_CPP_CONF_OPTS += -DBUILD_WRITERS=ON
+else
+ZXING_CPP_CONF_OPTS += -DBUILD_WRITERS=OFF
+endif
+
 $(eval $(cmake-package))
Signature · 6 lines
2.43.0

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

Hello Dario,

package/zxing-cpp/Config.in config BR2_PACKAGE_ZXING_CPP · line 22

Quoted 2 lines · On Sat, 18 May 2024 11:40:06 +0200 Dario Binacchi…
package/zxing-cpp/Config.in +2 -0
+if BR2_PACKAGE_ZXING_CPP
+comment "At least one of readers/writers must be enabled"

This comment is not really useful, as it doesn't force anything. If really at least one of readers or writers are needed, then you should do this in the main BR2_PACKAGE_ZXING option:

select BR2_PACKAGE_ZXING_CPP_READERS if !BR2_PACKAGE_ZXING_CPP_WRITERS

This will ensure that readers are selected if writers are not selected. But it will still allow to deselect readers if writers are enabled.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot