[pulseaudio-commits] [Git][pulseaudio/webrtc-audio-processing][master] 6 commits: Some fixes for MinGW

Arun Raghavan (@arun) gitlab at gitlab.freedesktop.org
Thu Oct 21 00:09:20 UTC 2021



Arun Raghavan pushed to branch master at PulseAudio / webrtc-audio-processing


Commits:
ff85c986 by Arun Raghavan at 2021-10-19T16:09:07-04:00
Some fixes for MinGW

  * Rename Windows.h uses to windows.h
  * Comment out structured exception handling usage

Makes MinGW happier. Mostly the same as previous work by
Nicolas Dufresne <nicolas.dufresne at collabora.com>, with the exception
that we now don't try to invoke RaiseException which would fail in MinGW
as it raises a Windows structured exception.

- - - - -
8bf9efad by Arun Raghavan at 2021-10-19T18:06:37-04:00
Use pkg-config for abseil-cpp detection if available

This should make things a bit easier.

- - - - -
6064932a by Arun Raghavan at 2021-10-19T18:06:37-04:00
Add missing header for C++17 compatibility

Hopefully we can drop this change with the next update.

- - - - -
0cc2ebed by Arun Raghavan at 2021-10-20T11:15:57-04:00
Add missing absl library for bad_optional_access

- - - - -
5a5aa66a by Arun Raghavan at 2021-10-20T11:16:18-04:00
Add an abseil subproject and correctly specify fallback deps

- - - - -
e31340c2 by Arun Raghavan at 2021-10-20T11:16:19-04:00
Add builds for distro and vendored versions of abseil

- - - - -


8 changed files:

- .gitignore
- .gitlab-ci.yml
- meson.build
- + subprojects/abseil-cpp.wrap
- webrtc/modules/audio_processing/aec3/reverb_frequency_response.h
- webrtc/rtc_base/platform_thread_types.cc
- webrtc/rtc_base/synchronization/rw_lock_win.h
- webrtc/rtc_base/system/file_wrapper.cc


Changes:

=====================================
.gitignore
=====================================
@@ -8,3 +8,4 @@
 build/
 depcomp
 install/
