package/libopenh264: switch to meson
PATCH 1/1 package/libopenh264: switch to meson
Meson support is available since version 1.8.0, added in 2018:
https://github.com/cisco/openh264/commit/bb896dbb268b32c060480d25722c5f0c3f08e9ba
Added patch to add mips arch to meson build system, in contrast to the previously used build system the meson files lacked mips support.
Meson needs host-nasm also for i386:
https://github.com/cisco/openh264/blob/v2.7.0/meson.build#L151
Fixes build error:
/builds/bkuhls/buildroot/br-test-pkg/bootlin-x86-i686-musl/host/opt/ext-toolchain/bin/../lib/gcc/i686-buildroot-linux-musl/15.3.0/../../../../i686-buildroot-linux-musl/bin/ld:
codec/encoder/core/x86/coeff.o:
warning: relocation in read-only section `.text'
/builds/bkuhls/buildroot/br-test-pkg/bootlin-x86-i686-musl/host/opt/ext-toolchain/bin/../lib/gcc/i686-buildroot-linux-musl/15.3.0/../../../../i686-buildroot-linux-musl/bin/ld:
read-only segment has dynamic relocations
collect2: error: ld returned 1 exit status
For details see:
https://bugzilla.redhat.com/show_bug.cgi?id=2428281
Fixes:
https://autobuild.buildroot.net/results/7c2/7c2232664031cfc441b8615f36bc0ebe3be9c29f/
The oldest build error of this kind dates back to 2024:
https://autobuild.buildroot.net/results/e9d/e9df2fe3d7f044c539a775bf41a02e96e01a1d8d/
so a backport to LTS branches should be considered.
The switch to meson also fixes a build error detected by the Gitlab pipelines for target bootlin-aarch64-glibc-old/build/libopenh264-2.6.0/.stamp_built:
/builds/bkuhls/buildroot/br-test-pkg/bootlin-aarch64-glibc-old/host/bin/aarch64-linux-g++
-o h264dec codec/console/dec/src/d3d9_utils.o codec/console/dec/src/h264dec.o -L. -ldecoder -lcommon -lconsole_common
./libdecoder.a(wels_decoder_thread.o): In function `SemWait':
wels_decoder_thread.cpp:(.text+0x3f0): undefined reference to sem_timedwait' wels_decoder_thread.cpp:(.text+0x454): undefined reference to sem_wait' ./libdecoder.a(wels_decoder_thread.o): In function `SemRelease':
wels_decoder_thread.cpp:(.text+0x4b0): undefined reference to sem_post' ./libcommon.a(WelsThreadLib.o): In function WelsThreadCreate':
WelsThreadLib.cpp:(.text+0xd0): undefined reference to pthread_create' ./libcommon.a(WelsThreadLib.o): In function WelsThreadJoin':
WelsThreadLib.cpp:(.text+0xf4): undefined reference to pthread_join' ./libcommon.a(WelsThreadLib.o): In function WelsEventOpen':
WelsThreadLib.cpp:(.text+0x12c): undefined reference to sem_init' ./libcommon.a(WelsThreadLib.o): In function WelsEventClose':
WelsThreadLib.cpp:(.text+0x194): undefined reference to sem_destroy' ./libcommon.a(WelsThreadLib.o): In function WelsEventSignal':
WelsThreadLib.cpp:(.text+0x1e4): undefined reference to sem_post' ./libcommon.a(WelsThreadLib.o): In function WelsEventWait':
WelsThreadLib.cpp:(.text+0x1f4): undefined reference to sem_wait' ./libcommon.a(WelsThreadLib.o): In function WelsEventWaitWithTimeOut':
WelsThreadLib.cpp:(.text+0x228): undefined reference to sem_wait' WelsThreadLib.cpp:(.text+0x2b0): undefined reference to sem_timedwait' ./libcommon.a(WelsThreadLib.o): In function `WelsMultipleEventsWaitSingleBlocking':
WelsThreadLib.cpp:(.text+0x2f4): undefined reference to sem_wait' WelsThreadLib.cpp:(.text+0x334): undefined reference to sem_trywait'
collect2: error: ld returned 1 exit status
caused by not linking against libpthread.
In glibc versions < 2.34 this was necessary:
https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=da4b2223e946368018dfb5ad73532ebf7dd84181;hb=HEAD#l1048
Meson takes care of this dependency.
---
Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/eb38a1865472c7ada979b1a1ef38fbf98bb2edbc
.../0001-meson.build-add-mips-arch.patch | 96 +++++++++++++++++++ package/libopenh264/libopenh264.mk | 40 +------- 2 files changed, 98 insertions(+), 38 deletions(-) create mode 100644 package/libopenh264/0001-meson.build-add-mips-arch.patch
package/libopenh264/0001-meson.build-add-mips-arch.patch new file +96 -0
@@ -0,0 +1,96 @@ +From b6b77205cc4bf25fd4df2aa82c20014994709656 Mon Sep 17 00:00:00 2001 +From: Bernd Kuhls <[email protected]> +Date: Wed, 28 Oct 2026 20:44:49 +0100 +Subject: [PATCH] meson.build: add mips arch + +Upstream: https://github.com/cisco/openh264/pull/4068 + +Signed-off-by: Bernd Kuhls <[email protected]> +--- + codec/common/meson.build | 4 ++++ + codec/decoder/meson.build | 4 ++++ + codec/encoder/meson.build | 4 ++++ + codec/processing/meson.build | 4 ++++ + meson.build | 6 ++++++ + 5 files changed, 22 insertions(+) + +diff --git a/codec/common/meson.build b/codec/common/meson.build +index 963da74b..0c63d445 100644 +--- a/codec/common/meson.build ++++ b/codec/common/meson.build +@@ -75,6 +75,10 @@ elif cpu_family == 'ppc' + asm_sources = [] + elif cpu_family == 'ppc64' + asm_sources = [] ++elif cpu_family == 'mips' ++ asm_sources = [] ++elif cpu_family == 'mips64' ++ asm_sources = [] + else + error('Unsupported cpu_family @0@'.format(cpu_family)) + endif +diff --git a/codec/decoder/meson.build b/codec/decoder/meson.build +index 23352ff8..ece28542 100644 +--- a/codec/decoder/meson.build ++++ b/codec/decoder/meson.build +@@ -60,6 +60,10 @@ elif cpu_family == 'ppc' + asm_sources = [] + elif cpu_family == 'ppc64' + asm_sources = [] ++elif cpu_family == 'mips' ++ asm_sources = [] ++elif cpu_family == 'mips64' ++ asm_sources = [] + else + error('Unsupported cpu family @0@'.format(cpu_family)) + endif +diff --git a/codec/encoder/meson.build b/codec/encoder/meson.build +index bebb74c2..f2648211 100644 +--- a/codec/encoder/meson.build ++++ b/codec/encoder/meson.build +@@ -89,6 +89,10 @@ elif cpu_family == 'ppc' + asm_sources = [] + elif cpu_family == 'ppc64' + asm_sources = [] ++elif cpu_family == 'mips' ++ asm_sources = [] ++elif cpu_family == 'mips64' ++ asm_sources = [] + else + error('Unsupported cpu family @0@'.format(cpu_family)) + endif +diff --git a/codec/processing/meson.build b/codec/processing/meson.build +index 1c56eb57..a7203646 100644 +--- a/codec/processing/meson.build ++++ b/codec/processing/meson.build +@@ -62,6 +62,10 @@ elif cpu_family == 'ppc' + asm_sources = [] + elif cpu_family == 'ppc64' + asm_sources = [] ++elif cpu_family == 'mips' ++ asm_sources = [] ++elif cpu_family == 'mips64' ++ asm_sources = [] + else + error('Unsupported cpu family @0@'.format(cpu_family)) + endif +diff --git a/meson.build b/meson.build +index 0a9f3d0d..c9d74713 100644 +--- a/meson.build ++++ b/meson.build +@@ -105,6 +105,12 @@ if ['linux', 'freebsd', 'android', 'ios', 'darwin'].contains(system) + elif cpu_family == 'ppc64' + # We don't have powerpc64-specific optimization for now. + asm_format = asm_format64 ++ elif cpu_family == 'mips' ++ # We don't have mips-specific optimization for now. ++ asm_format = asm_format32 ++ elif cpu_family == 'mips64' ++ # We don't have mips-specific optimization for now. ++ asm_format = asm_format64 + else + error('FIXME: unhandled CPU family @0@ for @1@'.format(cpu_family, system)) + endif +-- +2.47.3 +
package/libopenh264/libopenh264.mk +2 -38
@@ -12,44 +12,8 @@ LIBOPENH264_CPE_ID_VENDOR = cisco LIBOPENH264_CPE_ID_PRODUCT = openh264 LIBOPENH264_INSTALL_STAGING = YES -ifeq ($(BR2_aarch64),y) -LIBOPENH264_ARCH = aarch64 -else ifeq ($(BR2_arm)$(BR2_armeb),y) -LIBOPENH264_ARCH = arm -else ifeq ($(BR2_i386),y) -LIBOPENH264_ARCH = x86 -LIBOPENH264_DEPENDENCIES += host-nasm -else ifeq ($(BR2_mips)$(BR2_mipsel),y) -LIBOPENH264_ARCH = mips -else ifeq ($(BR2_mips64)$(BR2_mips64el),y) -LIBOPENH264_ARCH = mips64 -else ifeq ($(BR2_x86_64),y) -LIBOPENH264_ARCH = x86_64 +ifeq ($(BR2_i386)$(BR2_x86_64),y) LIBOPENH264_DEPENDENCIES += host-nasm endif -# ENABLE64BIT is really only used for x86-64, other 64 bits -# architecture don't need it. -LIBOPENH264_MAKE_OPTS = \ - ARCH=$(LIBOPENH264_ARCH) \ - ENABLE64BIT=$(if $(BR2_x86_64),Yes,No) \ - USE_STACK_PROTECTOR=No - -define LIBOPENH264_BUILD_CMDS - $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \ - $(LIBOPENH264_MAKE_OPTS) -endef - -define LIBOPENH264_INSTALL_STAGING_CMDS - $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \ - $(LIBOPENH264_MAKE_OPTS) \ - DESTDIR=$(STAGING_DIR) PREFIX=/usr install -endef - -define LIBOPENH264_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \ - $(LIBOPENH264_MAKE_OPTS) \ - DESTDIR=$(TARGET_DIR) PREFIX=/usr install -endef - -$(eval $(generic-package)) +$(eval $(meson-package))
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot