Commit c1b7d352 authored by rsesek@chromium.org's avatar rsesek@chromium.org

Fix the //sandbox/mac build when using a modern (10.7+) SDK.

This doesn't use the dynamic library loader if the SDK has libxpc.dylib, and
instead just relies on libSystem to load it.

BUG=395364
R=mark@chromium.org

Review URL: https://codereview.chromium.org/403193002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284427 0039d316-1c4b-4281-b951-d872f2087c98
parent e970b62f
...@@ -28,8 +28,15 @@ component("sandbox") { ...@@ -28,8 +28,15 @@ component("sandbox") {
deps = [ deps = [
"//base", "//base",
":generate_stubs",
] ]
# When the build SDK is 10.6, generate a dynamic stub loader. When the
# SDK is higher, then libxpc.dylib will be loaded automatically as part
# of libSystem, and only forward declarations of private symbols are
# necessary.
if (mac_sdk_version == "10.6") {
deps += [ ":generate_stubs" ]
}
} }
generate_stubs_script = "//tools/generate_stubs/generate_stubs.py" generate_stubs_script = "//tools/generate_stubs/generate_stubs.py"
......
...@@ -41,6 +41,12 @@ ...@@ -41,6 +41,12 @@
'$(SDKROOT)/usr/lib/libbsm.dylib', '$(SDKROOT)/usr/lib/libbsm.dylib',
], ],
}, },
'conditions': [
# When the build SDK is 10.6, generate a dynamic stub loader. When the
# SDK is higher, then libxpc.dylib will be loaded automatically as part
# of libSystem, and only forward declarations of private symbols are
# necessary.
['mac_sdk == "10.6"', {
'actions': [ 'actions': [
{ {
'variables': { 'variables': {
...@@ -79,6 +85,8 @@ ...@@ -79,6 +85,8 @@
'message': 'Generating XPC stubs for 10.6 compatability.', 'message': 'Generating XPC stubs for 10.6 compatability.',
}, },
], ],
}],
],
}, },
{ {
'target_name': 'sandbox_mac_unittests', 'target_name': 'sandbox_mac_unittests',
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
namespace sandbox { namespace sandbox {
bool InitializeXPC() { bool InitializeXPC() {
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
std::vector<std::string> path_list; std::vector<std::string> path_list;
path_list.push_back("/usr/lib/system/libxpc.dylib"); path_list.push_back("/usr/lib/system/libxpc.dylib");
...@@ -15,6 +17,9 @@ bool InitializeXPC() { ...@@ -15,6 +17,9 @@ bool InitializeXPC() {
path_map[sandbox_mac::kModuleXpc_private_stubs] = path_list; path_map[sandbox_mac::kModuleXpc_private_stubs] = path_list;
return sandbox_mac::InitializeStubs(path_map); return sandbox_mac::InitializeStubs(path_map);
#else
return true;
#endif
} }
} // namespace sandbox } // namespace sandbox
...@@ -10,19 +10,20 @@ ...@@ -10,19 +10,20 @@
#ifndef SANDBOX_MAC_XPC_H_ #ifndef SANDBOX_MAC_XPC_H_
#define SANDBOX_MAC_XPC_H_ #define SANDBOX_MAC_XPC_H_
#include <AvailabilityMacros.h>
#include <mach/mach.h> #include <mach/mach.h>
#include "sandbox/sandbox_export.h" #include "sandbox/sandbox_export.h"
// C++ library loader.
#include "sandbox/mac/xpc_stubs.h"
// Declares XPC object types. This includes <xpc/xpc.h> if available. // Declares XPC object types. This includes <xpc/xpc.h> if available.
#include "sandbox/mac/xpc_stubs_header.fragment" #include "sandbox/mac/xpc_stubs_header.fragment"
#if !defined(MAC_OS_X_VERSION_10_7) || \ #if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
// C++ library loader.
#include "sandbox/mac/xpc_stubs.h"
extern "C" { extern "C" {
// Signatures for XPC public functions that are loaded by xpc_stubs.h. // Signatures for XPC public functions that are loaded by xpc_stubs.h.
#include "sandbox/mac/xpc_stubs.sig" #include "sandbox/mac/xpc_stubs.sig"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment