[FFmpeg-devel] Merge all libraries (was: all: avoid data imports across DLL) boundaries

Submitted by Nicolas George on Aug. 24, 2017, 2:49 p.m.

Details

Message ID 20170824144935.GA327208@phare.normalesup.org
State New
Headers show

Commit Message

Nicolas George Aug. 24, 2017, 2:49 p.m.
Le sextidi 6 fructidor, an CCXXV, James Almer a écrit :
> Speaking of which, do you or anyone else want to help with applying the
> bump right now instead of waiting until the merges are resumed?

If we are requesting help for a bump, I would like to propose seriously
and request help for the attached patch.

With this change, it builds a single libffmpeg.so.* instead of separate
libav*.so.*.

At this point, the library builds, and the command-line tools can be
built against it and work, but I did not manage to get the build system
to add -lffmpeg at the proper time. And all the extra stuff (make clean,
make install, pkg-config file) is still completely unchanged.

There are many benefits to merging the libraries:

- Easier to share code between components without compatibility issues
  (exactly what James complains about here).

- Less clueless users not managing to link their applications because
  they do not know that the linking order matters.

- Opens the road to getting rid of the global state.

I did not manage to find a real drawback. If somebody finds it a bad
idea, then please explain to me what benefit we get from having several
separate libraries. This is not a rhetorical question, I really would
like an explanation. But I do not agree with the obvious argument of
file size, because almost nobody would use lavu without the rest,
because lavc dwarves all other libraries, and because people who care
about file size do not use pre-built binaries and can disable components
with much more control than library per library.

Regards,

Comments

Kieran Kunhya Aug. 24, 2017, 3:01 p.m.
>
> I did not manage to find a real drawback. If somebody finds it a bad
> idea, then please explain to me what benefit we get from having several
> separate libraries. This is not a rhetorical question, I really would
> like an explanation. But I do not agree with the obvious argument of
> file size, because almost nobody would use lavu without the rest,
> because lavc dwarves all other libraries, and because people who care
> about file size do not use pre-built binaries and can disable components
> with much more control than library per library.


You clearly are not aware how much random junk in all libs is still enabled
with --disable-everything.
I don't use avformat, why should it be linked into my code.

Kieran
Nicolas George Aug. 24, 2017, 3:07 p.m.
Le septidi 7 fructidor, an CCXXV, Kieran Kunhya a écrit :
> You clearly are not aware how much random junk in all libs is still enabled
> with --disable-everything.
> I don't use avformat, why should it be linked into my code.

Why should it not, if it makes things simpler for everybody? That is
exactly what a library is: a collection of code, grouped for
convenience; no application ever uses all of a non-trivial library.

If you oppose to this, please explain an actual scenario where it makes
things actually worse based on objective criteria.

Regards,

Patch hide | download patch | download mbox

From fcf7b622135a845e66bfa164447adb5fecacb1f6 Mon Sep 17 00:00:00 2001
From: Nicolas George <george@nsup.org>
Date: Mon, 31 Jul 2017 16:41:08 +0200
Subject: [PATCH] all: merge all libraries.

Signed-off-by: Nicolas George <george@nsup.org>
---
 Makefile                 |  6 +++-
 configure                |  2 +-
 ffbuild/common.mak       | 13 ++++---
 ffbuild/library.mak      | 63 +---------------------------------
 libavcodec/Makefile      |  1 -
 libavcodec/log2_tab.c    |  1 -
 libavcodec/reverse.c     |  1 -
 libavdevice/Makefile     |  1 -
 libavdevice/reverse.c    |  1 -
 libavfilter/Makefile     |  2 --
 libavfilter/log2_tab.c   |  1 -
 libavformat/Makefile     |  1 -
 libavformat/golomb_tab.c |  1 -
 libavformat/log2_tab.c   |  1 -
 libffmpeg/Makefile       | 88 ++++++++++++++++++++++++++++++++++++++++++++++++
 libffmpeg/libffmpeg.v    | 23 +++++++++++++
 libswresample/Makefile   |  1 -
 libswresample/log2_tab.c |  1 -
 libswscale/Makefile      |  2 --
 libswscale/log2_tab.c    |  1 -
 20 files changed, 126 insertions(+), 85 deletions(-)
 delete mode 100644 libavcodec/log2_tab.c
 delete mode 100644 libavcodec/reverse.c
 delete mode 100644 libavdevice/reverse.c
 delete mode 100644 libavfilter/log2_tab.c
 delete mode 100644 libavformat/golomb_tab.c
 delete mode 100644 libavformat/log2_tab.c
 create mode 100644 libffmpeg/Makefile
 create mode 100644 libffmpeg/libffmpeg.v
 delete mode 100644 libswresample/log2_tab.c
 delete mode 100644 libswscale/log2_tab.c

