[FFmpeg-devel] [PATCH] build: Allow libffmpeg to be built for Chromium-based browsers

James Le Cuirot chewi at gentoo.org
Wed Aug 9 22:34:28 EEST 2017

On Sat Jul 29 12:20:05 EEST 2017
Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:

> On 28.07.2017, at 12:07, James Le Cuirot <chewi at gentoo.org> wrote:
> > 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_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
> I don't see you using a version file to filter out the private
> symbols? That is a VERY dangerous thing to forget.
> Also I don't like that it doesn't reuse the standard linking options
> used for the main libraries.

If you mean LD_O and SHFLAGS, I didn't use them because -o $@ and
-Wl,-soname,$$(@F) were using "libffmpeg-" as the name. My Make-fu
isn't that great and I'd love to know if there is some way to do this

If you mean the additional linker flags, these are the same flags that
Chromium uses to create libffmpeg. Maybe they're not strictly required.

SHFLAGS also applies the version scripts. Chromium doesn't use one so I
didn't either. My knowledge here is sketchy so I'm not sure if it makes
any difference when this library won't be used at build time but I came
up with a new script anyway. It makes av* global, leaving everything
else local, and this seems to work. The version label doesn't matter
for this use case so I simply put LIBFFMPEG but I guess it could be
something like LIBFFMPEG_57.55.55.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 981 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170809/0576dc72/attachment.sig>

More information about the ffmpeg-devel mailing list