linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib: Fix compilation when USE_STATIC_LIB
@ 2017-11-28 22:58 Angelo Compagnucci
  2017-11-29 10:08 ` Jean Delvare
  0 siblings, 1 reply; 4+ messages in thread
From: Angelo Compagnucci @ 2017-11-28 22:58 UTC (permalink / raw)
  To: linux-i2c; +Cc: jdelvare, Angelo Compagnucci

This patch removes the mandatory compiling of the shared library
when USE_STATIC_LIB is used.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 lib/Module.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/Module.mk b/lib/Module.mk
index 432a051..bdcb19d 100644
--- a/lib/Module.mk
+++ b/lib/Module.mk
@@ -27,12 +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
 ifeq ($(BUILD_STATIC_LIB),1)
-LIB_TARGETS	+= $(LIB_STLIBNAME)
+LIB_TARGETS	:= $(LIB_STLIBNAME)
 LIB_OBJECTS	+= smbus.ao
+else
+LIB_TARGETS	:= $(LIB_SHLIBNAME)
 endif
 
 #
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib: Fix compilation when USE_STATIC_LIB
  2017-11-28 22:58 [PATCH] lib: Fix compilation when USE_STATIC_LIB Angelo Compagnucci
@ 2017-11-29 10:08 ` Jean Delvare
  2017-11-29 11:04   ` Angelo Compagnucci
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2017-11-29 10:08 UTC (permalink / raw)
  To: Angelo Compagnucci; +Cc: linux-i2c

Hi Angelo,

On Tue, 28 Nov 2017 23:58:17 +0100, Angelo Compagnucci wrote:
> This patch removes the mandatory compiling of the shared library
> when USE_STATIC_LIB is used.

No, thanks. The current behavior is as desired: always build the
dynamic library, and optionally build the static library. It was never
the intent to allow only building the static library. Static libraries
are evil.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib: Fix compilation when USE_STATIC_LIB
  2017-11-29 10:08 ` Jean Delvare
@ 2017-11-29 11:04   ` Angelo Compagnucci
  2017-11-29 12:05     ` Jean Delvare
  0 siblings, 1 reply; 4+ messages in thread
From: Angelo Compagnucci @ 2017-11-29 11:04 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-i2c

Hi Jean,

On Wed, Nov 29, 2017 at 11:08 AM, Jean Delvare <jdelvare@suse.de> wrote:
>
> Hi Angelo,
>
> On Tue, 28 Nov 2017 23:58:17 +0100, Angelo Compagnucci wrote:
> > This patch removes the mandatory compiling of the shared library
> > when USE_STATIC_LIB is used.
>
> No, thanks. The current behavior is as desired: always build the
> dynamic library, and optionally build the static library. It was never
> the intent to allow only building the static library. Static libraries
> are evil.


In Buildroot we have the need to support also static only libraries
cause we have targets that doesn't support dynamic libraries (like
cortex M4 for which I'm fixing this bug).
The option for static only is also present for various other
architectures as a build option.

So, if this cannot be fixed upstream, I'll push a patch only on the
Buildroot side.

Sincerely, Angelo.


>
>
> --
> Jean Delvare
> SUSE L3 Support

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib: Fix compilation when USE_STATIC_LIB
  2017-11-29 11:04   ` Angelo Compagnucci
@ 2017-11-29 12:05     ` Jean Delvare
  0 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2017-11-29 12:05 UTC (permalink / raw)
  To: Angelo Compagnucci; +Cc: linux-i2c

On Wed, 29 Nov 2017 12:04:06 +0100, Angelo Compagnucci wrote:
> On Wed, Nov 29, 2017 at 11:08 AM, Jean Delvare <jdelvare@suse.de> wrote:
> > On Tue, 28 Nov 2017 23:58:17 +0100, Angelo Compagnucci wrote:  
> > > This patch removes the mandatory compiling of the shared library
> > > when USE_STATIC_LIB is used.  
> >
> > No, thanks. The current behavior is as desired: always build the
> > dynamic library, and optionally build the static library. It was never
> > the intent to allow only building the static library. Static libraries
> > are evil.  
> 
> In Buildroot we have the need to support also static only libraries
> cause we have targets that doesn't support dynamic libraries (like
> cortex M4 for which I'm fixing this bug).

That's a frightening platform :(

> The option for static only is also present for various other
> architectures as a build option.
> 
> So, if this cannot be fixed upstream, I'll push a patch only on the
> Buildroot side.

Maybe it can be fixed upstream, but not the way you proposed because it
causes a regression (by default the dynamic lib would no longer be
built.)

I suppose that introducing BUILD_DYNAMIC_LIB, which would default to 1
and would only control whether the dynamic library is built or not,
would be acceptable. But you'll have to make sure that at least one
flavor of the library is being built, and that the tools themselves are
linked to the right library (dynamic if available, else fallback to
static, see USE_STATIC_LIB.)

By default we want all library flavors built, and the tools linked
dynamically.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-29 12:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 22:58 [PATCH] lib: Fix compilation when USE_STATIC_LIB Angelo Compagnucci
2017-11-29 10:08 ` Jean Delvare
2017-11-29 11:04   ` Angelo Compagnucci
2017-11-29 12:05     ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).