summary refs log tree commit diff
path: root/gnu/packages/audio.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2022-02-07 15:41:51 +0200
committerEfraim Flashner <efraim@flashner.co.il>2022-02-07 22:08:19 +0200
commit55e871844c0fe89123135b1cf598d167dd49eeb4 (patch)
tree8ea25a1ec8c8cf5f581d7b05608a79441695eb19 /gnu/packages/audio.scm
parent3fe905ebdd949360b986144082734f8bdb2b6017 (diff)
downloadguix-55e871844c0fe89123135b1cf598d167dd49eeb4.tar.gz
gnu: webrtc-audio-processing: Fix building on powerpc architectures.
* gnu/packages/audio.scm (webrtc-audio-processing)[arguments]: Adjust
custom arguments list to also fix building on all powerpc architectures.
[native-inputs]: Add patch, local-file on riscv64-linux and powerpc
architectures.
* gnu/packages/patches/webrtc-audio-processing-big-endian.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu/packages/audio.scm')
-rw-r--r--gnu/packages/audio.scm40
1 files changed, 33 insertions, 7 deletions
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index a8ecd32e4c..c2f85346bd 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -255,17 +255,43 @@ softsynth library that can be use with other applications.")
         (base32 "1gsx7k77blfy171b6g3m0k0s0072v6jcawhmx1kjs9w5zlwdkzd0"))))
     (build-system gnu-build-system)
     (arguments
-     ;; TODO: Move this to a snippet or remove with the upgrade to 1.0.
-     (if (target-riscv64?)
+     ;; TODO: Move this to a snippet/patch or remove with the upgrade to 1.0.
+     (if (or (target-riscv64?)
+             (target-powerpc?))
        (list
          #:phases
          #~(modify-phases %standard-phases
              (add-after 'unpack 'patch-source
-               (lambda _
-                 (substitute* "webrtc/typedefs.h"
-                   (("defined\\(__aarch64__\\)" all)
-                    (string-append
-                      all " || (defined(__riscv) && __riscv_xlen == 64)")))))))
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((patch-file
+                        #$(local-file
+                           (search-patch
+                             "webrtc-audio-processing-big-endian.patch"))))
+                   (invoke "patch" "--force" "-p1" "-i" patch-file)
+                   (substitute* "webrtc/typedefs.h"
+                     (("defined\\(__aarch64__\\)" all)
+                      (string-append
+                        ;; powerpc-linux
+                        "(defined(__PPC__) && __SIZEOF_SIZE_T__ == 4)\n"
+                        "#define WEBRTC_ARCH_32_BITS\n"
+                        "#define WEBRTC_ARCH_BIG_ENDIAN\n"
+                        ;; powerpc64-linux
+                        "#elif (defined(__PPC64__) && defined(_BIG_ENDIAN))\n"
+                        "#define WEBRTC_ARCH_64_BITS\n"
+                        "#define WEBRTC_ARCH_BIG_ENDIAN\n"
+                        ;; aarch64-linux
+                        "#elif " all
+                        ;; riscv64-linux
+                        " || (defined(__riscv) && __riscv_xlen == 64)"
+                        ;; powerpc64le-linux
+                        " || (defined(__PPC64__) && defined(_LITTLE_ENDIAN))"))))))))
+       '()))
+    (native-inputs
+     (if (or (target-riscv64?)
+             (target-powerpc?))
+       (list
+         (local-file (search-patch "webrtc-audio-processing-big-endian.patch"))
+         patch)
        '()))
     (synopsis "WebRTC's Audio Processing Library")
     (description "WebRTC-Audio-Processing library based on Google's