[vlc-devel] [PATCH 1/2] modules: rename internal static libs to libsomething and force static linking

Steve Lhomme robux4 at videolabs.io
Wed Nov 15 10:37:10 CET 2017


Otherwise we use the global LDFLAGS that's set for modules and export the
module resources many times.
---
 modules/codec/Makefile.am        | 17 +++++++++--------
 modules/demux/Makefile.am        | 13 +++++++------
 modules/hw/vaapi/Makefile.am     |  2 +-
 modules/packetizer/Makefile.am   |  2 +-
 modules/video_chroma/Makefile.am | 13 +++++++------
 modules/video_filter/Makefile.am |  7 ++++---
 modules/video_output/Makefile.am | 15 ++++++++-------
 7 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 42b819b781..5f4f477bbf 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -355,16 +355,17 @@ endif
 if HAVE_TVOS
 libvideotoolbox_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -mtvos-version-min=10.2
 endif
-libvideotoolbox_plugin_la_LIBADD = video_chroma_copy.la
+libvideotoolbox_plugin_la_LIBADD = libchroma_copy.la
 libvideotoolbox_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)' -Wl,-framework,Foundation -Wl,-framework,VideoToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo
 EXTRA_LTLIBRARIES += libvideotoolbox_plugin.la
 codec_LTLIBRARIES += $(LTLIBvideotoolbox)
 
 ### FFmpeg/libav ###
-vlc_avcodec_common_la_SOURCES = codec/avcodec/fourcc.c codec/avcodec/avcommon.h \
+libavcodec_common_la_SOURCES = codec/avcodec/fourcc.c codec/avcodec/avcommon.h \
 	codec/avcodec/chroma.c codec/avcodec/chroma.h \
 	codec/avcodec/avcommon_compat.h
-vlc_avcodec_common_la_CFLAGS = $(AVCODEC_CFLAGS) $(AM_CFLAGS)
+libavcodec_common_la_CFLAGS = $(AVCODEC_CFLAGS) $(AM_CFLAGS)
+libavcodec_common_la_LDFLAGS = -static
 
 libavcodec_plugin_la_SOURCES = \
 	codec/avcodec/video.c \
@@ -376,7 +377,7 @@ if ENABLE_SOUT
 libavcodec_plugin_la_SOURCES += codec/avcodec/encoder.c
 endif
 libavcodec_plugin_la_CFLAGS = $(AVCODEC_CFLAGS) $(AM_CFLAGS)
-libavcodec_plugin_la_LIBADD = $(AVCODEC_LIBS) $(LIBM) vlc_avcodec_common.la
+libavcodec_plugin_la_LIBADD = $(AVCODEC_LIBS) $(LIBM) libavcodec_common.la
 libavcodec_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(SYMBOLIC_LDFLAGS)
 
 if MERGE_FFMPEG
@@ -392,7 +393,7 @@ if HAVE_DARWIN
 libavcodec_plugin_la_LDFLAGS += -Wl,-framework,Foundation -Wl,-framework,Security,-framework,CoreFoundation
 endif
 if HAVE_AVCODEC
-noinst_LTLIBRARIES += vlc_avcodec_common.la
+noinst_LTLIBRARIES += libavcodec_common.la
 codec_LTLIBRARIES += libavcodec_plugin.la
 endif
 
@@ -466,12 +467,12 @@ libomxil_plugin_la_SOURCES += video_output/android/utils.c video_output/android/
 	video_output/android/display.h
 endif
 libomxil_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/codec/omxil $(CFLAGS_omxil)
-libomxil_plugin_la_LIBADD = video_chroma_copy.la $(LIBDL)
+libomxil_plugin_la_LIBADD = libchroma_copy.la $(LIBDL)
 libomxil_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
 
 libomxil_vout_plugin_la_SOURCES = codec/omxil/vout.c codec/omxil/omxil_core.c codec/omxil/utils.c codec/omxil/qcom.c
 libomxil_vout_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/codec/omxil $(CFLAGS_omxil_vout)
