diff mbox series

[v3] package/i2c-tools: bump to version 4.0

Message ID 1512569963-7256-1-git-send-email-angelo@amarulasolutions.com
State Superseded
Headers show
Series [v3] package/i2c-tools: bump to version 4.0 | expand

Commit Message

Angelo Compagnucci Dec. 6, 2017, 2:19 p.m. UTC
This patch bumps i2c-tools to version 4.0 and adds a couple of
new commands named i2ctransfer and eeprog.
It adds also an upstream commit not included in the release
that fixing a static compilation issue.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
Changes:
v1 -> v2: added upstream commit to fix static compilation issues
v2 -> v3: fixing logic around BR2_SHARED_STATIC_LIBS (suggested by Baruch Siach)


 ...efile-Add-flag-to-disable-dynamic-library.patch | 64 ++++++++++++++++++++++
 package/i2c-tools/i2c-tools.hash                   |  2 +-
 package/i2c-tools/i2c-tools.mk                     | 16 +++++-
 3 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 package/i2c-tools/0001-Makefile-Add-flag-to-disable-dynamic-library.patch

Comments

Thomas Petazzoni Dec. 6, 2017, 10:38 p.m. UTC | #1
Hello,

On Wed,  6 Dec 2017 15:19:23 +0100, Angelo Compagnucci wrote:
> This patch bumps i2c-tools to version 4.0 and adds a couple of
> new commands named i2ctransfer and eeprog.
> It adds also an upstream commit not included in the release
> that fixing a static compilation issue.
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>

I have a minor nit below, but most importantly, there is a parallel
build issue with this update. I built i2c-tools about 10 times, and it
failed 3 times, with errors like this:

/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc -shared  -Wl,--version-script=lib/libi2c.map -Wl,-soname,libi2c.so.0 -o lib/libi2c.so.0.1.0 lib/smbus.o -lc
/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc  -o tools/i2cdetect tools/i2cdetect.o tools/i2cbusses.o -Llib -li2c
lib/libi2c.so: file not recognized: File truncated
collect2: error: ld returned 1 exit status
make[2]: *** [tools/Module.mk:28: tools/i2cdetect] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [package/pkg-generic.mk:250: /home/thomas/projets/buildroot/output/build/i2c-tools-4.0/.stamp_built] Error 2
make: *** [Makefile:79: _all] Error 2

/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc  -o tools/i2cdetect tools/i2cdetect.o tools/i2cbusses.o -Llib -li2c
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.9.4/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -li2c
collect2: error: ld returned 1 exit status
make[2]: *** [tools/Module.mk:28: tools/i2cdetect] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [package/pkg-generic.mk:250: /home/thomas/projets/buildroot/output/build/i2c-tools-4.0/.stamp_built] Error 2
make: *** [Makefile:79: _all] Error 2

So it seems like the dependency chain in the i2c-tools Makefile is not correct.


> +Subject: [PATCH 1/2] Makefile: Add flag to disable dynamic library

Subject should be [PATCH] instead of [PATCH 1/2]. Note that I had fixed
this locally, because it's a very minor nit. But I refrained from
applying due to the parallel build problem.

Could you have a look at the parallel build problem ?

Thanks a lot!

Thomas
Angelo Compagnucci Dec. 7, 2017, 7:43 a.m. UTC | #2
Dear Thomas,

Il 06 dic 2017 11:39 PM, "Thomas Petazzoni" <
thomas.petazzoni@free-electrons.com> ha scritto:

Hello,

On Wed,  6 Dec 2017 15:19:23 +0100, Angelo Compagnucci wrote:
> This patch bumps i2c-tools to version 4.0 and adds a couple of
> new commands named i2ctransfer and eeprog.
> It adds also an upstream commit not included in the release
> that fixing a static compilation issue.
>
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>

I have a minor nit below, but most importantly, there is a parallel
build issue with this update. I built i2c-tools about 10 times, and it
failed 3 times, with errors like this:

