Skip to contentSkip to conversation

i2c-tools: lib/Module.mk: fixing LIB_LINKS dependency

PATCH In review Angelo Compagnucci 2 participants 4 messages Dec 11, 2017 – Dec 14, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-tools: lib/Module.mk: fixing LIB_LINKS dependency

LIB_LINKS should be added as a dependency only when BUILD_DYNAMIC_LIB is enabled

---
 lib/Module.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/Module.mk +1 -2
index 8a58f5b..de189a2 100644
@@ -27,10 +27,9 @@ LIB_SHSONAME	:= $(LIB_SHBASENAME).$(LIB_MAINVER)
 LIB_SHLIBNAME	:= $(LIB_SHBASENAME).$(LIB_VER)
 LIB_STLIBNAME	:= libi2c.a
 
-LIB_LINKS	:= $(LIB_SHSONAME) $(LIB_SHBASENAME)
-
 LIB_TARGETS	:=
 ifeq ($(BUILD_DYNAMIC_LIB),1)
+LIB_LINKS	:= $(LIB_SHSONAME) $(LIB_SHBASENAME)
 LIB_TARGETS	+= $(LIB_SHLIBNAME)
 endif
 ifeq ($(BUILD_STATIC_LIB),1)
Signature · 1 line
2.7.4
#1 lore raw

Hi Angelo,

Quoted 14 lines · Angelo Compagnucci

LIB_LINKS should be added as a dependency only when BUILD_DYNAMIC_LIB is enabled

---
 lib/Module.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/Module.mk +0 -0
index 8a58f5b..de189a2 100644
@@ -27,10 +27,9 @@ LIB_SHSONAME	:= $(LIB_SHBASENAME).$(LIB_MAINVER)
 LIB_SHLIBNAME	:= $(LIB_SHBASENAME).$(LIB_VER)

lib/Module.mk LIB_SHSONAME := $(LIB_SHBASENAME).$(LIB_MAINVER) · line 35

Quoted 10 lines
lib/Module.mk +1 -2
 LIB_STLIBNAME	:= libi2c.a
 
-LIB_LINKS	:= $(LIB_SHSONAME) $(LIB_SHBASENAME)
-
 LIB_TARGETS	:=
 ifeq ($(BUILD_DYNAMIC_LIB),1)
+LIB_LINKS	:= $(LIB_SHSONAME) $(LIB_SHBASENAME)
 LIB_TARGETS	+= $(LIB_SHLIBNAME)
 endif
 ifeq ($(BUILD_STATIC_LIB),1)

This is correct, good catch. I'll commit it. In fact I thought about it when reviewing your previous patch, but (wrongly) assumed it did not matter. After adding all the missing dependencies, it clearly does.

I have noticed another problem. While "make BUILD_STATIC_LIB=0" actually prevents the static flavor of the library from being built, "make BUILD_DYNAMIC_LIB=0" does not prevent the dynamic flavor of the library from being built. The reason is that USE_STATIC_LIB is not set, so tools depend on the dynamic library, which in turn gets built as a dependency.

I suppose that BUILD_DYNAMIC_LIB=0 should imply USE_STATIC_LIB=1. Something like:

Makefile +2 -0
@@ -43,6 +43,8 @@ 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)
+else
+USE_STATIC_LIB := 1
 endif
 endif
 

What do you think?

Thanks,

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#2 lore raw

DEar Jean,

Quoted 53 lines · Jean Delvare

Hi Angelo,

Quoted 14 lines · Angelo Compagnucci

LIB_LINKS should be added as a dependency only when BUILD_DYNAMIC_LIB is enabled

---
 lib/Module.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/Module.mk +0 -0
index 8a58f5b..de189a2 100644
@@ -27,10 +27,9 @@ LIB_SHSONAME       := $(LIB_SHBASENAME).$(LIB_MAINVER)
 LIB_SHLIBNAME        := $(LIB_SHBASENAME).$(LIB_VER)

lib/Module.mk LIB_SHSONAME := $(LIB_SHBASENAME).$(LIB_MAINVER) · line 35

Quoted 10 lines
lib/Module.mk +1 -2
 LIB_STLIBNAME        := libi2c.a
 
-LIB_LINKS    := $(LIB_SHSONAME) $(LIB_SHBASENAME)
-
 LIB_TARGETS  :=
 ifeq ($(BUILD_DYNAMIC_LIB),1)
+LIB_LINKS    := $(LIB_SHSONAME) $(LIB_SHBASENAME)
 LIB_TARGETS  += $(LIB_SHLIBNAME)
 endif
 ifeq ($(BUILD_STATIC_LIB),1)

This is correct, good catch. I'll commit it. In fact I thought about it when reviewing your previous patch, but (wrongly) assumed it did not matter. After adding all the missing dependencies, it clearly does.

I have noticed another problem. While "make BUILD_STATIC_LIB=0" actually prevents the static flavor of the library from being built, "make BUILD_DYNAMIC_LIB=0" does not prevent the dynamic flavor of the library from being built. The reason is that USE_STATIC_LIB is not set, so tools depend on the dynamic library, which in turn gets built as a dependency.

I suppose that BUILD_DYNAMIC_LIB=0 should imply USE_STATIC_LIB=1. Something like:

Makefile +2 -0
@@ -43,6 +43,8 @@ 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)
+else
+USE_STATIC_LIB := 1
 endif
 endif
 
Quoted 1 line

What do you think?

I think you are totally right. If BUILD_DYNAMIC_LIB is 0 the static variant should be built and used too.

Could you realease a new version of i2c-tools with these patches? I'm in the phase of updating the package in buildroot and I do really prefer to have a new stable release than an old release with a bunch of patches on top.

Thanks!

Quoted 5 lines

Thanks,
--
Jean Delvare
SUSE L3 Support

#3 lore raw
Quoted 15 lines · Angelo Compagnucci
Quoted 14 lines · Jean Delvare

I suppose that BUILD_DYNAMIC_LIB=0 should imply USE_STATIC_LIB=1. Something like:

Makefile +2 -0
@@ -43,6 +43,8 @@ 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)
+else
+USE_STATIC_LIB := 1
 endif
 endif
 
Quoted 4 lines
Quoted 1 line

What do you think?

I think you are totally right. If BUILD_DYNAMIC_LIB is 0 the static variant should be built and used too.

Thanks. Both fixes committed.

Quoted 4 lines

Could you realease a new version of i2c-tools with these patches? I'm in the phase of updating the package in buildroot and I do really prefer to have a new stable release than an old release with a bunch of patches on top.

I don't have such a plan, sorry. Version 4.0 is still relatively new, I expect more problems to be found and fixed in the next weeks, I don't think it makes sense to rush a new release. There are only 13 commits since 4.0, it's not that many.

Backporting patches for distribution packages is the usual process, and 6 patches is not a bunch. If the patch count really bothers you, you can always consolidate the fix-ups into the original patch and you'll be down to 4, that seems easily manageable. Quilt is your friend ;-)

Signature · 2 lines
Jean Delvare
SUSE L3 Support