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") {
deps = [
"//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"
......
......@@ -41,43 +41,51 @@
'$(SDKROOT)/usr/lib/libbsm.dylib',
],
},
'actions': [
{
'variables': {
'generate_stubs_script': '../tools/generate_stubs/generate_stubs.py',
'generate_stubs_header_path': 'xpc_stubs_header.fragment',
'generate_stubs_sig_public_path': 'xpc_stubs.sig',
'generate_stubs_sig_private_path': 'xpc_private_stubs.sig',
'generate_stubs_project': 'sandbox/mac',
'generate_stubs_output_stem': 'xpc_stubs',
},
'action_name': 'generate_stubs',
'inputs': [
'<(generate_stubs_script)',
'<(generate_stubs_header_path)',
'<(generate_stubs_sig_public_path)',
'<(generate_stubs_sig_private_path)',
'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': [
{
'variables': {
'generate_stubs_script': '../tools/generate_stubs/generate_stubs.py',
'generate_stubs_header_path': 'xpc_stubs_header.fragment',
'generate_stubs_sig_public_path': 'xpc_stubs.sig',
'generate_stubs_sig_private_path': 'xpc_private_stubs.sig',
'generate_stubs_project': 'sandbox/mac',
'generate_stubs_output_stem': 'xpc_stubs',
},
'action_name': 'generate_stubs',
'inputs': [
'<(generate_stubs_script)',
'<(generate_stubs_header_path)',
'<(generate_stubs_sig_public_path)',
'<(generate_stubs_sig_private_path)',
],
'outputs': [
'<(INTERMEDIATE_DIR)/<(generate_stubs_output_stem).cc',
'<(SHARED_INTERMEDIATE_DIR)/<(generate_stubs_project)/<(generate_stubs_output_stem).h',
],
'action': [
'python',
'<(generate_stubs_script)',
'-i', '<(INTERMEDIATE_DIR)',
'-o', '<(SHARED_INTERMEDIATE_DIR)/<(generate_stubs_project)',
'-t', 'posix_stubs',
'-e', '<(generate_stubs_header_path)',
'-s', '<(generate_stubs_output_stem)',
'-p', '<(generate_stubs_project)',
'-x', 'SANDBOX_EXPORT',
'<(generate_stubs_sig_public_path)',
'<(generate_stubs_sig_private_path)',
],
'process_outputs_as_sources': 1,
'message': 'Generating XPC stubs for 10.6 compatability.',
},
],
'outputs': [
'<(INTERMEDIATE_DIR)/<(generate_stubs_output_stem).cc',
'<(SHARED_INTERMEDIATE_DIR)/<(generate_stubs_project)/<(generate_stubs_output_stem).h',
],
'action': [
'python',
'<(generate_stubs_script)',
'-i', '<(INTERMEDIATE_DIR)',
'-o', '<(SHARED_INTERMEDIATE_DIR)/<(generate_stubs_project)',
'-t', 'posix_stubs',
'-e', '<(generate_stubs_header_path)',
'-s', '<(generate_stubs_output_stem)',
'-p', '<(generate_stubs_project)',
'-x', 'SANDBOX_EXPORT',
'<(generate_stubs_sig_public_path)',
'<(generate_stubs_sig_private_path)',
],
'process_outputs_as_sources': 1,
'message': 'Generating XPC stubs for 10.6 compatability.',
},
}],
],
},
{
......
......@@ -7,6 +7,8 @@
namespace sandbox {
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;
path_list.push_back("/usr/lib/system/libxpc.dylib");
......@@ -15,6 +17,9 @@ bool InitializeXPC() {
path_map[sandbox_mac::kModuleXpc_private_stubs] = path_list;
return sandbox_mac::InitializeStubs(path_map);
#else
return true;
#endif
}
} // namespace sandbox
......@@ -10,19 +10,20 @@
#ifndef SANDBOX_MAC_XPC_H_
#define SANDBOX_MAC_XPC_H_
#include <AvailabilityMacros.h>
#include <mach/mach.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.
#include "sandbox/mac/xpc_stubs_header.fragment"
#if !defined(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" {
// Signatures for XPC public functions that are loaded by xpc_stubs.h.
#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