-libomxil_vout_plugin_la_LIBADD = video_chroma_copy.la $(LIBDL)
+libomxil_vout_plugin_la_LIBADD = libchroma_copy.la $(LIBDL)
 libomxil_vout_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
 
 libiomx_plugin_la_SOURCES = $(libomxil_plugin_la_SOURCES)
@@ -487,7 +488,7 @@ libmediacodec_plugin_la_SOURCES = codec/omxil/mediacodec.c codec/omxil/mediacode
 	packetizer/hxxx_nal.h packetizer/hxxx_nal.c \
 	packetizer/h264_nal.c packetizer/h264_nal.h \
 	packetizer/hevc_nal.c packetizer/hevc_nal.h
-libmediacodec_plugin_la_LIBADD = video_chroma_copy.la 
+libmediacodec_plugin_la_LIBADD = libchroma_copy.la 
 codec_LTLIBRARIES += $(LTLIBomxil) $(LTLIBomxil_vout)
 EXTRA_LTLIBRARIES += libomxil_plugin.la libomxil_vout_plugin.la
 if HAVE_ANDROID
diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index 020ccb5659..1151a14c26 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -1,19 +1,20 @@
 demuxdir = $(pluginsdir)/demux
 demux_LTLIBRARIES =
 
-vlc_xiph_metadata_la_SOURCES = demux/xiph_metadata.h demux/xiph_metadata.c
-noinst_LTLIBRARIES += vlc_xiph_metadata.la
+libxiph_metadata_la_SOURCES = demux/xiph_metadata.h demux/xiph_metadata.c
+libxiph_metadata_la_LDFLAGS = -static
+noinst_LTLIBRARIES += libxiph_metadata.la
 
 libflacsys_plugin_la_SOURCES = demux/flac.c
 libflacsys_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
-libflacsys_plugin_la_LIBADD = vlc_xiph_metadata.la
+libflacsys_plugin_la_LIBADD = libxiph_metadata.la
 demux_LTLIBRARIES += libflacsys_plugin.la
 
 libogg_plugin_la_SOURCES = demux/ogg.c demux/ogg.h demux/oggseek.c demux/oggseek.h \
 	demux/xiph.h demux/opus.h
 libogg_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBVORBIS_CFLAGS) $(OGG_CFLAGS)
 libogg_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(demuxdir)'
-libogg_plugin_la_LIBADD = $(LIBVORBIS_LIBS) $(OGG_LIBS) vlc_xiph_metadata.la
+libogg_plugin_la_LIBADD = $(LIBVORBIS_LIBS) $(OGG_LIBS) libxiph_metadata.la
 EXTRA_LTLIBRARIES += libogg_plugin.la
 demux_LTLIBRARIES += $(LTLIBogg)
 
@@ -146,7 +147,7 @@ if ENABLE_SOUT
 libavformat_plugin_la_SOURCES += demux/avformat/mux.c
 endif
 libavformat_plugin_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS)
-libavformat_plugin_la_LIBADD = $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(LIBM) vlc_avcodec_common.la
+libavformat_plugin_la_LIBADD = $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(LIBM) libavcodec_common.la
 libavformat_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(SYMBOLIC_LDFLAGS)
 if HAVE_ZLIB
 libavformat_plugin_la_LIBADD += -lz
@@ -157,7 +158,7 @@ endif
 if HAVE_AVFORMAT
 if !MERGE_FFMPEG
 demux_LTLIBRARIES += libavformat_plugin.la
-noinst_LTLIBRARIES += vlc_avcodec_common.la
+noinst_LTLIBRARIES += libavcodec_common.la
 endif
 endif
 
diff --git a/modules/hw/vaapi/Makefile.am b/modules/hw/vaapi/Makefile.am
index 7ec66a224d..194bff14f8 100644
--- a/modules/hw/vaapi/Makefile.am
+++ b/modules/hw/vaapi/Makefile.am
@@ -6,7 +6,7 @@ libvaapi_filters_plugin_la_SOURCES = hw/vaapi/filters.c hw/vaapi/filters.h \
 
 libvaapi_filters_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
 libvaapi_filters_plugin_la_CFLAGS = $(AM_CFLAGS) $(LIBVA_CFLAGS)
-libvaapi_filters_plugin_la_LIBADD = video_chroma_copy.la $(AM_LIBADD) $(LIBVA_LIBS)
+libvaapi_filters_plugin_la_LIBADD = libchroma_copy.la $(AM_LIBADD) $(LIBVA_LIBS)
 
 if HAVE_VAAPI
 vaapi_LTLIBRARIES = libvaapi_filters_plugin.la
diff --git a/modules/packetizer/Makefile.am b/modules/packetizer/Makefile.am
index 80ed2018e1..102ae38148 100644
--- a/modules/packetizer/Makefile.am
+++ b/modules/packetizer/Makefile.am
@@ -29,7 +29,7 @@ libpacketizer_avparser_plugin_la_SOURCES = packetizer/avparser.c \
 	packetizer/avparser.h \
 	codec/avcodec/avcodec.h
 libpacketizer_avparser_plugin_la_CFLAGS = $(AVCODEC_CFLAGS) $(AVUTIL_CFLAGS) $(AM_CFLAGS)
-libpacketizer_avparser_plugin_la_LIBADD = $(AVCODEC_LIBS) $(AVUTIL_LIBS) $(LIBM) vlc_avcodec_common.la
+libpacketizer_avparser_plugin_la_LIBADD = $(AVCODEC_LIBS) $(AVUTIL_LIBS) $(LIBM) libavcodec_common.la
 
 noinst_HEADERS += packetizer/packetizer_helper.h packetizer/startcode_helper.h
 
diff --git a/modules/video_chroma/Makefile.am b/modules/video_chroma/Makefile.am
index 4d8756fcf5..500ca6c497 100644
--- a/modules/video_chroma/Makefile.am
+++ b/modules/video_chroma/Makefile.am
@@ -2,8 +2,9 @@ chromadir = $(pluginsdir)/video_chroma
 
 libchain_plugin_la_SOURCES = video_chroma/chain.c
 
-video_chroma_copy_la_SOURCES = video_chroma/copy.c video_chroma/copy.h
-noinst_LTLIBRARIES += video_chroma_copy.la
+libchroma_copy_la_SOURCES = video_chroma/copy.c video_chroma/copy.h
+libchroma_copy_la_LDFLAGS = -static
+noinst_LTLIBRARIES += libchroma_copy.la
 
 libchroma_omx_plugin_la_SOURCES = video_chroma/omxdl.c
 libchroma_omx_plugin_la_CFLAGS = $(AM_CFLAGS) $(OMXIP_CFLAGS)
@@ -27,12 +28,12 @@ libi420_yuy2_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
 libi420_nv12_plugin_la_SOURCES = video_chroma/i420_nv12.c
 libi420_nv12_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
 	-DMODULE_NAME_IS_i420_nv12
-libi420_nv12_plugin_la_LIBADD = video_chroma_copy.la
+libi420_nv12_plugin_la_LIBADD = libchroma_copy.la
 
 libi420_10_p010_plugin_la_SOURCES = video_chroma/i420_10_p010.c
 libi420_10_p010_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
 	-DMODULE_NAME_IS_i420_10_p010
-libi420_10_p010_plugin_la_LIBADD = video_chroma_copy.la
+libi420_10_p010_plugin_la_LIBADD = libchroma_copy.la
 
 libi422_i420_plugin_la_SOURCES = video_chroma/i422_i420.c
 
@@ -119,7 +120,7 @@ endif
 # DXVA2
 libdxa9_plugin_la_SOURCES = video_chroma/dxa9.c \
         video_chroma/d3d9_fmt.h
-libdxa9_plugin_la_LIBADD = video_chroma_copy.la
+libdxa9_plugin_la_LIBADD = libchroma_copy.la
 
 if HAVE_AVCODEC_DXVA2
 chroma_LTLIBRARIES += \
@@ -129,7 +130,7 @@ endif
 # D3D11VA
 libd3d11_surface_plugin_la_SOURCES = video_chroma/d3d11_surface.c \
 	video_chroma/d3d11_fmt.h video_chroma/dxgi_fmt.c video_chroma/dxgi_fmt.h
-libd3d11_surface_plugin_la_LIBADD = video_chroma_copy.la
+libd3d11_surface_plugin_la_LIBADD = libchroma_copy.la
 
 if HAVE_AVCODEC_D3D11VA
 chroma_LTLIBRARIES += \
diff --git a/modules/video_filter/Makefile.am b/modules/video_filter/Makefile.am
index e0007017b5..b73ae46119 100644
--- a/modules/video_filter/Makefile.am
+++ b/modules/video_filter/Makefile.am
@@ -120,8 +120,9 @@ libci_filters_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -miphoneos-version-min=9.0
 video_filter_LTLIBRARIES += libci_filters_plugin.la
 endif
 
-vlc_deinterlace_common_la_SOURCES = video_filter/deinterlace/common.c video_filter/deinterlace/common.h
-noinst_LTLIBRARIES += vlc_deinterlace_common.la
+libdeinterlace_common_la_SOURCES = video_filter/deinterlace/common.c video_filter/deinterlace/common.h
+libdeinterlace_common_la_LDFLAGS = -static
+noinst_LTLIBRARIES += libdeinterlace_common.la
 
 libdeinterlace_plugin_la_SOURCES = \
 	video_filter/deinterlace/deinterlace.c video_filter/deinterlace/deinterlace.h \
@@ -144,7 +145,7 @@ if HAVE_ARM64
 libdeinterlace_plugin_la_SOURCES += video_filter/deinterlace/merge_arm64.S
 libdeinterlace_plugin_la_CFLAGS += -DCAN_COMPILE_ARM64
 endif
-libdeinterlace_plugin_la_LIBADD = vlc_deinterlace_common.la
+libdeinterlace_plugin_la_LIBADD = libdeinterlace_common.la
 video_filter_LTLIBRARIES += libdeinterlace_plugin.la
 
 libopencv_wrapper_plugin_la_SOURCES = video_filter/opencv_wrapper.c
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 610b0f920c..786d6e3261 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -257,11 +257,11 @@ libdirect3d9_plugin_la_SOURCES = video_output/win32/direct3d9.c \
 	video_chroma/d3d9_fmt.h
 libdirect3d9_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
 	-DMODULE_NAME_IS_direct3d9
-libdirect3d9_plugin_la_LIBADD = video_chroma_copy.la -lgdi32 $(LIBCOM) -luuid
+libdirect3d9_plugin_la_LIBADD = libchroma_copy.la -lgdi32 $(LIBCOM) -luuid
 libdirect3d9_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
 libdirect3d9_deinterlace_plugin_la_SOURCES = video_output/win32/dxva2_deinterlace.c \
         video_chroma/d3d9_fmt.h
-libdirect3d9_deinterlace_plugin_la_LIBADD = $(LIBCOM) vlc_deinterlace_common.la
+libdirect3d9_deinterlace_plugin_la_LIBADD = $(LIBCOM) libdeinterlace_common.la
 libdirect3d9_deinterlace_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
 libdirect3d9_adjust_plugin_la_SOURCES = video_output/win32/d3d9_adjust.c \
   video_chroma/dxgi_fmt.c video_chroma/dxgi_fmt.h