diff --git a/Makefile b/Makefile
index 29870d7710..4aaa966f4a 100644
--- a/Makefile
+++ b/Makefile
@@ -118,6 +118,10 @@  endef
 
 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
 
+SUBDIR := libffmpeg/
+include $(SRC_PATH)/$(SUBDIR)Makefile
+SUBDIR := diediedie
+
 include $(SRC_PATH)/doc/Makefile
 
 define DOPROG
@@ -208,7 +212,7 @@  check: all alltools examples testprogs fate
 
 include $(SRC_PATH)/tests/Makefile
 
-$(sort $(OBJDIRS)):
+$(sort $(OBJDIRS)) libffmpeg/:
 	$(Q)mkdir -p $@
 
 # Dummy rule to stop make trying to rebuild removed or renamed headers
diff --git a/configure b/configure
index 66c7b948e4..e3d18ff226 100755
--- a/configure
+++ b/configure
@@ -6226,7 +6226,7 @@  EOF
 
 # add some linker flags
 check_ldflags -Wl,--warn-common
-check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
+check_ldflags -Wl,-rpath-link=libffmpeg
 enabled rpath && add_ldexeflags -Wl,-rpath,$libdir
 enabled rpath && add_ldlibflags -Wl,-rpath,$libdir
 test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index e168fb2cfd..7499db0865 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -41,7 +41,7 @@  X86ASMFLAGS += $(IFLAGS:%=%/) -I$(<D)/ -Pconfig.asm
 NVCCFLAGS  += -ptx
 
 HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
-LDFLAGS    := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
+LDFLAGS    := $(LD_PATH)libffmpeg $(LDFLAGS)
 
 define COMPILE
        $(call $(1)DEP,$(1))
@@ -118,8 +118,8 @@  SLIBOBJS  += $(SLIBOBJS-yes)
 FFLIBS    := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS)
 TESTPROGS += $(TESTPROGS-yes)
 
-LDLIBS       = $(FFLIBS:%=%$(BUILDSUF))
-FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS)
+LDLIBS       = libffmpeg$(BUILDSUF)
+FFEXTRALIBS := $(EXTRALIBS)
 
 OBJS      := $(sort $(OBJS:%=$(SUBDIR)%))
 SLIBOBJS  := $(sort $(SLIBOBJS:%=$(SUBDIR)%))
@@ -132,9 +132,12 @@  TOOLOBJS  := $(TOOLS:%=tools/%.o)
 TOOLS     := $(TOOLS:%=tools/%$(EXESUF))
 HEADERS   += $(HEADERS-yes)
 
+OBJS-$(NAME) := $(OBJS)
+
 PATH_LIBNAME = $(foreach NAME,$(1),lib$(NAME)/$($(2)LIBNAME))
-DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib),$(CONFIG_SHARED:yes=S)))
-STATIC_DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib)))
+# XXX CIG libffmpeg
+#DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib),$(CONFIG_SHARED:yes=S)))
+#STATIC_DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib)))
 
 SRC_DIR    := $(SRC_PATH)/lib$(NAME)
 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
diff --git a/ffbuild/library.mak b/ffbuild/library.mak
index 22f1e4c37f..178731d329 100644
--- a/ffbuild/library.mak
+++ b/ffbuild/library.mak
@@ -1,31 +1,17 @@ 
 include $(SRC_PATH)/ffbuild/common.mak
 
--include $(SUBDIR)lib$(NAME).version
+# -include $(SUBDIR)lib$(NAME).version
 
-LIBVERSION := $(lib$(NAME)_VERSION)
-LIBMAJOR   := $(lib$(NAME)_VERSION_MAJOR)
-LIBMINOR   := $(lib$(NAME)_VERSION_MINOR)
 INCINSTDIR := $(INCDIR)/lib$(NAME)
 
 INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
 
