Auto merge of #28388 - zhengrenzhe:master, r=jdm

support Apple ARM base mac build and run

<!-- Please describe your changes on the following line: -->
i fixed build errors on apple m1 macbook, build and running both successful, but because of this issue: https://github.com/servo/surfman/issues/226, the surfman version must be updated locally by cargo [patch.crates-io]. so this pr is waiting for surfman release new version, and related dependencies update the surfman version.

@jdm

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2021-04-24 14:31:13 -04:00 committed by GitHub
commit 50f8e664ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 23 deletions

5
Cargo.lock generated
View file

@ -6148,9 +6148,9 @@ dependencies = [
[[package]] [[package]]
name = "surfman" name = "surfman"
version = "0.4.0" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84898d7f74abdd4b956334d71d1ddf60e63bff8fd2fa6c91be8653d50d30cbf3" checksum = "bbbf3b7f873f25cb7791b06a00f0626a141c05f1b95e5b34bc498358876e1a58"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg_aliases", "cfg_aliases",
@ -6169,6 +6169,7 @@ dependencies = [
"metal 0.18.0", "metal 0.18.0",
"objc", "objc",
"parking_lot 0.10.2", "parking_lot 0.10.2",
"raw-window-handle",
"wayland-sys 0.24.1", "wayland-sys 0.24.1",
"winapi", "winapi",
"winit", "winit",

View file

@ -54,7 +54,7 @@ Please select your operating system:
Xcode version 10.2 or above is recommended. Xcode version 10.2 or above is recommended.
##### On macOS (Homebrew) ##### On macOS(Intel based or ARM based) (Homebrew)
NOTE: run these steps after you've cloned the project locally. NOTE: run these steps after you've cloned the project locally.

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"),
] ]