feat: fix build error on apple m1

This commit is contained in:
zhengrenzhe 2021-04-24 18:00:55 +08:00
parent 3cd1121a7d
commit 7aca943d5b
3 changed files with 25 additions and 20 deletions

View file

@ -45,5 +45,5 @@ webrender_api = { git = "https://github.com/servo/webrender" }
webrender_traits = { path = "../webrender_traits" }
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64")))'.dependencies]
[target.'cfg(any(target_os="macos", all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64"))))'.dependencies]
gaol = "0.2.1"

View file

@ -4,12 +4,15 @@
use crate::pipeline::UnprivilegedPipelineContent;
use crate::serviceworker::ServiceWorkerUnprivilegedContent;
#[cfg(all(
not(target_os = "windows"),
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "arm"),
not(target_arch = "aarch64")
#[cfg(any(
target_os = "macos",
all(
not(target_os = "windows"),
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "arm"),
not(target_arch = "aarch64")
)
))]
use gaol::profile::{Operation, PathPattern, Profile};
use ipc_channel::Error;
@ -120,7 +123,9 @@ pub fn content_process_sandbox_profile() -> Profile {
target_os = "ios",
target_os = "android",
target_arch = "arm",
target_arch = "aarch64",
// exclude apple arm devices
all(target_arch = "aarch64", not(target_os = "macos"))
))]
pub fn content_process_sandbox_profile() {
error!("Sandboxed multiprocess is not supported on this platform.");

View file

@ -9,6 +9,7 @@
import os
import sys
import platform
GSTREAMER_DYLIBS = [
("gstapp", "gst-plugins-base"),
@ -117,35 +118,34 @@ def windows_plugins(uwp):
return [x + ".dll" for x in dlls]
def macos_libnice():
return os.path.join('/', 'usr', 'local', 'opt', 'libnice', 'lib')
def macos_lib_dir():
# homebrew use /opt/homebrew on macos ARM, use /usr/local on Intel
if platform.machine() == 'arm64':
return os.path.join('/', 'opt', 'homebrew', 'lib')
return os.path.join('/', 'usr', 'local', 'lib')
def macos_dylibs():
return [
os.path.join(
"/usr/local/opt",
path,
"lib",
macos_lib_dir(),
"lib" + name + "-1.0.0.dylib"
) for name, path in GSTREAMER_DYLIBS
] + [
os.path.join(macos_libnice(), "libnice.dylib"),
os.path.join(macos_libnice(), "libnice.10.dylib"),
os.path.join(macos_lib_dir(), "libnice.dylib"),
os.path.join(macos_lib_dir(), "libnice.10.dylib"),
]
def macos_plugins():
return [
os.path.join(
"/usr/local/opt",
path,
"lib",
"gstreamer-1.0",
macos_lib_dir(),
'gstreamer-1.0',
"lib" + name + ".dylib"
) for name, path in GSTREAMER_PLUGINS + MACOS_PLUGINS
] + [
os.path.join(macos_libnice(), "gstreamer-1.0", "libgstnice.dylib"),
os.path.join(macos_lib_dir(), "gstreamer-1.0", "libgstnice.dylib"),
]