-all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)  $(SUBDIR)lib$(FULLNAME).pc
-all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc
-
 LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
 $(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i):   CPPFLAGS += -DHAVE_AV_CONFIG_H
 $(TESTOBJS) $(TESTOBJS:.o=.i): CFLAGS += -Umain
 
-$(SUBDIR)$(LIBNAME): $(OBJS)
-	$(RM) $@
-	$(AR) $(ARFLAGS) $(AR_O) $^
-	$(RANLIB) $@
-
 install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
 
-install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
-install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
-
 define RULES
 $(TOOLS):     THISLIB = $(FULLNAME:%=$(LD_LIB))
 $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
@@ -33,27 +19,6 @@  $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
 $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
 	$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
 
-$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR)
-	$$(M) $$(SRC_PATH)/ffbuild/libversion.sh $(NAME) $$< > $$@
-
-$(SUBDIR)lib$(FULLNAME).pc: $(SUBDIR)version.h | $(SUBDIR)
-	$$(M) $$(SRC_PATH)/ffbuild/pkgconfig_generate.sh $(NAME) "$(DESC)"
-
-$(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
-	$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
-
-$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
-	$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
-
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
-	$(SLIB_CREATE_DEF_CMD)
-	$$(LD) $(SHFLAGS) $(LDFLAGS) $(LDLIBFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
-	$(SLIB_EXTRA_CMD)
-
-ifdef SUBDIR
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
-endif
-
 clean::
 	$(RM) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
 	    $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(CLEANSUFFIXES:%=$(SUBDIR)tests/%)
@@ -62,36 +27,10 @@  distclean:: clean
 	$(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) \
             $(DISTCLEANSUFFIXES:%=$(SUBDIR)tests/%)
 
-install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
-	$(Q)mkdir -p "$(SHLIBDIR)"
-	$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
-	$$(STRIP) "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
-	$(Q)$(foreach F,$(SLIB_INSTALL_LINKS),(cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F));)
-	$(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
-	$(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
-	$(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
-
-install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
-	$(Q)mkdir -p "$(LIBDIR)"
-	$$(INSTALL) -m 644 $$< "$(LIBDIR)"
-	$(LIB_INSTALL_EXTRA_CMD)
-
 install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
 	$(Q)mkdir -p "$(INCINSTDIR)"
 	$$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
 
-install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(FULLNAME).pc
-	$(Q)mkdir -p "$(PKGCONFIGDIR)"
-	$$(INSTALL) -m 644 $$^ "$(PKGCONFIGDIR)"
-
-uninstall-libs::
-	-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
-	       "$(SHLIBDIR)/$(SLIBNAME)"            \
-	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	-$(RM)  $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)/%")
-	-$(RM)  $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)/%")
-	-$(RM) "$(LIBDIR)/$(LIBNAME)"
-
 uninstall-headers::
 	$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS) $(BUILT_HEADERS))
 	$(RM) "$(PKGCONFIGDIR)/lib$(FULLNAME).pc"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 74de41ab0f..a9065d6da4 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -124,7 +124,6 @@  OBJS-$(CONFIG_QSVENC)                  += qsvenc.o
 OBJS-$(CONFIG_RANGECODER)              += rangecoder.o
 OBJS-$(CONFIG_RDFT)                    += rdft.o
 OBJS-$(CONFIG_RV34DSP)                 += rv34dsp.o
-OBJS-$(CONFIG_SHARED)                  += log2_tab.o reverse.o
 OBJS-$(CONFIG_SINEWIN)                 += sinewin.o sinewin_fixed.o
 OBJS-$(CONFIG_SNAPPY)                  += snappy.o
 OBJS-$(CONFIG_STARTCODE)               += startcode.o
diff --git a/libavcodec/log2_tab.c b/libavcodec/log2_tab.c
deleted file mode 100644
index 47a1df03b7..0000000000
--- a/libavcodec/log2_tab.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "libavutil/log2_tab.c"
diff --git a/libavcodec/reverse.c b/libavcodec/reverse.c
deleted file mode 100644
index 440badaf34..0000000000
--- a/libavcodec/reverse.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "libavutil/reverse.c"
diff --git a/libavdevice/Makefile b/libavdevice/Makefile
index 1d4e9e69fe..c055d6718d 100644
--- a/libavdevice/Makefile
+++ b/libavdevice/Makefile
@@ -9,7 +9,6 @@  OBJS    = alldevices.o                                                  \
           utils.o                                                       \
 
 OBJS-$(HAVE_LIBC_MSVCRT)                 += file_open.o
