diff --git a/components/servo/main.rs b/components/servo/main.rs index 361e0f01a750..4622040fa446 100644 --- a/components/servo/main.rs +++ b/components/servo/main.rs @@ -37,6 +37,17 @@ use servo::util::opts::{self, ArgumentParsingResult}; use servo::util::panicking::initiate_panic_hook; use std::rc::Rc; +pub mod platform { + #[cfg(target_os = "macos")] + pub use platform::macos::deinit; + + #[cfg(target_os = "macos")] + pub mod macos; + + #[cfg(not(target_os = "macos"))] + pub fn deinit() {} +} + fn main() { // Parse the command line options and store them globally let opts_result = opts::from_cmdline_args(&*args()); @@ -82,6 +93,8 @@ fn main() { }; unregister_glutin_resize_handler(&window); + + platform::deinit() } fn register_glutin_resize_handler(window: &Rc, diff --git a/components/servo/platform/macos/Info.plist b/components/servo/platform/macos/Info.plist new file mode 100644 index 000000000000..c2855eb82b4e --- /dev/null +++ b/components/servo/platform/macos/Info.plist @@ -0,0 +1,21 @@ + + + + + NSSupportsAutomaticGraphicsSwitching + + CFBundleDisplayName + Servo + CFBundlePackageType + APPL + CFBundleName + Servo + NSHumanReadableCopyright + Copyright © 2016 The Servo Authors + CFBundleVersion + 0.0.1 + CFBundleIdentifier + org.servo.servo + + + diff --git a/components/servo/platform/macos/mod.rs b/components/servo/platform/macos/mod.rs new file mode 100644 index 000000000000..b980b83f5fb8 --- /dev/null +++ b/components/servo/platform/macos/mod.rs @@ -0,0 +1,19 @@ +/* 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/. */ + +use std::ptr; + +pub fn deinit() { + // An unfortunate hack to make sure the linker's dead code stripping doesn't strip our + // `Info.plist`. + unsafe { + ptr::read_volatile(&INFO_PLIST[0]); + } +} + +#[cfg(target_os = "macos")] +#[link_section = "__TEXT,__info_plist"] +#[no_mangle] +pub static INFO_PLIST: [u8; 619] = *include_bytes!("Info.plist"); + diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index fcf51dbf3cb1..5bc64956a150 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -41,6 +41,9 @@ os.path.join(".", "tests", "wpt", "metadata", "MANIFEST.json"), os.path.join(".", "tests", "wpt", "metadata-css", "MANIFEST.json"), os.path.join(".", "components", "script", "dom", "webidls", "ForceTouchEvent.webidl"), + # FIXME(pcwalton, #11679): This is a workaround for a tidy error on the quoted string + # `"__TEXT,_info_plist"` inside an attribute. + os.path.join(".", "components", "servo", "platform", "macos", "mod.rs"), # Hidden files os.path.join(".", "."), ]