summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2017-07-24 22:53:18 +0100
committerAlexis Ballier <aballier@gentoo.org>2017-08-27 08:33:37 +0200
commite63a1ba6346da70d5a896393f0c28cef6a6fd868 (patch)
tree8459e23c5a4dbec1196584c6f668fbec5e3e5207 /media-video/ffmpeg/files
parentdev-ruby/actionpack-action_caching: cleanup (diff)
downloadgentoo-e63a1ba6346da70d5a896393f0c28cef6a6fd868.tar.gz
gentoo-e63a1ba6346da70d5a896393f0c28cef6a6fd868.tar.bz2
gentoo-e63a1ba6346da70d5a896393f0c28cef6a6fd868.zip
media-video/ffmpeg: Allow building libffmpeg for Chromium via USE flag
Chromium is built from source and therefore can be built against the system ffmpeg. Google Chrome already ships with support for proprietary codecs and has libffmpeg.so built in. Opera and Vivaldi, on the other hand, do not support proprietary codecs and actively encourage you to replace the libffmpeg.so they provide. Official instructions involve downloading the huge Chromium tarball and building tons of baggage that you don't actually need, despite the fact that libffmpeg.so is really just the main ffmpeg libraries combined. In order to build this, I felt it was worthwhile leveraging our existing feature-rich ffmpeg package rather than duplicating it or creating some poor imitation. This commit shows what little extra code is required. It would be possible to link to the regular libraries directly instead of buildling additional copies if it weren't for the fact that these browsers are usually built with -DFF_API_CONVERGENCE_DURATION=0, making the ABI incompatible, at least until libavcodec hits 59. That aside, all Chromium versions between 59 and 61 (maybe earlier?) use the 55.57.57 ffmpeg ABI found in the 3.x series. Having these browsers optionally RDEPEND on ffmpeg:0/55.57.57[chromium] should therefore not be a problem for the time being. They simply need to provide a symlink. I have tested this with current versions of vivaldi, vivaldi-snapshot, opera, opera-beta, and opera-developer. None were able to play videos on news.bbc.co.uk without Flash until swapping in this library. It has been noted that Vivaldi could potentially be built from source. I may explore this possibility but I believe this change is still useful, especially as some lack sufficient hardware to build these browsers from source. Package-Manager: Portage-2.3.6, Repoman-2.3.2
Diffstat (limited to 'media-video/ffmpeg/files')
-rw-r--r--media-video/ffmpeg/files/chromium.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/media-video/ffmpeg/files/chromium.patch b/media-video/ffmpeg/files/chromium.patch
new file mode 100644
index 000000000000..bc8b8d38698b
--- /dev/null
+++ b/media-video/ffmpeg/files/chromium.patch
@@ -0,0 +1,45 @@
+Allow libffmpeg to be built for Chromium-based browsers
+https://patchwork.ffmpeg.org/patch/4500/
+
+diff --git a/Makefile b/Makefile
+index 29870d7..1e267e7 100644
+--- a/Makefile
++++ b/Makefile
+@@ -65,6 +65,7 @@ all: all-yes
+
+ include $(SRC_PATH)/tools/Makefile
+ include $(SRC_PATH)/ffbuild/common.mak
++include $(SRC_PATH)/ffbuild/libffmpeg.mak
+
+ FF_EXTRALIBS := $(FFEXTRALIBS)
+ FF_DEP_LIBS := $(DEP_LIBS)
+diff --git a/ffbuild/libffmpeg.mak b/ffbuild/libffmpeg.mak
+new file mode 100644
+index 0000000..992cf3c
+--- /dev/null
++++ b/ffbuild/libffmpeg.mak
+@@ -0,0 +1,21 @@
++LIBFFMPEG = $(SLIBPREF)ffmpeg$(SLIBSUF)
++LIBFFMPEG_LINK = $(LD) -shared -Wl,-soname,$(LIBFFMPEG) -Wl,-Bsymbolic -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--gc-sections $(LDFLAGS) $(LDLIBFLAGS) -o $(LIBFFMPEG)
++
++libffmpeg-: libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavutil/$(LIBPREF)avutil$(LIBSUF) libswresample/$(LIBPREF)swresample$(LIBSUF)
++ $(LIBFFMPEG_LINK) -Wl,--whole-archive $^ -Wl,--no-whole-archive $(FFEXTRALIBS)
++
++libffmpeg-yes: libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavutil/$(SLIBPREF)avutil$(SLIBSUF)
++ $(LIBFFMPEG_LINK) -Wl,--no-as-needed -lavcodec -lavformat -lavutil
++
++$(LIBFFMPEG): libffmpeg-$(CONFIG_SHARED)
++libffmpeg: $(LIBFFMPEG)
++
++install-libffmpeg: $(LIBFFMPEG)
++ $(Q)mkdir -p "$(SHLIBDIR)/chromium"
++ $(INSTALL) -m 755 $< "$(SHLIBDIR)/chromium/$<"
++ $(STRIP) "$(SHLIBDIR)/chromium/$<"
++
++uninstall-libffmpeg:
++ $(RM) "$(SHLIBDIR)/chromium/$(LIBFFMPEG)"
++
++.PHONY: libffmpeg libffmpeg-* install-libffmpeg
+--
+2.13.1
+