Skip to contentSkip to conversation

ffmpeg: enable use of freetype and fontconfig

PATCH New Steve Kenton 3 participants 3 messages Jan 27, 2015 – Jan 30, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ffmpeg: enable use of freetype and fontconfig

Configure ffmpeg to use freetype and fontconfig
if those packages are selected.

ffmpeg freetype support require fenv.h
which is not available in uClibc
except for uClibc on x86

Signed-off-by Stephen M. Kenton <[email protected]>
---
V2 Added fontconfig to make freetype support more robust

I could not find a good way to do "or" in the make file Is there something better than nesting and using two ffmpeg_environment_has_fenv ?= y
statements? I'm not really happy about the temporary

package/ffmpeg/ffmpeg.mk +22 -1
diff -pruN buildroot.ori/package/ffmpeg/ffmpeg.mk buildroot/package/ffmpeg/ffmpeg.mk
@@ -49,7 +49,6 @@ FFMPEG_CONF_OPTS = \
 	--disable-libopencv \
 	--disable-libdc1394 \
 	--disable-libfaac \
-	--disable-libfreetype \
 	--disable-libgsm \
 	--disable-libmp3lame \
 	--disable-libnut \
@@ -234,6 +233,28 @@ else
 FFMPEG_CONF_OPTS += --disable-libvpx
 endif
 
+# ffmpeg freetype support require fenv.h
+# which is not available in uClibc
+ifneq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
+ffmpeg_environment_has_fenv ?= y
+endif
+# except for uClibc on x86
+ifeq ($(BR2_i386)$(BR2_x86_64),y)
+ffmpeg_environment_has_fenv ?= y
+endif
+ifeq ($(BR2_PACKAGE_FREETYPE)$(ffmpeg_environment_has_fenv),yy)
+FFMPEG_CONF_OPTS += --enable-libfreetype
+FFMPEG_DEPENDENCIES += freetype
+# fontconfig only makes sense if we also have freetype
+ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
+FFMPEG_CONF_OPTS += --enable-fontconfig
+FFMPEG_DEPENDENCIES += fontconfig
+endif
+else
+FFMPEG_CONF_OPTS += --disable-libfreetype
+FFMPEG_CONF_OPTS += --disable-fontconfig
+endif
+
 ifeq ($(BR2_PACKAGE_X264)$(BR2_PACKAGE_FFMPEG_GPL),yy)
 FFMPEG_CONF_OPTS += --enable-libx264
 FFMPEG_DEPENDENCIES += x264
#1 lore raw

PATCH v2 1/1 ffmpeg: enable use of freetype and fontconfig

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Steve" == Steve Kenton <[email protected]> writes:

Configure ffmpeg to use freetype and fontconfig
if those packages are selected.

ffmpeg freetype support require fenv.h
which is not available in uClibc
except for uClibc on x86

Quoted 8 lines

Signed-off-by Stephen M. Kenton <[email protected]>
---
V2 Added fontconfig to make freetype support more robust

I could not find a good way to do "or" in the make file Is there something better than nesting and using two ffmpeg_environment_has_fenv ?= y
statements? I'm not really happy about the temporary

I also don't like the lowercase variable, but see below:

package/ffmpeg/ffmpeg.mk else · line 243

Quoted 8 lines
package/ffmpeg/ffmpeg.mk +8 -0
+# ffmpeg freetype support require fenv.h
+# which is not available in uClibc
+ifneq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
+ffmpeg_environment_has_fenv ?= y
+endif
+# except for uClibc on x86
+ifeq ($(BR2_i386)$(BR2_x86_64),y)
+ffmpeg_environment_has_fenv ?= y

While it is true that uClibc on x86 CAN be built with fenv support, it isn't by default and our default defconfig in Buildroot doesn't enable it. Chances are that external toolchains also don't enable it, so I would prefer to just not enable it for uClibc.

You also don't cover musl. While it does provide fenv.h, it is missing functionality on atleast microblaze and soft float arm/mips, so I think the sanest approach is just to only enable it for glibc.

package/ffmpeg/ffmpeg.mk else · line 252

Quoted 9 lines
package/ffmpeg/ffmpeg.mk +9 -0
+endif
+ifeq ($(BR2_PACKAGE_FREETYPE)$(ffmpeg_environment_has_fenv),yy)
+FFMPEG_CONF_OPTS += --enable-libfreetype
+FFMPEG_DEPENDENCIES += freetype
+# fontconfig only makes sense if we also have freetype
+ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
+FFMPEG_CONF_OPTS += --enable-fontconfig
+FFMPEG_DEPENDENCIES += fontconfig
+endif

You are missing an else part with --disable-fontconfig here. While it is true that fontconfig doesn't make much sense without freetype ffmpeg does handle it correctly (E.G. --enable-fontconfig --disable-libfreetype isn't an error, but it doesn't do anything with the fontconfig stuff), so I prefer to just move the fontconfig stuff outside of the freetype handling.

Committed with these fixes, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH v2 1/1 ffmpeg: enable use of freetype and fontconfig

[posted and mailed]

Peter Korsgaard <[email protected]> wrote in
news:87k307yj4g.fsf at dell.be.48ers.dk:

Quoted 3 lines

You also don't cover musl. While it does provide fenv.h, it is missing functionality on atleast microblaze and soft float arm/mips, so I think the sanest approach is just to only enable it for glibc.

Hi Peter,

it seems that glibc at microblazeel also lacks features in fenv.h:
http://autobuild.buildroot.net/results/255/2551aae55620c6ba3da20b8be161dda302
e057c3/

Regards, Bernd