-OBJS-$(CONFIG_SHARED)                    += reverse.o
 
 # input/output devices
 OBJS-$(CONFIG_ALSA_INDEV)                += alsa_dec.o alsa.o timefilter.o
diff --git a/libavdevice/reverse.c b/libavdevice/reverse.c
deleted file mode 100644
index 440badaf34..0000000000
--- a/libavdevice/reverse.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "libavutil/reverse.c"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 4d61d7835e..a581125966 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -378,8 +378,6 @@  SLIBOBJS-$(HAVE_GNU_WINDRES)                 += avfilterres.o
 SKIPHEADERS-$(CONFIG_LIBVIDSTAB)             += vidstabutils.h
 SKIPHEADERS-$(CONFIG_OPENCL)                 += opencl_internal.h deshake_opencl_kernel.h unsharp_opencl_kernel.h
 
-OBJS-$(CONFIG_SHARED)                        += log2_tab.o
-
 TOOLS     = graph2dot
 TESTPROGS = drawutils filtfmts formats integral
 
diff --git a/libavfilter/log2_tab.c b/libavfilter/log2_tab.c
deleted file mode 100644
index 47a1df03b7..0000000000
--- a/libavfilter/log2_tab.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "libavutil/log2_tab.c"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index b0ef82cdd4..977ee8ff3f 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -61,7 +61,6 @@  OBJS-$(CONFIG_RTPDEC)                    += rdt.o                       \
                                             rtpdec_vp9.o                \
                                             rtpdec_xiph.o
 OBJS-$(CONFIG_RTPENC_CHAIN)              += rtpenc_chain.o rtp.o
-OBJS-$(CONFIG_SHARED)                    += log2_tab.o golomb_tab.o
 OBJS-$(CONFIG_SRTP)                      += srtp.o
 
 # muxers/demuxers