+subprojects/*/


=====================================
.gitlab-ci.yml
=====================================
@@ -19,7 +19,7 @@ variables:
   # CI runs, for example when adding new packages to FDO_DISTRIBUTION_PACKAGES.
   # The tag is an arbitrary string that identifies the exact container
   # contents.
-  BASE_TAG: '2020-12-10.1'
+  BASE_TAG: '2021-10-19.1'
   FDO_DISTRIBUTION_VERSION: '20.10'
   FDO_UPSTREAM_REPO: 'pulseaudio/webrtc-audio-processing'
 
@@ -43,10 +43,12 @@ include:
     FDO_DISTRIBUTION_PACKAGES: >-
       g++
       gcc
+      git-core
       cmake
       libabsl-dev
       meson
       ninja-build
+      pkg-config
       python3-setuptools
 
 # Used to extend both container and build jobs
@@ -76,24 +78,46 @@ build-container-aarch64:
   stage: container
 
 # Common build template
-.build:
+.build-distro-absl:
   stage: build
   extends:
     - .fdo.distribution-image at ubuntu
   script:
-    - meson build
+    - meson build --wrap-mode=nofallback
     - cd build
     - ninja
   artifacts:
     paths:
       - build/
 
-build-x86_64:
+.build-vendored-absl:
+  stage: build
+  extends:
+    - .fdo.distribution-image at ubuntu
+  script:
+    - meson build --force-fallback-for=abseil-cpp
+    - cd build
+    - ninja
+  artifacts:
+    paths:
+      - build/
+
+build-distro-absl-x86_64:
+  extends:
+    - .build-distro-absl
+    - .ubuntu-x86_64
+
+build-vendored-absl-x86_64:
   extends:
-    - .build
+    - .build-vendored-absl
     - .ubuntu-x86_64
 
-build-aarch64:
+build-distro-absl-aarch64:
+  extends:
+    - .build-distro-absl
+    - .ubuntu-aarch64
+
+build-vendored-absl-aarch64:
   extends:
-    - .build
+    - .build-vendored-absl
     - .ubuntu-aarch64


=====================================
meson.build
=====================================
@@ -40,51 +40,84 @@ os_deps = []
 have_posix = false
 have_win = false
 
-absl_dep = dependency('absl', method : 'cmake',
-  modules : [
-    'absl::base',
-    'absl::flags_parse',
-    'absl::strings',
-    'absl::synchronization',
-  ],
-  required : false,
+# Let's use pkg-config if available. This will also fallback to the subproject
+# if pkg-config is not found, instead of CMake or manual library detection.
+# This might be surprising, but is hopefully a temporary state until recent
+# abseil versions become the norm.
+absl_base_dep = dependency('absl_base', required : false,
+  fallback: [ 'abseil-cpp', 'absl_base_dep' ]
+)
+absl_flags_dep = dependency('absl_flags_parse', required : false,
+  fallback: [ 'abseil-cpp', 'absl_flags_dep' ]
+)
+absl_optional_dep = dependency('absl_optional', required : false,
+  fallback: [ 'abseil-cpp', 'absl_types_dep' ]
+)
+absl_strings_dep = dependency('absl_strings', required : false,
+  fallback: [ 'abseil-cpp', 'absl_strings_dep' ]
+)
+absl_synchronization_dep = dependency('absl_synchronization', required : false,
+  fallback: [ 'abseil-cpp', 'absl_synchronization_dep' ]
 )
 
-if not absl_dep.found()
-  warning('Could not find abseil-cpp with CMake, using fallback library detection which may fail.')
-  absl_libs = [
-    'absl_base',
-    'absl_bad_optional_access',
-    'absl_city',
-    'absl_flags_commandlineflag',
-    'absl_flags_commandlineflag_internal',
-    'absl_flags_config',
-    'absl_flags_internal',
-    'absl_flags_marshalling',
-    'absl_flags_parse',
-    'absl_flags_private_handle_accessor',
-    'absl_flags_program_name',
-    'absl_flags_reflection',
-    'absl_flags_usage',
-    'absl_flags_usage_internal',
-    'absl_hash',
-    'absl_int128',
-    'absl_malloc_internal',
-    'absl_raw_logging_internal',
-    'absl_spinlock_wait',
-    'absl_stacktrace',
-    'absl_str_format_internal',
-    'absl_strings',
-    'absl_symbolize',
-    'absl_synchronization',
-    'absl_throw_delegate',
-    'absl_time',
-    'absl_time_zone',
+# If we have the base dep, assume the rest should be present to
+if absl_base_dep.found()
+  absl_dep = [
+    absl_base_dep,
+    absl_flags_dep,
+    absl_optional_dep,
+    absl_strings_dep,
+    absl_synchronization_dep,
   ]
-  absl_dep = []
-  foreach l : absl_libs
-    absl_dep += cpp.find_library(l, required : false)
-  endforeach
+else
+  warning('Could not find abseil-cpp with pkg-config, trying CMake-based library detection.')
+  absl_dep = dependency('absl', method : 'cmake',
+    modules : [
+      'absl::base',
+      'absl::flags_parse',
+      'absl::optional',
+      'absl::strings',
+      'absl::synchronization',
+    ],
+    required : false,
+  )
+
+  if not absl_dep.found()
+    warning('Could not find abseil-cpp with CMake, using fallback library detection which may fail.')
+    absl_libs = [
+      'absl_base',
+      'absl_bad_optional_access',
+      'absl_city',
+      'absl_flags_commandlineflag',
+      'absl_flags_commandlineflag_internal',
+      'absl_flags_config',
+      'absl_flags_internal',
+      'absl_flags_marshalling',
+      'absl_flags_parse',
+      'absl_flags_private_handle_accessor',
+      'absl_flags_program_name',
+      'absl_flags_reflection',
+      'absl_flags_usage',
+      'absl_flags_usage_internal',
+      'absl_hash',
+      'absl_int128',
+      'absl_malloc_internal',
+      'absl_raw_logging_internal',
+      'absl_spinlock_wait',
+      'absl_stacktrace',
+      'absl_str_format_internal',
+      'absl_strings',
+      'absl_symbolize',
+      'absl_synchronization',
+      'absl_throw_delegate',
+      'absl_time',
+      'absl_time_zone',
+    ]
+    absl_dep = []
+    foreach l : absl_libs
+      absl_dep += cpp.find_library(l, required : false)
+    endforeach
+  endif
 endif
 
 if ['darwin', 'ios'].contains(host_system)
@@ -105,6 +138,8 @@ elif host_system == 'linux'
   have_posix = true
 elif host_system == 'windows'
   platform_cflags += ['-DWEBRTC_WIN', '-D_WIN32', '-U__STRICT_ANSI__']
+  # this one is for MinGW to get format specifiers from inttypes.h in C++
+  platform_cflags += ['-D__STDC_FORMAT_MACROS=1']
   os_deps += [cc.find_library('winmm')]
   have_win = true
 endif


=====================================
subprojects/abseil-cpp.wrap
=====================================
@@ -0,0 +1,23 @@
+[wrap-file]
+directory = abseil-cpp-20210324.2
+source_url = https://github.com/abseil/abseil-cpp/archive/20210324.2.tar.gz
+source_filename = abseil-cpp-20210324.2.tar.gz
+source_hash = 59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f
+patch_filename = abseil-cpp_20210324.2-3_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20210324.2-3/get_patch
+patch_hash = 87827a6ed1fcee2c5f36d57ccdadefd536bac544892d7196b578ffb671a25c0a
+
+[provide]
+absl_base = absl_base_dep
+absl_container = absl_container_dep
+absl_debugging = absl_debugging_dep
+absl_flags = absl_flags_dep
+absl_hash = absl_hash_dep
+absl_numeric = absl_numeric_dep
+absl_random = absl_random_dep
+absl_status = absl_status_dep
+absl_strings = absl_strings_dep
+absl_synchronization = absl_synchronization_dep
+absl_time = absl_time_dep
+absl_types = absl_types_dep
+


=====================================
webrtc/modules/audio_processing/aec3/reverb_frequency_response.h
=====================================
@@ -12,6 +12,7 @@
 #define MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_
 
 #include <array>
+#include <memory>
 #include <vector>
 
 #include "absl/types/optional.h"


=====================================
webrtc/rtc_base/platform_thread_types.cc
=====================================
@@ -99,11 +99,13 @@ void SetCurrentThreadName(const char* name) {
 
 #pragma warning(push)
 #pragma warning(disable : 6320 6322)
+#ifndef __MINGW32__
   __try {
     ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(ULONG_PTR),
                      reinterpret_cast<ULONG_PTR*>(&threadname_info));
   } __except (EXCEPTION_EXECUTE_HANDLER) {  // NOLINT
   }
+#endif
 #pragma warning(pop)
 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
   prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name));  // NOLINT


=====================================
webrtc/rtc_base/synchronization/rw_lock_win.h
=====================================
@@ -11,7 +11,7 @@
 #ifndef RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_
 #define RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_
 
-#include <Windows.h>
+#include <windows.h>
 
 #include "rtc_base/synchronization/rw_lock_wrapper.h"
 


=====================================
webrtc/rtc_base/system/file_wrapper.cc
=====================================
@@ -14,7 +14,7 @@
 #include <cerrno>
 
 #ifdef _WIN32
-#include <Windows.h>
+#include <windows.h>
 #else
 #include <string.h>
 #endif



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/compare/57ec282d4ff225baef20562e4212392925295ed0...e31340c243f034e26e1e876f3f32fc842f5e5b5b

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/compare/57ec282d4ff225baef20562e4212392925295ed0...e31340c243f034e26e1e876f3f32fc842f5e5b5b
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20211021/6897316b/attachment-0001.htm>


More information about the pulseaudio-commits mailing list