git: 2135341051ba - main - multimedia/ringrtc: Fix build.

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Wed, 07 Jun 2023 05:56:00 UTC
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2135341051ba56b5395e1b800dc11865465bd19e

commit 2135341051ba56b5395e1b800dc11865465bd19e
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2023-06-07 05:55:21 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2023-06-07 05:55:57 +0000

    multimedia/ringrtc: Fix build.
    
    Add missing patches.
---
 ...src_webrtc_src_build_toolchain_freebsd_BUILD.gn | 69 ++++++++++++++++++++++
 .../patch-src_webrtc_src_ringrtc_opus_BUILD.gn     | 18 ++++++
 .../patch-src_webrtc_src_third__nasm_BUILD.gn      | 16 +++++
 3 files changed, 103 insertions(+)

diff --git a/multimedia/ringrtc/files/patch-src_webrtc_src_build_toolchain_freebsd_BUILD.gn b/multimedia/ringrtc/files/patch-src_webrtc_src_build_toolchain_freebsd_BUILD.gn
new file mode 100644
index 000000000000..90410ef74eb3
--- /dev/null
+++ b/multimedia/ringrtc/files/patch-src_webrtc_src_build_toolchain_freebsd_BUILD.gn
@@ -0,0 +1,69 @@
+--- ../../src/webrtc/src/build/toolchain/freebsd/BUILD.gn.orig	2022-02-07 13:39:41 UTC
++++ ../../src/webrtc/src/build/toolchain/freebsd/BUILD.gn
+@@ -0,0 +1,66 @@
++# Copyright 2013 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/config/sysroot.gni")
++import("//build/toolchain/gcc_toolchain.gni")
++
++clang_toolchain("clang_x86") {
++  toolchain_args = {
++    current_cpu = "x86"
++    current_os = "freebsd"
++  }
++}
++
++gcc_toolchain("x86") {
++  cc = "gcc"
++  cxx = "g++"
++
++  readelf = "readelf"
++  nm = "nm"
++  ar = "ar"
++  ld = cxx
++
++  toolchain_args = {
++    current_cpu = "x86"
++    current_os = "freebsd"
++    is_clang = false
++  }
++}
++
++clang_toolchain("clang_x64") {
++  toolchain_args = {
++    current_cpu = "x64"
++    current_os = "freebsd"
++  }
++}
++
++gcc_toolchain("x64") {
++  cc = "gcc"
++  cxx = "g++"
++
++  readelf = "readelf"
++  nm = "nm"
++  ar = "ar"
++  ld = cxx
++
++  toolchain_args = {
++    current_cpu = "x64"
++    current_os = "freebsd"
++    is_clang = false
++  }
++}
++
++clang_toolchain("clang_arm") {
++  toolchain_args = {
++    current_cpu = "arm64"
++    current_os = "freebsd"
++  }
++}
++
++clang_toolchain("clang_arm64") {
++  toolchain_args = {
++    current_cpu = "arm64"
++    current_os = "freebsd"
++  }
++}
diff --git a/multimedia/ringrtc/files/patch-src_webrtc_src_ringrtc_opus_BUILD.gn b/multimedia/ringrtc/files/patch-src_webrtc_src_ringrtc_opus_BUILD.gn
new file mode 100644
index 000000000000..1a4cd1ccb33a
--- /dev/null
+++ b/multimedia/ringrtc/files/patch-src_webrtc_src_ringrtc_opus_BUILD.gn
@@ -0,0 +1,18 @@
+Use VAR_ARRAYS on FreeBSD (same as audio/opus)
+
+--- ../../src/webrtc/src/ringrtc/opus/BUILD.gn	2021-03-15 17:51:55 UTC
++++ ../../src/webrtc/src/ringrtc/opus/BUILD.gn
+@@ -37,10 +37,11 @@ config("opus_private_config") {
+     "OPUS_EXPORT=",
+     "ENABLE_HARDENING",
+ 
++    "VAR_ARRAYS",
+     # Prefer alloca() over variable length arrays which are often inefficient;
+     # the opus code will automatically handle this correctly per-platform.
+-    "USE_ALLOCA",
+-    "HAVE_ALLOCA_H",
++#    "USE_ALLOCA",
++#    "HAVE_ALLOCA_H",
+   ]
+ 
+   include_dirs = [
diff --git a/multimedia/ringrtc/files/patch-src_webrtc_src_third__nasm_BUILD.gn b/multimedia/ringrtc/files/patch-src_webrtc_src_third__nasm_BUILD.gn
new file mode 100644
index 000000000000..83521ea47d84
--- /dev/null
+++ b/multimedia/ringrtc/files/patch-src_webrtc_src_third__nasm_BUILD.gn
@@ -0,0 +1,16 @@
+--- ../../src/webrtc/src/third_party/nasm/BUILD.gn.orig	2023-02-01 18:45:20 UTC
++++ ../../src/webrtc/src/third_party/nasm/BUILD.gn
+@@ -63,6 +63,13 @@ config("nasm_config") {
+ 
+   defines = [ "HAVE_CONFIG_H" ]
+ 
++  _string_h_lines =
++        read_file("/usr/include/string.h", "list lines")
++  _mempcpy = filter_include(_string_h_lines, [ "*\*mempcpy*" ])
++  if (_mempcpy != []) {
++    defines += [ "HAVE_MEMPCPY=1" ]
++  }
++
+   if (is_clang) {
+     cflags = [
+       # The inline functions in NASM's headers flag this.