diff --git a/util/BUILD.gn b/util/BUILD.gn index 620ae255..cfa4e225 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -47,9 +47,19 @@ if (crashpad_is_mac) { args += rebase_path(outputs, root_build_dir) if (crashpad_is_in_chromium) { if (!use_system_xcode) { + import("//build/config/clang/clang.gni") + import("//build/config/mac/mac_sdk.gni") + clang_path = rebase_path("$clang_base_path/bin/", root_build_dir) + "clang" + mig_path = "$mac_bin_path" + "mig" + migcom_path = "$mac_bin_path" + "../libexec/migcom" + args += [ - "--developer-dir", - hermetic_xcode_path, + "--clang-path", + clang_path, + "--mig-path", + mig_path, + "--migcom-path", + migcom_path, ] } } diff --git a/util/mach/mig.py b/util/mach/mig.py index c2357338..ef14031c 100755 --- a/util/mach/mig.py +++ b/util/mach/mig.py @@ -26,7 +26,8 @@ def main(args): interface = mig_gen.MigInterface(parsed.user_c, parsed.server_c, parsed.user_h, parsed.server_h) mig_gen.generate_interface(parsed.defs, interface, parsed.include, - parsed.developer_dir, parsed.sdk) + parsed.sdk, parsed.clang_path, parsed.mig_path, + parsed.migcom_path) mig_fix.fix_interface(interface) if __name__ == '__main__': diff --git a/util/mach/mig_gen.py b/util/mach/mig_gen.py index d71029a4..976cd126 100755 --- a/util/mach/mig_gen.py +++ b/util/mach/mig_gen.py @@ -24,16 +24,21 @@ import sys MigInterface = collections.namedtuple('MigInterface', ['user_c', 'server_c', 'user_h', 'server_h']) -def generate_interface(defs, interface, includes=[], - developer_dir=None, sdk=None): - command = ['mig', +def generate_interface(defs, interface, includes=[], sdk=None, clang_path=None, + mig_path=None, migcom_path=None): + if mig_path is None: + mig_path = 'mig' + command = [mig_path, '-user', interface.user_c, '-server', interface.server_c, '-header', interface.user_h, '-sheader', interface.server_h, ] - if developer_dir is not None: - os.environ['DEVELOPER_DIR'] = developer_dir + + if clang_path is not None: + os.environ['MIGCC'] = clang_path + if migcom_path is not None: + os.environ['MIGCOM'] = migcom_path if sdk is not None: command.extend(['-isysroot', sdk]) for include in includes: @@ -43,7 +48,9 @@ def generate_interface(defs, interface, includes=[], def parse_args(args): parser = argparse.ArgumentParser() - parser.add_argument('--developer-dir', help='Path to Xcode') + parser.add_argument('--clang-path', help='Path to Clang') + parser.add_argument('--mig-path', help='Path to mig') + parser.add_argument('--migcom-path', help='Path to migcom') parser.add_argument('--sdk', help='Path to SDK') parser.add_argument('--include', default=[], @@ -61,7 +68,8 @@ def main(args): interface = MigInterface(parsed.user_c, parsed.server_c, parsed.user_h, parsed.server_h) generate_interface(parsed.defs, interface, parsed.include, - parsed.developer_dir, parsed.sdk) + parsed.sdk, parsed.clang_path, parsed.mig_path, + parsed.migcom_path) if __name__ == '__main__': sys.exit(main(sys.argv[1:]))