Skip to contentSkip to conversation

New package: zxing

PATCH New Frank Hunleth 2 participants 2 messages Mar 26, 2012 – Jun 24, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 New package: zxing

---
 package/Config.in                                  |    1 +
 package/zxing/Config.in                            |   14 +++++++
 package/zxing/zxing-2.0-crosscompile-support.patch |   30 +++++++++++++++
 package/zxing/zxing.mk                             |   38 ++++++++++++++++++++
 4 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 package/zxing/Config.in
 create mode 100644 package/zxing/zxing-2.0-crosscompile-support.patch
 create mode 100644 package/zxing/zxing.mk
package/Config.in +1 -0
index b394f18..8bcf519 100644
@@ -322,6 +322,7 @@ source "package/pango/Config.in"
 source "package/pixman/Config.in"
 source "package/tiff/Config.in"
 source "package/webkit/Config.in"
+source "package/zxing/Config.in"
 endmenu
 
 menu "Hardware handling"
package/zxing/Config.in new file +14 -0
new file mode 100644
index 0000000..27cdf09
@@ -0,0 +1,14 @@
+comment "zxing requires a toolchain with C++ support"
+	depends on !BR2_INSTALL_LIBSTDCPP
+
+config BR2_PACKAGE_ZXING
+	bool "zxing"
+	depends on BR2_INSTALL_LIBSTDCPP
+	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
+	help
+	  ZXing (pronounced "zebra crossing") is an open-source, 
+	  multi-format 1D/2D barcode image processing library 
+	  implemented in Java, with ports to other languages. This
+	  compiles the C++ port.
+
+	  http://code.google.com/p/zxing/
package/zxing/zxing-2.0-crosscompile-support.patch new file +30 -0
new file mode 100644
index 0000000..0e863fb
@@ -0,0 +1,30 @@
+From 20826bfedafcdcddd1dc441c71ace9106bb7f3d9 Mon Sep 17 00:00:00 2001
+From: Frank Hunleth <[email protected]>
+Date: Sun, 18 Mar 2012 19:28:13 -0400
+Subject: [PATCH] SConscript: Add commandline parameter to specify crosscompile toolchain
+
+Signed-off-by: Frank Hunleth <[email protected]>
+---
+ cpp/SConscript |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/cpp/SConscript b/cpp/SConscript
+index 51c191d..584ae17 100644
+--- a/cpp/SConscript
++++ b/cpp/SConscript
+@@ -8,6 +8,12 @@ vars = Variables()
+ vars.Add(BoolVariable('DEBUG', 'Set to disable optimizations', 1))
+ vars.Add(BoolVariable('PIC', 'Set to 1 for to always generate PIC code', 0))
+ env = Environment(variables = vars)
++
++TARGET_CROSS = ARGUMENTS.get('TARGET_CROSS', '')
++env.Replace(CXX = TARGET_CROSS + 'gcc')
++env.Replace(AR = TARGET_CROSS + 'ar')
++env.Replace(RANLIB = TARGET_CROSS + 'ranlib')
++
+ # env.Replace(CXX = "clang++") 
+ 
+ debug = env['DEBUG']
+-- 
+1.7.0.4
+
package/zxing/zxing.mk new file +38 -0
new file mode 100644
index 0000000..3a5b635
@@ -0,0 +1,38 @@
+#############################################################
+#
+# zxing
+#
+#############################################################
+ZXING_VERSION = 2.0
+ZXING_SITE = http://zxing.googlecode.com/files
+ZXING_SOURCE = ZXing-$(ZXING_VERSION).zip
+ZXING_DEPENDENCIES = host-scons
+ZXING_INSTALL_STAGING = YES
+ZXING_INSTALL_TARGET = NO
+
+ifneq ($(BR2_ENABLE_LOCALE),y)
+ZXING_DEPENDENCIES += libiconv
+endif
+
+define ZXING_EXTRACT_CMDS
+	unzip -d $(BUILD_DIR) $(DL_DIR)/$(ZXING_SOURCE)
+endef
+
+define ZXING_BUILD_CMDS
+	(cd $(@D)/cpp; \
+		$(HOST_DIR)/usr/bin/scons TARGET_CROSS=$(TARGET_CROSS) DEBUG=0 lib)
+endef
+
+define ZXING_INSTALL_STAGING_CMDS
+	(cd $(@D)/cpp/build/core/src; \
+		find . -name "*.h" -exec $(INSTALL) -D "{}" "$(STAGING_DIR)/usr/include/{}" ";")
+	$(INSTALL) -D -m 0644 $(@D)/cpp/build/libzxing.a \
+		$(STAGING_DIR)/usr/lib/libzxing.a
+endef
+
+define ZXING_UNINSTALL_STAGING_CMDS
+	rm -f $(STAGING_DIR)/usr/lib/libzxing.a
+	rm -fr $(STAGING_DIR)/usr/include/zxing
+endef
+
+$(eval $(call GENTARGETS))
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 1/1 New package: zxing

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Frank" == Frank Hunleth <[email protected]> writes:

Frank> Signed-off-by: Frank Hunleth <[email protected]>

Thanks, committed. I ended up reworking it to use a simple makefile instead of scons, both because of the dos/unix newline issue you pointed out yourself, and also because scons hardcoded compiler flags.

See below for a few other minor issues.

Frank> +config BR2_PACKAGE_ZXING
Frank> + bool "zxing"
Frank> + depends on BR2_INSTALL_LIBSTDCPP
Frank> + select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
Frank> + help
Frank> + ZXing (pronounced "zebra crossing") is an open-source,
Frank> + multi-format 1D/2D barcode image processing library

These two lines have trailing spaces.

Frank> +++ b/package/zxing/zxing.mk
Frank> @@ -0,0 +1,38 @@
Frank> +############################################################# Frank> +#
Frank> +# zxing
Frank> +#
Frank> +############################################################# Frank> +ZXING_VERSION = 2.0
Frank> +ZXING_SITE = http://zxing.googlecode.com/files
Frank> +ZXING_SOURCE = ZXing-$(ZXING_VERSION).zip
Frank> +ZXING_DEPENDENCIES = host-scons
Frank> +ZXING_INSTALL_STAGING = YES
Frank> +ZXING_INSTALL_TARGET = NO

Buildroot can be used to build a native compiler and development environment, so we also install into target. If BR2_HAVE_DEVFILES is disabled, then the target filesystem is cleaned up of usr/lib/lib*.a / usr/include before the filesystem images are created.

Signature · 1 line
Bye, Peter Korsgaard