[VDPAU] [PATCH 1/4] trace: use intermediate static library in the build

Rémi Denis-Courmont remi at remlab.net
Thu Mar 19 00:45:55 PDT 2015


Le 2015-03-19 02:50, Emil Velikov a écrit :
> Compile the source into a static library, to prevent C++ linkage. The
> latter of which unnesseserally pulls libm, libgcc_s and libstdc++ as
> dependencies.

I think that's wrong. If a library has C++ code, it depends on 
libsdtc++ and that's the end of the story. The rest is an implementation 
detail of the compiler.

I hate it when some library depends on stdc++ but fails to pull it, 
leaving it up to the application. Well nNot that my personal taste 
matters, but doing that also breaks packaging policies in distros.

If you really want to avoid C++ linkage, I think you should convert the 
code to C.

> This also reduces the size of the stripped library by ~8% (51 > 
> 47KiB).
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  trace/Makefile.am | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/trace/Makefile.am b/trace/Makefile.am
> index d134446..b4d34c1 100644
> --- a/trace/Makefile.am
> +++ b/trace/Makefile.am
> @@ -2,12 +2,19 @@ AM_CXXFLAGS = \
>      -I$(top_srcdir)/include \
>      $(X11_CFLAGS)
>
> +# Compile the source into a static library, to prevent C++ linkage. 
> The
> +# latter of which unnesseserally pulls libm, libgcc_s and libstdc++ 
> as
> +# dependencies.
> +
> +noinst_LTLIBRARIES = libfoo.la
>  module_LTLIBRARIES = libvdpau_trace.la
>
> -libvdpau_trace_la_SOURCES = \
> +libfoo_la_SOURCES = \
>      vdpau_trace.cpp
>
> +libvdpau_trace_la_SOURCES =
>  libvdpau_trace_la_LIBADD = \
> +    libfoo.la \
>      $(DLOPEN_LIBS)
>
>  libvdpau_trace_la_LDFLAGS = -version-info 1:0:0 -module 
> -no-undefined

-- 
Rémi Denis-Courmont


More information about the VDPAU mailing list