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" } webrender_traits = { path = "../webrender_traits" }
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] } 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" gaol = "0.2.1"

View file

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

View file

@ -9,6 +9,7 @@
import os import os
import sys import sys
import platform
GSTREAMER_DYLIBS = [ GSTREAMER_DYLIBS = [
("gstapp", "gst-plugins-base"), ("gstapp", "gst-plugins-base"),
@ -117,35 +118,34 @@ def windows_plugins(uwp):
return [x + ".dll" for x in dlls] return [x + ".dll" for x in dlls]
def macos_libnice(): def macos_lib_dir():
return os.path.join('/', 'usr', 'local', 'opt', 'libnice', 'lib') # 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(): def macos_dylibs():
return [ return [
os.path.join( os.path.join(
"/usr/local/opt", macos_lib_dir(),
path,
"lib",
"lib" + name + "-1.0.0.dylib" "lib" + name + "-1.0.0.dylib"
) for name, path in GSTREAMER_DYLIBS ) for name, path in GSTREAMER_DYLIBS
] + [ ] + [
os.path.join(macos_libnice(), "libnice.dylib"), os.path.join(macos_lib_dir(), "libnice.dylib"),
os.path.join(macos_libnice(), "libnice.10.dylib"), os.path.join(macos_lib_dir(), "libnice.10.dylib"),
] ]
def macos_plugins(): def macos_plugins():
return [ return [
os.path.join( os.path.join(
"/usr/local/opt", macos_lib_dir(),
path, 'gstreamer-1.0',
"lib",
"gstreamer-1.0",
"lib" + name + ".dylib" "lib" + name + ".dylib"
) for name, path in GSTREAMER_PLUGINS + MACOS_PLUGINS ) 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"),
] ]