From 77e99a79eb744509c2f896c177b6d2870b394f20 Mon Sep 17 00:00:00 2001 From: Kaelyn Takata Date: Sun, 4 Aug 2024 18:28:36 +0000 Subject: [PATCH] gnu: webrtc-audio-processing: Fix build on i686 and powerpc64le. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/audio.scm (webrtc-audio-processing)[arguments]: New field. * gnu/packages/patches/webrtc-audio-processing-byte-order-pointer-size.patch, gnu/packages/patches/webrtc-audio-processing-x86-no-sse.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. Change-Id: I3a95e5e2794df0d51e005672b5d3e2d98f27b767 Co-authored-by: Ludovic Courtès --- gnu/local.mk | 2 ++ gnu/packages/audio.scm | 22 +++++++++++++ ...o-processing-byte-order-pointer-size.patch | 32 +++++++++++++++++++ .../webrtc-audio-processing-x86-no-sse.patch | 13 ++++++++ 4 files changed, 69 insertions(+) create mode 100644 gnu/packages/patches/webrtc-audio-processing-byte-order-pointer-size.patch create mode 100644 gnu/packages/patches/webrtc-audio-processing-x86-no-sse.patch diff --git a/gnu/local.mk b/gnu/local.mk index aba33c131d..4998db682c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2283,6 +2283,8 @@ dist_patch_DATA = \ %D%/packages/patches/wcstools-extend-makefiles.patch \ %D%/packages/patches/wdl-link-libs-and-fix-jnetlib.patch \ %D%/packages/patches/webkitgtk-adjust-bubblewrap-paths.patch \ + %D%/packages/patches/webrtc-audio-processing-byte-order-pointer-size.patch \ + %D%/packages/patches/webrtc-audio-processing-x86-no-sse.patch \ %D%/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch \ %D%/packages/patches/websocketpp-fix-for-cmake-3.15.patch \ %D%/packages/patches/wlroots-hwdata-fallback.patch \ diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm index 52033c46ab..6be49f7768 100644 --- a/gnu/packages/audio.scm +++ b/gnu/packages/audio.scm @@ -315,6 +315,28 @@ (define-public webrtc-audio-processing (sha256 (base32 "0xfvq5lxg612vfzk3zk6896zcb4cgrrb7fq76w9h40magz0jymcm")))) (build-system meson-build-system) + (arguments + (list #:configure-flags (if (target-x86-32?) + #~(list "-Dc_args=-DPFFFT_SIMD_DISABLE") + #~'()) + #:phases + (if (or (target-x86-32?) (target-powerpc?)) + #~(modify-phases %standard-phases + (add-after 'unpack 'apply-patches + (lambda _ + (define (patch file) + (invoke "patch" "-p1" "--force" "-i" file)) + + ;; https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/5 + ;; TODO: Move to the 'patches' field of the origin on + ;; the next rebuild. + (patch #$(local-file + (search-patch + "webrtc-audio-processing-byte-order-pointer-size.patch"))) + (patch #$(local-file + (search-patch + "webrtc-audio-processing-x86-no-sse.patch")))))) + #~%standard-phases))) (native-inputs (list pkg-config)) (inputs (list abseil-cpp)) (synopsis "WebRTC's Audio Processing Library") diff --git a/gnu/packages/patches/webrtc-audio-processing-byte-order-pointer-size.patch b/gnu/packages/patches/webrtc-audio-processing-byte-order-pointer-size.patch new file mode 100644 index 0000000000..e2d974afd9 --- /dev/null +++ b/gnu/packages/patches/webrtc-audio-processing-byte-order-pointer-size.patch @@ -0,0 +1,32 @@ +https://bugs.gentoo.org/917493 +https://sources.debian.org/src/webrtc-audio-processing/1.0-0.2/debian/patches/Add-generic-byte-order-and-pointer-size-detection.patch/ + +Description: Add generic byte order and pointer size detection +Author: Than +Origin: https://bugs.freedesktop.org/show_bug.cgi?id=95738#c4 +Last-Update: 2022-02-01 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/webrtc/rtc_base/system/arch.h ++++ b/webrtc/rtc_base/system/arch.h +@@ -58,7 +58,19 @@ + #define WEBRTC_ARCH_32_BITS + #define WEBRTC_ARCH_LITTLE_ENDIAN + #else +-#error Please add support for your architecture in rtc_base/system/arch.h ++/* instead of failing, use typical unix defines... */ ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ++#define WEBRTC_ARCH_LITTLE_ENDIAN ++#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++#define WEBRTC_ARCH_BIG_ENDIAN ++#else ++#error __BYTE_ORDER__ is not defined ++#endif ++#if defined(__LP64__) ++#define WEBRTC_ARCH_64_BITS ++#else ++#define WEBRTC_ARCH_32_BITS ++#endif + #endif + + #if !(defined(WEBRTC_ARCH_LITTLE_ENDIAN) ^ defined(WEBRTC_ARCH_BIG_ENDIAN)) diff --git a/gnu/packages/patches/webrtc-audio-processing-x86-no-sse.patch b/gnu/packages/patches/webrtc-audio-processing-x86-no-sse.patch new file mode 100644 index 0000000000..c194dd9244 --- /dev/null +++ b/gnu/packages/patches/webrtc-audio-processing-x86-no-sse.patch @@ -0,0 +1,13 @@ +https://bugs.gentoo.org/921140 +https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/5 +--- a/webrtc/rtc_base/system/arch.h ++++ b/webrtc/rtc_base/system/arch.h +@@ -34,7 +34,7 @@ + #else + #define WEBRTC_ARCH_32_BITS + #endif +-#elif defined(_M_IX86) || defined(__i386__) ++#elif defined(__SSE__) && (defined(_M_IX86) || defined(__i386__)) + #define WEBRTC_ARCH_X86_FAMILY + #define WEBRTC_ARCH_X86 + #define WEBRTC_ARCH_32_BITS