/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc -shared
-Wl,--version-script=lib/libi2c.map -Wl,-soname,libi2c.so.0 -o
lib/libi2c.so.0.1.0 lib/smbus.o -lc
/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc  -o
tools/i2cdetect tools/i2cdetect.o tools/i2cbusses.o -Llib -li2c
lib/libi2c.so: file not recognized: File truncated
collect2: error: ld returned 1 exit status
make[2]: *** [tools/Module.mk:28: tools/i2cdetect] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [package/pkg-generic.mk:250: /home/thomas/projets/
buildroot/output/build/i2c-tools-4.0/.stamp_built] Error 2
make: *** [Makefile:79: _all] Error 2

/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc  -o
tools/i2cdetect tools/i2cdetect.o tools/i2cbusses.o -Llib -li2c
/home/thomas/projets/buildroot/output/host/opt/ext-
toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/
4.9.4/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find
-li2c
collect2: error: ld returned 1 exit status
make[2]: *** [tools/Module.mk:28: tools/i2cdetect] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [package/pkg-generic.mk:250: /home/thomas/projets/
buildroot/output/build/i2c-tools-4.0/.stamp_built] Error 2
make: *** [Makefile:79: _all] Error 2

So it seems like the dependency chain in the i2c-tools Makefile is not
correct.


> +Subject: [PATCH 1/2] Makefile: Add flag to disable dynamic library

Subject should be [PATCH] instead of [PATCH 1/2]. Note that I had fixed
this locally, because it's a very minor nit. But I refrained from
applying due to the parallel build problem.

Could you have a look at the parallel build problem ?


I remember to have seen a patch about this problem passing on the mailing
list.
I'll try it as soon as possible!

Sincerely, Angelo


Thanks a lot!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
<div dir="auto"><div>Dear Thomas,<br><div class="gmail_extra"><br><div class="gmail_quote">Il 06 dic 2017 11:39 PM, &quot;Thomas Petazzoni&quot; &lt;<a href="mailto:thomas.petazzoni@free-electrons.com">thomas.petazzoni@free-electrons.com</a>&gt; ha scritto:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<div class="quoted-text"><br>
On Wed,  6 Dec 2017 15:19:23 +0100, Angelo Compagnucci wrote:<br>
&gt; This patch bumps i2c-tools to version 4.0 and adds a couple of<br>
&gt; new commands named i2ctransfer and eeprog.<br>
&gt; It adds also an upstream commit not included in the release<br>
&gt; that fixing a static compilation issue.<br>
&gt;<br>
&gt; Signed-off-by: Angelo Compagnucci &lt;<a href="mailto:angelo@amarulasolutions.com">angelo@amarulasolutions.com</a>&gt;<br>
<br>
</div>I have a minor nit below, but most importantly, there is a parallel<br>
build issue with this update. I built i2c-tools about 10 times, and it<br>
failed 3 times, with errors like this:<br>
<br>
/home/thomas/projets/<wbr>buildroot/output/host/bin/arm-<wbr>linux-gcc -shared  -Wl,--version-script=lib/<wbr>libi2c.map -Wl,-soname,libi2c.so.0 -o lib/libi2c.so.0.1.0 lib/smbus.o -lc<br>
/home/thomas/projets/<wbr>buildroot/output/host/bin/arm-<wbr>linux-gcc  -o tools/i2cdetect tools/i2cdetect.o tools/i2cbusses.o -Llib -li2c<br>
lib/libi2c.so: file not recognized: File truncated<br>
collect2: error: ld returned 1 exit status<br>
make[2]: *** [tools/Module.mk:28: tools/i2cdetect] Error 1<br>
make[2]: *** Waiting for unfinished jobs....<br>
make[1]: *** [package/<a href="http://pkg-generic.mk:250" rel="noreferrer" target="_blank">pkg-generic.mk:250</a>: /home/thomas/projets/<wbr>buildroot/output/build/i2c-<wbr>tools-4.0/.stamp_built] Error 2<br>
make: *** [Makefile:79: _all] Error 2<br>
<br>
/home/thomas/projets/<wbr>buildroot/output/host/bin/arm-<wbr>linux-gcc  -o tools/i2cdetect tools/i2cdetect.o tools/i2cbusses.o -Llib -li2c<br>
/home/thomas/projets/<wbr>buildroot/output/host/opt/ext-<wbr>toolchain/bin/../lib/gcc/arm-<wbr>buildroot-linux-uclibcgnueabi/<wbr>4.9.4/../../../../arm-<wbr>buildroot-linux-uclibcgnueabi/<wbr>bin/ld: cannot find -li2c<br>
collect2: error: ld returned 1 exit status<br>
make[2]: *** [tools/Module.mk:28: tools/i2cdetect] Error 1<br>
make[2]: *** Waiting for unfinished jobs....<br>
make[1]: *** [package/<a href="http://pkg-generic.mk:250" rel="noreferrer" target="_blank">pkg-generic.mk:250</a>: /home/thomas/projets/<wbr>buildroot/output/build/i2c-<wbr>tools-4.0/.stamp_built] Error 2<br>
make: *** [Makefile:79: _all] Error 2<br>
<br>
So it seems like the dependency chain in the i2c-tools Makefile is not correct.<br>
<div class="quoted-text"><br>
<br>
&gt; +Subject: [PATCH 1/2] Makefile: Add flag to disable dynamic library<br>
<br>
</div>Subject should be [PATCH] instead of [PATCH 1/2]. Note that I had fixed<br>
this locally, because it&#39;s a very minor nit. But I refrained from<br>
applying due to the parallel build problem.<br>
<br>
Could you have a look at the parallel build problem ?<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I remember to have seen a patch about this problem passing on the mailing list.</div><div dir="auto">I&#39;ll try it as soon as possible!</div><div dir="auto"><br></div><div dir="auto">Sincerely, Angelo</div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks a lot!<br>
<font color="#888888"><br>
Thomas<br>
--<br>
Thomas Petazzoni, CTO, Free Electrons<br>
Embedded Linux and Kernel engineering<br>
<a href="http://free-electrons.com" rel="noreferrer" target="_blank">http://free-electrons.com</a><br>
</font></blockquote></div><br></div></div></div>
diff mbox series

