Bug 1728436 - Added libasound2 dependency to the sysroot r=glandium

This is required to build the midir crate on Linux. The Dockerfile change is
needed to run the just built xpcshell executable on the build host.

Differential Revision: https://phabricator.services.mozilla.com/D124641
This commit is contained in:
Gabriele Svelto 2021-12-21 11:34:52 +00:00
Родитель ee6325f662
Коммит 2793748f11
6 изменённых файлов: 60 добавлений и 6 удалений

Просмотреть файл

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Assertions.h"
// The code in this file is a workaround for building with ALSA versions prior
// to 1.0.29. The snd_pcm_sw_params_set_tstamp_type() and
// snd_pcm_sw_params_get_tstamp_type() functions are missing from those versions
// and we need them for the alsa crate which in turn is a dependency of the
// midir crate. The functions are not actually used so we provide dummy
// implementations that return an error. This file can be safely removed when
// the Linux sysroot will be updated to Debian 9 (or higher)
#include <alsa/asoundlib.h>
#if (SND_LIB_MAJOR == 1) && (SND_LIB_MINOR == 0) && (SND_LIB_SUBMINOR < 29)
extern "C" {
int snd_pcm_sw_params_set_tstamp_type(void) {
MOZ_CRASH(
"The replacement for snd_pcm_sw_params_set_tstamp_type() should never be "
"called");
return -1;
}
int snd_pcm_sw_params_get_tstamp_type(void) {
MOZ_CRASH(
"The replacement for snd_pcm_sw_params_get_tstamp_type() should never be "
"called");
return -1;
}
}
#endif

Просмотреть файл

@ -55,6 +55,9 @@ UNIFIED_SOURCES = [
include("/ipc/chromium/chromium-config.mozbuild")
if CONFIG["OS_TARGET"] == "Linux":
UNIFIED_SOURCES += ["AlsaCompatibility.cpp"]
FINAL_LIBRARY = "xul"
LOCAL_INCLUDES += [
"/dom/base",

Просмотреть файл

@ -92,7 +92,9 @@ if CONFIG['OS_TARGET'] == 'Android':
FINAL_LIBRARY = 'gkmedias'
CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
if CONFIG['MOZ_ALSA']:
CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
CFLAGS += CONFIG['MOZ_JACK_CFLAGS']
CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']

Просмотреть файл

@ -15,7 +15,8 @@ RUN /usr/local/sbin/setup_packages.sh $TASKCLUSTER_ROOT_URL $DOCKER_IMAGE_PACKAG
# libc6-i386 and lib32gcc1 are needed for wine.
# libdbus-glib-1-2 and libgtk-3-0 are needed to run xpcshell during the build.
# lib32atomic1, lib32stdc++6 and lib32z1 are needed to run some 32-bits
# spidermonkey tests.
# spidermonkey tests. libasound2 is needed to run xpcshell after we introduced
# the dependencies on alsa via Web MIDI.
RUN apt-get update && \
apt-get dist-upgrade && \
apt-get install \
@ -30,6 +31,7 @@ RUN apt-get update && \
'lib32gcc(1|-s1)$' \
lib32stdc++6 \
lib32z1 \
libasound2 \
libc6-i386 \
libdbus-glib-1-2 \
libgtk-3-0 \

Просмотреть файл

@ -31,6 +31,7 @@ esac
packages="
linux-libc-dev
libasound2-dev
libstdc++-${gcc_version}-dev
libdbus-glib-1-dev
libdrm-dev

Просмотреть файл

@ -171,12 +171,23 @@ imply_option("--enable-replace-malloc", dmd, when=compile_environment)
# ALSA cubeb backend
# ==============================================================
system_lib_option("--enable-alsa", env="MOZ_ALSA", help="Enable ALSA audio backend.")
@depends(target)
def alsa_default_check(target):
return target.kernel == "Linux" and target.os != "Android"
alsa = pkg_check_modules("MOZ_ALSA", "alsa", when="--enable-alsa")
set_config("MOZ_ALSA", depends_if(alsa)(lambda _: True))
set_define("MOZ_ALSA", depends_if(alsa)(lambda _: True))
option("--enable-alsa", env="MOZ_ALSA", help="Enable ALSA audio backend.")
@depends("--enable-alsa", alsa_default_check)
def enable_alsa_or_alsa_default_check(alsa_enabled, alsa_default_check):
return alsa_enabled or alsa_default_check
pkg_check_modules("MOZ_ALSA", "alsa", when=enable_alsa_or_alsa_default_check)
set_config("MOZ_ALSA", True, when="--enable-alsa")
set_define("MOZ_ALSA", True, when="--enable-alsa")
# JACK cubeb backend
# ==============================================================