llvm.org GIT mirror llvm / 9c2a919
[gn build] Embed __TEXT __info_plist section into clang binary on macOS Verified by comparing the output of `otool -P bin/clang` between the GN and the CMake build. Differential Revision: https://reviews.llvm.org/D55984 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349992 91177308-0d34-0410-b5e6-96231b3b80d8 Nico Weber 9 months ago
1 changed file(s) with 30 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 import("//llvm/utils/gn/build/symlink_or_copy.gni")
1 import("//llvm/version.gni")
12
23 symlinks = [
34 # target_name, symlink_target pairs: GN doesn't support '+' in rule names.
3233 }
3334 }
3435
36 if (host_os == "mac") {
37 action("write_info_plist") {
38 script = "//llvm/utils/gn/build/write_cmake_config.py"
39 sources = [
40 "Info.plist.in",
41 ]
42 outputs = [
43 "$target_gen_dir/Info.plist",
44 ]
45
46 args = [
47 "-o",
48 rebase_path(outputs[0], root_out_dir),
49 rebase_path(sources[0], root_out_dir),
50
51 "TOOL_INFO_BUILD_VERSION=$llvm_version_major.$llvm_version_minor",
52 "TOOL_INFO_NAME=clang",
53 "TOOL_INFO_UTI=org.llvm.clang",
54 "TOOL_INFO_VERSION=$llvm_version",
55 ]
56 }
57 }
58
3559 executable("clang") {
3660 configs += [ "//llvm/utils/gn/build:clang_code" ]
3761 deps = [
6084 "//llvm/lib/Transforms/Utils",
6185 "//llvm/lib/Transforms/Vectorize",
6286 ]
87 if (host_os == "mac") {
88 deps += [ ":write_info_plist" ]
89 plist = get_target_outputs(":write_info_plist")
90 ldflags = [ "-Wl,-sectcreate,__TEXT,__info_plist," +
91 rebase_path(plist[0], root_out_dir) ]
92 }
6393 sources = [
6494 "cc1_main.cpp",
6595 "cc1as_main.cpp",
6696 "cc1gen_reproducer_main.cpp",
6797 "driver.cpp",
6898 ]
69
70 # FIXME: Info.plist embedding for mac builds.
7199 }