Patch

diff --git a/package/i2c-tools/0001-Makefile-Add-flag-to-disable-dynamic-library.patch b/package/i2c-tools/0001-Makefile-Add-flag-to-disable-dynamic-library.patch
new file mode 100644
index 0000000..5a585b2
--- /dev/null
+++ b/package/i2c-tools/0001-Makefile-Add-flag-to-disable-dynamic-library.patch
@@ -0,0 +1,64 @@ 
+From 9906b2ecb6aec02d6348d6237b784135e6930d0b Mon Sep 17 00:00:00 2001
+From: Angelo Compagnucci <angelo@amarulasolutions.com>
+Date: Wed, 6 Dec 2017 10:12:07 +0100
+Subject: [PATCH 1/2] Makefile: Add flag to disable dynamic library
+
+In such cases where you need to disable entirely the dynamic
+library compilation, now you can use the BUILD_DYNAMIC_LIB=0
+flag.
+
+Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
+Signed-off-by: Jean Delvare <jdelvare@suse.de>
+---
+ Makefile      | 10 +++++++++-
+ lib/Module.mk |  6 +++++-
+ 2 files changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index c85317c..1bb5572 100644
+--- a/Makefile
++++ b/Makefile
+@@ -32,12 +32,20 @@ CFLAGS		?= -O2
+ CFLAGS		+= -Wall
+ SOCFLAGS	:= -fpic -D_REENTRANT $(CFLAGS)
+ 
+-USE_STATIC_LIB ?= 0
++BUILD_DYNAMIC_LIB ?= 1
+ BUILD_STATIC_LIB ?= 1
++USE_STATIC_LIB ?= 0
++
+ ifeq ($(USE_STATIC_LIB),1)
+ BUILD_STATIC_LIB := 1
+ endif
+ 
++ifeq ($(BUILD_DYNAMIC_LIB),0)
++ifeq ($(BUILD_STATIC_LIB),0)
++$(error BUILD_DYNAMIC_LIB and BUILD_STATIC_LIB cannot be disabled at the same time)
++endif
++endif
++
+ KERNELVERSION	:= $(shell uname -r)
+ 
+ .PHONY: all strip clean install uninstall
+diff --git a/lib/Module.mk b/lib/Module.mk
+index fd2c8c4..44fa938 100644
+--- a/lib/Module.mk
++++ b/lib/Module.mk
+@@ -27,9 +27,13 @@ LIB_SHSONAME	:= $(LIB_SHBASENAME).$(LIB_MAINVER)
+ LIB_SHLIBNAME	:= $(LIB_SHBASENAME).$(LIB_VER)
+ LIB_STLIBNAME	:= libi2c.a
+ 
+-LIB_TARGETS	:= $(LIB_SHLIBNAME)
+ LIB_LINKS	:= $(LIB_SHSONAME) $(LIB_SHBASENAME)
+ LIB_OBJECTS	:= smbus.o
++
++LIB_TARGETS	:=
++ifeq ($(BUILD_DYNAMIC_LIB),1)
++LIB_TARGETS	+= $(LIB_SHLIBNAME)
++endif
+ ifeq ($(BUILD_STATIC_LIB),1)
+ LIB_TARGETS	+= $(LIB_STLIBNAME)
+ LIB_OBJECTS	+= smbus.ao
+-- 
+2.7.4
+
diff --git a/package/i2c-tools/i2c-tools.hash b/package/i2c-tools/i2c-tools.hash
index 464219d..3475d20 100644
--- a/package/i2c-tools/i2c-tools.hash
+++ b/package/i2c-tools/i2c-tools.hash
@@ -1,5 +1,5 @@ 
 # Locally computed
-sha256 6d6079153cd49a62d4addacef4c092db1a46ba60b2807070a3fbe050262aef87  i2c-tools-3.1.2.tar.xz
+sha256 d900ca1c11c51ea20caa50b096f948008b8a7ad832311b23353e21baa7af28d6  i2c-tools-4.0.tar.xz
 
 # License file
 sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6  COPYING
diff --git a/package/i2c-tools/i2c-tools.mk b/package/i2c-tools/i2c-tools.mk
index 3bbaf38..e1a1f98 100644
--- a/package/i2c-tools/i2c-tools.mk
+++ b/package/i2c-tools/i2c-tools.mk
@@ -4,11 +4,12 @@ 
 #
 ################################################################################
 
-I2C_TOOLS_VERSION = 3.1.2
+I2C_TOOLS_VERSION = 4.0
 I2C_TOOLS_SOURCE = i2c-tools-$(I2C_TOOLS_VERSION).tar.xz
 I2C_TOOLS_SITE = https://www.kernel.org/pub/software/utils/i2c-tools
 I2C_TOOLS_LICENSE = GPL-2.0+, GPL-2.0 (py-smbus)
 I2C_TOOLS_LICENSE_FILES = COPYING
+I2C_TOOLS_MAKE_OPTS = EXTRA="eeprog"
 
 ifeq ($(BR2_PACKAGE_PYTHON),y)
 I2C_TOOLS_DEPENDENCIES += python
@@ -22,6 +23,14 @@  ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 I2C_TOOLS_DEPENDENCIES += busybox
 endif
 
+ifeq ($(BR2_STATIC_LIBS),y)
+I2C_TOOLS_MAKE_OPTS += BUILD_DYNAMIC_LIB=0 USE_STATIC_LIB=1
+endif
+
+ifeq ($(BR2_SHARED_LIBS),y)
+I2C_TOOLS_MAKE_OPTS += BUILD_STATIC_LIB=0
+endif
+
 # Build/install steps mirror the distutil python package type in the python package
 # infrastructure
 ifeq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),y)
@@ -47,15 +56,16 @@  endef
 endif # BR2_PACKAGE_PYTHON
 
 define I2C_TOOLS_BUILD_CMDS
-	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) $(I2C_TOOLS_MAKE_OPTS) -C $(@D)
 	$(I2C_TOOLS_BUILD_PYSMBUS)
 endef
 
 define I2C_TOOLS_INSTALL_TARGET_CMDS
-	for i in i2cdump i2cget i2cset i2cdetect; \
+	for i in i2cdump i2cget i2cset i2cdetect i2ctransfer; \
 	do \
 		$(INSTALL) -m 755 -D $(@D)/tools/$$i $(TARGET_DIR)/usr/sbin/$$i; \
 	done
+	$(INSTALL) -m 755 -D $(@D)/eeprog/eeprog $(TARGET_DIR)/usr/bin/eeprog;
 	$(I2C_TOOLS_INSTALL_PYSMBUS)
 endef