All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/2] x264: new package
@ 2014-10-03  8:53 David du Colombier
  2014-10-03  8:53 ` [Buildroot] [PATCH v3 2/2] ffmpeg: enable x264 support David du Colombier
  2014-10-05 12:53 ` [Buildroot] [PATCH v3 1/2] x264: new package Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: David du Colombier @ 2014-10-03  8:53 UTC (permalink / raw)
  To: buildroot

This package is based on an earlier package
proposed by Ayaka in December 2013.

Signed-off-by: David du Colombier <0intro@gmail.com>
---
Changes v2 -> v3:
  - suggestions by Peter Korsgaard

Changes v1 -> v2:
  - suggestions by Thomas Petazzoni
---
 package/Config.in      |  1 +
 package/x264/Config.in | 23 +++++++++++++++++++++
 package/x264/x264.mk   | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+)
 create mode 100644 package/x264/Config.in
 create mode 100644 package/x264/x264.mk

diff --git a/package/Config.in b/package/Config.in
index 1021d4c..4d8a0c4 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -755,6 +755,7 @@ menu "Multimedia"
 	source "package/libtheora/Config.in"
 	source "package/live555/Config.in"
 	source "package/mediastreamer/Config.in"
+	source "package/x264/Config.in"
 endmenu
 
 menu "Networking"
diff --git a/package/x264/Config.in b/package/x264/Config.in
new file mode 100644
index 0000000..93e6ed0
--- /dev/null
+++ b/package/x264/Config.in
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_X264
+	bool "x264"
+	depends on BR2_LARGEFILE
+	help
+	  x264 is a free software library and application for
+	  encoding video streams into the H.264/MPEG-4 AVC
+	  compression format, and is released under the terms
+	  of the GNU GPL.
+
+	  https://www.videolan.org/developers/x264.html
+
+if BR2_PACKAGE_X264
+
+config BR2_PACKAGE_X264_CLI
+	bool "CLI"
+	default n
+	help
+	  Command Line Interface
+
+endif
+
+comment "x264 needs a toolchain w/ largefile"
+	depends on !BR2_LARGEFILE
diff --git a/package/x264/x264.mk b/package/x264/x264.mk
new file mode 100644
index 0000000..5c0aaf9
--- /dev/null
+++ b/package/x264/x264.mk
@@ -0,0 +1,55 @@
+###############################################################
+#
+# x264
+#
+###############################################################
+
+X264_VERSION = 20140930-2245-stable
+X264_SOURCE = x264-snapshot-$(X264_VERSION).tar.bz2
+X264_SITE = ftp://ftp.videolan.org/pub/videolan/x264/snapshots
+X264_LICENSE = GPLv2+
+X264_DEPENDENCIES = host-pkgconf
+X264_LICENSE_FILES = COPYING
+X264_INSTALL_STAGING = YES
+
+ifeq ($(BR2_PREFER_STATIC_LIB),)
+	X264_CONF_OPTS += --enable-pic --enable-shared
+endif
+
+ifeq ($(BR2_PACKAGE_X264_CLI),)
+	X264_CONF_OPTS += --disable-cli
+endif
+
+ifeq ($(BR2_arm)$(BR2_i386)$(BR2_powerpc)$(BR2_x86_64),)
+	X264_CONF_OPTS += --disable-asm
+endif
+
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
+	X264_CONF_OPTS += --disable-thread
+endif
+
+# the configure script is not generated by autoconf
+define X264_CONFIGURE_CMDS
+	(cd $(@D); $(TARGET_CONFIGURE_OPTS) ./configure \
+		--prefix=/usr \
+		--host="$(GNU_TARGET_NAME)" \
+		--cross-prefix="$(TARGET_CROSS)" \
+		--disable-ffms \
+		--enable-static \
+		$(X264_CONF_OPTS) \
+	)
+endef
+
+define X264_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
+endef
+
+define X264_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) DESTDIR="$(STAGING_DIR)" -C $(@D) install
+endef
+
+define X264_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) DESTDIR="$(TARGET_DIR)" -C $(@D) install
+endef
+
+$(eval $(generic-package))
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v3 2/2] ffmpeg: enable x264 support
  2014-10-03  8:53 [Buildroot] [PATCH v3 1/2] x264: new package David du Colombier
@ 2014-10-03  8:53 ` David du Colombier
  2014-10-05 12:53 ` [Buildroot] [PATCH v3 1/2] x264: new package Thomas Petazzoni
  1 sibling, 0 replies; 4+ messages in thread
From: David du Colombier @ 2014-10-03  8:53 UTC (permalink / raw)
  To: buildroot

Signed-off-by: David du Colombier <0intro@gmail.com>
---
 package/ffmpeg/ffmpeg.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk
index 5b7fa20..0185749 100644
--- a/package/ffmpeg/ffmpeg.mk
+++ b/package/ffmpeg/ffmpeg.mk
@@ -229,6 +229,13 @@ else
 FFMPEG_CONF_OPT += --disable-libvpx
 endif
 