diff --git a/libavformat/golomb_tab.c b/libavformat/golomb_tab.c
deleted file mode 100644
index 063fae3647..0000000000
--- a/libavformat/golomb_tab.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "libavcodec/golomb.c"
diff --git a/libavformat/log2_tab.c b/libavformat/log2_tab.c
deleted file mode 100644
index 47a1df03b7..0000000000
--- a/libavformat/log2_tab.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "libavutil/log2_tab.c"
diff --git a/libffmpeg/Makefile b/libffmpeg/Makefile
new file mode 100644
index 0000000000..2b28e67bab
--- /dev/null
+++ b/libffmpeg/Makefile
@@ -0,0 +1,88 @@ 
+NAME = ffmpeg
+DESC = FFmpeg multimedia library
+
+LIBVERSION := $(libavutil_VERSION)
+LIBMAJOR   := $(libavutil_VERSION_MAJOR)
+LIBMINOR   := $(libavutil_VERSION_MINOR)
+
+OBJS := $(OBJS-avutil)
+OBJS-yes :=
+OBJS-$(CONFIG_AVCODEC)    += $(OBJS-avcodec)
+OBJS-$(CONFIG_AVDEVICE)   += $(OBJS-avdevice)
+OBJS-$(CONFIG_AVFILTER)   += $(OBJS-avfilter)
+OBJS-$(CONFIG_AVFORMAT)   += $(OBJS-avformat)
+OBJS-$(CONFIG_AVRESAMPLE) += $(OBJS-avresample)
+OBJS-$(CONFIG_POSTPROC)   += $(OBJS-postproc)
+OBJS-$(CONFIG_SWRESAMPLE) += $(OBJS-swresample)
+OBJS-$(CONFIG_SWSCALE)    += $(OBJS-swscale)
+OBJS += $(OBJS-yes)
+
+FFLIBS := avutil
+
+# XXX CIG libffmpeg
+#$(SUBDIR)$(LIBNAME): $(OBJS)
+#	$(RM) $@
+#	$(AR) $(ARFLAGS) $(AR_O) $^
+#	$(RANLIB) $@
+
+# XXX CIG libffmpeg
+#install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
+#install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
+
+define RULES
+
+# XXX CIG libffmpeg TODO
+$(SUBDIR)lib$(FULLNAME).pc: libavutil/version.h | $(SUBDIR)
+	$$(M) $$(SRC_PATH)/ffbuild/pkgconfig_generate.sh $(NAME) "$(DESC)"
+
+$(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS) | $(SUBDIR)
+	$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
+
+$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
+	$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
+
+$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
+	$(SLIB_CREATE_DEF_CMD)
+	$$(LD) $(SHFLAGS) $(LDFLAGS) $(LDLIBFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
+	$(SLIB_EXTRA_CMD)
+ 
+clean::
+	$(RM) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
+	    $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(CLEANSUFFIXES:%=$(SUBDIR)tests/%)
+
+distclean:: clean
+	$(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) \
+            $(DISTCLEANSUFFIXES:%=$(SUBDIR)tests/%)
+
+# XXX CIG libffmpeg TODO
+install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
+	$(Q)mkdir -p "$(SHLIBDIR)"
+	$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
+	$$(STRIP) "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
+	$(Q)$(foreach F,$(SLIB_INSTALL_LINKS),(cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F));)
+	$(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
+	$(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
+	$(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
+
+install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
+	$(Q)mkdir -p "$(LIBDIR)"
+	$$(INSTALL) -m 644 $$< "$(LIBDIR)"
+	$(LIB_INSTALL_EXTRA_CMD)
+
+install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(FULLNAME).pc
+	$(Q)mkdir -p "$(PKGCONFIGDIR)"
+	$$(INSTALL) -m 644 $$^ "$(PKGCONFIGDIR)"
+
+uninstall-libs::
+	-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
+	       "$(SHLIBDIR)/$(SLIBNAME)"            \
+	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
+	-$(RM)  $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)/%")
+	-$(RM)  $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)/%")
+	-$(RM) "$(LIBDIR)/$(LIBNAME)"
+
+endef
+
+$(eval $(RULES))
+
+FFLIBS := ffmpeg
diff --git a/libffmpeg/libffmpeg.v b/libffmpeg/libffmpeg.v
new file mode 100644
index 0000000000..8f4f1e9b03
--- /dev/null
+++ b/libffmpeg/libffmpeg.v
@@ -0,0 +1,23 @@ 
+LIBAVUTIL_MAJOR {
+    global:
+        av*;
+        postproc_*;
+        pp_*;
+        swr_*;
+        swresample_*;
+        swscale_*;
+        sws_*;
+        #FIXME those are for ffserver
+        ff_inet_aton;
+        ff_socket_nonblock;
+        ff_rtsp_parse_line;
+        ff_rtp_get_local_rtp_port;
+        ff_rtp_get_local_rtcp_port;
+        ffio_open_dyn_packet_buf;
+        ffio_set_buf_size;
+        ffurl_close;
+        ffurl_open;
+        ffurl_write;
+    local:
+        *;
+};
diff --git a/libswresample/Makefile b/libswresample/Makefile
index 42666e4dd2..9009711946 100644
--- a/libswresample/Makefile
+++ b/libswresample/Makefile
@@ -15,7 +15,6 @@  OBJS = audioconvert.o                        \
        swresample_frame.o                    \
 
 OBJS-$(CONFIG_LIBSOXR) += soxr_resample.o
-OBJS-$(CONFIG_SHARED)  += log2_tab.o
 
 # Windows resource file
 SLIBOBJS-$(HAVE_GNU_WINDRES) += swresampleres.o
diff --git a/libswresample/log2_tab.c b/libswresample/log2_tab.c
deleted file mode 100644
index 47a1df03b7..0000000000
--- a/libswresample/log2_tab.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "libavutil/log2_tab.c"
diff --git a/libswscale/Makefile b/libswscale/Makefile
index 5e03e6fa0a..fb9aabdf23 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -19,8 +19,6 @@  OBJS = alphablend.o                                     \
        yuv2rgb.o                                        \
        vscale.o                                         \
 
-OBJS-$(CONFIG_SHARED)        += log2_tab.o
-
 # Windows resource file
 SLIBOBJS-$(HAVE_GNU_WINDRES) += swscaleres.o
 
diff --git a/libswscale/log2_tab.c b/libswscale/log2_tab.c
deleted file mode 100644
index 47a1df03b7..0000000000
--- a/libswscale/log2_tab.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "libavutil/log2_tab.c"
-- 
2.13.2