Skip to contentSkip to conversation

New package: zxing

PATCH New Frank Hunleth 2 participants 6 messages Mar 20, 2012 – Mar 26, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 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 f0ce963..063da26 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..5f5b6f1
@@ -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-python
+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; \
+		$(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/python $(@D)/cpp/scons/scons.py 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 1/1 New package: zxing

Quoted 5 lines · Frank Hunleth

---

?package/Config.in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
?package/zxing/Config.in ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 14 +++++++
?package/zxing/zxing-2.0-crosscompile-support.patch | ? 30 +++++++++++++++

One quick note on zxing-2.0-crosscompile-support.patch. It modifies an SConscript file in zxing that has CRLF line endings. I'm not sure if the line endings got stripped by git send-email or anything downstream, but if they did, I just noticed that the patch fails to apply.

-Frank

#2 lore raw

PATCH 1/1 New package: zxing

In reply to Frank Hunleth

On Tuesday 20 March 2012 01:56:49 Frank Hunleth wrote:

[snip]

package/zxing/zxing-2.0-crosscompile-support.patch line 23

Quoted 13 lines
package/zxing/zxing-2.0-crosscompile-support.patch new file +13 -0
+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')

It's a pity that scons doesn't provide a way to put things in the
environment from the command line. Well, probably it does provide a way to do that but I couldn't find it either :-)

Would it help to use buildroot's host-scons rather than the
packaged scons?

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 1/1 New package: zxing

Quoted 12 lines · Arnout Vandecappelle

On Tuesday 20 March 2012 01:56:49 Frank Hunleth wrote:

[snip]

Quoted 9 lines
package/zxing/zxing-2.0-crosscompile-support.patch new file +9 -0
+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)
++
Quoted 8 lines
Quoted 4 lines

++TARGET_CROSS = ARGUMENTS.get('TARGET_CROSS', '') ++env.Replace(CXX = TARGET_CROSS + 'gcc') ++env.Replace(AR = TARGET_CROSS + 'ar') ++env.Replace(RANLIB = TARGET_CROSS + 'ranlib')

?It's a pity that scons doesn't provide a way to put things in the environment from the command line. ?Well, probably it does provide a way to do that but I couldn't find it either :-)

Completely agree. I looked and looked. I couldn't find anything either and what I did find led me to the above patch.

Quoted 2 lines

?Would it help to use buildroot's host-scons rather than the packaged scons?

That was the approach that I was originally going to take, and then I got worried about there being any differences between host-scons and the packaged scons. I assume that they packaged scons with their release for a reason. Maybe it was just for convenience, but I wasn't sure. Not having used scons before, it using their packaged version seemed like the *safe* approach.

Thanks,
Frank

Quoted 11 lines

?Regards,
?Arnout

--
Arnout Vandecappelle ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? arnout at mind be Senior Embedded Software Architect ? ? ? ? ? ? ? ? +32-16-286540 Essensium/Mind ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium ? ? ? ? ? ? ? ?BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: ?7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

#4 lore raw

PATCH 1/1 New package: zxing

Quoted 9 lines · On Sunday 25 March 2012 22:48:12 Frank Hunleth wrote:
Quoted 2 lines

Would it help to use buildroot's host-scons rather than the
packaged scons?

That was the approach that I was originally going to take, and then I got worried about there being any differences between host-scons and the packaged scons. I assume that they packaged scons with their release for a reason. Maybe it was just for convenience, but I wasn't sure. Not having used scons before, it using their packaged version seemed like the safe approach.

I think the packaged version is only there because scons is usually not
installed on your system and they don't want to have external dependencies. Only one way to find out: try it! :-)

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

PATCH 1/1 New package: zxing

Quoted 5 lines · Arnout Vandecappelle

[snip]

?I think the packaged version is only there because scons is usually not installed on your system and they don't want to have external dependencies. Only one way to find out: try it! :-)

Hint taken. :)

The host-scons version works just as well as the packaged scons. I just sent a v2 patch with the host-scons change. Certainly, the zxing.mk file looks better now that it doesn't have direct the python dependency. Speaking of which, I noticed that scons.mk does not depend on host-python and just uses the local system's version of python. Is that ok?

Frank