+ifeq ($(BR2_PACKAGE_X264)$(BR2_PACKAGE_FFMPEG_GPL),yy)
+FFMPEG_CONF_OPT += --enable-libx264
+FFMPEG_DEPENDENCIES += x264
+else
+FFMPEG_CONF_OPT += --disable-libx264
+endif
+
 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
 FFMPEG_CONF_OPT += --enable-yasm
 FFMPEG_DEPENDENCIES += host-yasm
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v3 1/2] x264: new package
  2014-10-03  8:53 [Buildroot] [PATCH v3 1/2] x264: new package David du Colombier
  2014-10-03  8:53 ` [Buildroot] [PATCH v3 2/2] ffmpeg: enable x264 support David du Colombier
@ 2014-10-05 12:53 ` Thomas Petazzoni
  2014-10-05 16:26   ` David du Colombier
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2014-10-05 12:53 UTC (permalink / raw)
  To: buildroot

Dear David du Colombier,

On Fri,  3 Oct 2014 10:53:58 +0200, David du Colombier wrote:

> +if BR2_PACKAGE_X264
> +
> +config BR2_PACKAGE_X264_CLI
> +	bool "CLI"
> +	default n

default n is not needed, as the default for a boolean option is to be
disabled.

> +	help
> +	  Command Line Interface

Maybe more text would be needed here.

But the biggest problem is that it doesn't build:

Try this configuration:

BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2014.08.tar.bz2"
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16=y
BR2_TOOLCHAIN_EXTERNAL_LARGEFILE=y
BR2_TOOLCHAIN_EXTERNAL_INET_IPV6=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_INET_RPC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_PACKAGE_X264=y
BR2_PACKAGE_X264_CLI=y

It will fail with:

/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-as -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -Os  -Wall -I. -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -c -DSTACK_ALIGNMENT=16 -DPIC -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/arm/cpu-a.o common/arm/cpu-a.S
/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-as: unrecognized option '-_LARGEFILE_SOURCE'

This is caused by the following code in the configure script:

if [ $asm = auto -a $ARCH = ARM ] ; then
    # set flags so neon is built by default
    echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon"

    if  cc_check '' '' '__asm__("rev ip, ip");' ; then      define HAVE_ARMV6
        cc_check '' '' '__asm__("movt r0, #0");'         && define HAVE_ARMV6T2
        cc_check '' '' '__asm__("vadd.i16 q0, q0, q0");' && define HAVE_NEON
        ASFLAGS="$ASFLAGS $CFLAGS -c"
    else
        echo "You specified a pre-ARMv6 or Thumb-1 CPU in your CFLAGS."
        echo "If you really want to run on such a CPU, configure with --disable-asm."
        exit 1
    fi
fi

When you're on ARM, CFLAGS is added to ASFLAGS. However, the CFLAGS
passed by Buildroot contain options that are not suitable for AS.
Basically, what x264 is doing here is completely stupid: assuming that
all compiler flags can be passed as assembler flags.

Also, the "else" condition above is interesting: the assembly code is
only valid for ARMv6+. So in your x264.mk file, the following snippet
is wrong:

ifeq ($(BR2_arm)$(BR2_i386)$(BR2_powerpc)$(BR2_x86_64),)
        X264_CONF_OPTS += --disable-asm
endif

Because if you're on ARMv5, we will *not* pass --disable-asm, while we
should. So this logic should be refined to take into account variants
of the ARM architecture.

Could you look into this and send an updated version?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v3 1/2] x264: new package
  2014-10-05 12:53 ` [Buildroot] [PATCH v3 1/2] x264: new package Thomas Petazzoni
@ 2014-10-05 16:26   ` David du Colombier
  0 siblings, 0 replies; 4+ messages in thread
From: David du Colombier @ 2014-10-05 16:26 UTC (permalink / raw)
  To: buildroot

> > +if BR2_PACKAGE_X264
> > +
> > +config BR2_PACKAGE_X264_CLI
> > +	bool "CLI"
> > +	default n
> 
> default n is not needed, as the default for a boolean option is to be
> disabled.

Done.

> > +	help
> > +	  Command Line Interface
> 
> Maybe more text would be needed here.

Done.

> When you're on ARM, CFLAGS is added to ASFLAGS. However, the CFLAGS
> passed by Buildroot contain options that are not suitable for AS.
> Basically, what x264 is doing here is completely stupid: assuming that
> all compiler flags can be passed as assembler flags.

It seems this issue has already been fixed in the x264
master branch.

http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=716ee56d0b35e512e8e0ae1a3e71f26e65e86be3

I've imported the patch in the x264 package.

> Also, the "else" condition above is interesting: the assembly code is
> only valid for ARMv6+. So in your x264.mk file, the following snippet
> is wrong:
> 
> ifeq ($(BR2_arm)$(BR2_i386)$(BR2_powerpc)$(BR2_x86_64),)
>         X264_CONF_OPTS += --disable-asm
> endif
> 
> Because if you're on ARMv5, we will *not* pass --disable-asm, while we
> should. So this logic should be refined to take into account variants
> of the ARM architecture.

It seems the ARM assembly files aren't compatible with the
GNU assembler, so I finally chose to enable assembly files
on x86 only.

> Could you look into this and send an updated version?

I'll send a v4 patch.

-- 
David du Colombier

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-05 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-03  8:53 [Buildroot] [PATCH v3 1/2] x264: new package David du Colombier
2014-10-03  8:53 ` [Buildroot] [PATCH v3 2/2] ffmpeg: enable x264 support David du Colombier
2014-10-05 12:53 ` [Buildroot] [PATCH v3 1/2] x264: new package Thomas Petazzoni
2014-10-05 16:26   ` David du Colombier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.