@@ -278,7 +278,7 @@ libdirect3d11_plugin_la_SOURCES = video_output/win32/direct3d11.c \
  video_output/win32/common.c video_output/win32/common.h
 libdirect3d11_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
  -DMODULE_NAME_IS_direct3d11
-libdirect3d11_plugin_la_LIBADD = video_chroma_copy.la $(LIBCOM) -luuid
+libdirect3d11_plugin_la_LIBADD = libchroma_copy.la $(LIBCOM) -luuid
 if !HAVE_WINSTORE
 libdirect3d11_plugin_la_SOURCES += video_output/win32/events.c \
  video_output/win32/events.h \
@@ -295,7 +295,7 @@ EXTRA_LTLIBRARIES += libdirect3d11_plugin.la
 libdirect3d11_deinterlace_plugin_la_SOURCES = video_output/win32/d3d11_deinterlace.c \
   video_chroma/dxgi_fmt.c video_chroma/dxgi_fmt.h
 libdirect3d11_deinterlace_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
-libdirect3d11_deinterlace_plugin_la_LIBADD = vlc_deinterlace_common.la
+libdirect3d11_deinterlace_plugin_la_LIBADD = libdeinterlace_common.la
 libdirect3d11_adjust_plugin_la_SOURCES = video_output/win32/d3d11_adjust.c \
   video_chroma/dxgi_fmt.c video_chroma/dxgi_fmt.h
 libdirect3d11_adjust_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
@@ -309,7 +309,7 @@ libdirectdraw_plugin_la_SOURCES = video_output/win32/directdraw.c \
 	video_output/win32/win32touch.c video_output/win32/win32touch.h
 libdirectdraw_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
 	-DMODULE_NAME_IS_directdraw
-libdirectdraw_plugin_la_LIBADD = video_chroma_copy.la -luser32 -lgdi32 $(LIBCOM) -luuid
+libdirectdraw_plugin_la_LIBADD = libchroma_copy.la -luser32 -lgdi32 $(LIBCOM) -luuid
 libdirectdraw_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
 if HAVE_WIN32_DESKTOP
 vout_LTLIBRARIES += $(LTLIBdirectdraw)
@@ -327,7 +327,7 @@ libwgl_plugin_la_SOURCES = video_output/win32/wgl.c $(OPENGL_COMMONSOURCES)
 libglwin32_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
 	-DMODULE_NAME_IS_glwin32
 
-libglwin32_plugin_la_LIBADD = video_chroma_copy.la -lopengl32 -lgdi32 $(LIBCOM) -luuid $(OPENGL_COMMONLIBS)
+libglwin32_plugin_la_LIBADD = libchroma_copy.la -lopengl32 -lgdi32 $(LIBCOM) -luuid $(OPENGL_COMMONLIBS)
 libwgl_plugin_la_LIBADD = -lopengl32 -lgdi32 $(OPENGL_COMMONLIBS)
 
 libglwin32_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCLFAGS)
@@ -346,7 +346,7 @@ libwingdi_plugin_la_SOURCES = video_output/win32/wingdi.c \
 	video_output/win32/events.c video_output/win32/events.h \
 	video_output/win32/sensors.cpp \
 	video_output/win32/win32touch.c video_output/win32/win32touch.h
-libwingdi_plugin_la_LIBADD = video_chroma_copy.la -lgdi32 $(LIBCOM) -luuid
+libwingdi_plugin_la_LIBADD = libchroma_copy.la -lgdi32 $(LIBCOM) -luuid
 if HAVE_WIN32_DESKTOP
 vout_LTLIBRARIES += libwingdi_plugin.la
 endif
@@ -467,4 +467,5 @@ vout_LTLIBRARIES += \
 
 libevent_thread_la_SOURCES = \
 	video_output/event_thread.c video_output/event_thread.h
+libevent_thread_la_LDFLAGS = -static
 noinst_LTLIBRARIES += libevent_thread.la
-- 
2.14.2



More information about the vlc-devel mailing list