Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: content/shell/BUILD.gn

Issue 2081733003: [Mac/GN] Load Content Shell Framework using rpath rather than executable_path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/features.gni") 5 import("//build/config/features.gni")
6 import("//build/config/sanitizers/sanitizers.gni") 6 import("//build/config/sanitizers/sanitizers.gni")
7 import("//build/config/ui.gni") 7 import("//build/config/ui.gni")
8 import("//build/config/win/console_app.gni") 8 import("//build/config/win/console_app.gni")
9 import("//build/config/win/manifest.gni") 9 import("//build/config/win/manifest.gni")
10 import("//media/media_options.gni") 10 import("//media/media_options.gni")
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 ] 448 ]
449 deps = [ 449 deps = [
450 ":content_shell_framework_bundle_data", 450 ":content_shell_framework_bundle_data",
451 ":content_shell_resources_bundle_data", 451 ":content_shell_resources_bundle_data",
452 452
453 # TODO(rsesek): Remove this after GYP is gone, since it only needs to 453 # TODO(rsesek): Remove this after GYP is gone, since it only needs to
454 # be here per the comment in blink_test_platform_support_mac.mm about 454 # be here per the comment in blink_test_platform_support_mac.mm about
455 # the bundle structure. 455 # the bundle structure.
456 "//components/test_runner:resources", 456 "//components/test_runner:resources",
457 ] 457 ]
458 ldflags = [
459 # The main app is at Content Shell.app/Contents/MacOS/Content Shell
460 # so set the rpath up to Contents/ so that the loader can find
461 # Framworks/.
462 "-rpath",
463 "@executable_path/../",
464 ]
458 info_plist_target = ":content_shell_plist" 465 info_plist_target = ":content_shell_plist"
459 } 466 }
460 } else { 467 } else {
461 # TODO(brettw) when GYP is no longer necessary, delete 468 # TODO(brettw) when GYP is no longer necessary, delete
462 # content/shell/app/shell.exe.manifest. This file is not used in GN. 469 # content/shell/app/shell.exe.manifest. This file is not used in GN.
463 executable("content_shell") { 470 executable("content_shell") {
464 testonly = true 471 testonly = true
465 472
466 # TODO(GYP) mac resource bundle stuff for this target. 473 # TODO(GYP) mac resource bundle stuff for this target.
467 sources = [ 474 sources = [
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 ":content_shell_framework_resources", 621 ":content_shell_framework_resources",
615 ":content_shell_framework_xibs", 622 ":content_shell_framework_xibs",
616 ":content_shell_lib", 623 ":content_shell_lib",
617 "//third_party/icu:icudata", 624 "//third_party/icu:icudata",
618 ] 625 ]
619 626
620 if (enable_plugins) { 627 if (enable_plugins) {
621 deps += [ ":content_shell_framework_plugins" ] 628 deps += [ ":content_shell_framework_plugins" ]
622 } 629 }
623 630
624 ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$output_name.f ramework/$output_name" ] 631 # Both the main :content_shell and :content_shell_helper_app executables
632 # need to link the framework. Because they are at different directory
633 # depths, using @executable_path as the install_name would require using
634 # install_name_tool on one of the executables. However install_name_tool
635 # only operates in-place, which is problematic to express in GN. Instead,
636 # use rpath-based loading.
637 # TODO(rsesek): After GYP is gone, re-write content_shell_main to be like
638 # chrome_main and use dlopen() instead of a linked framework.
639 ldflags = [ "-Wl,-install_name,@rpath/Frameworks/$output_name.framework/$out put_name" ]
640
641 if (is_component_build) {
642 # Set up the rpath for the framework so that it can find dylibs in the
643 # root output directory. The framework is at
644 # Content Shell.app/Contents/Frameworks/Content Shell Framework.framework/ Content Shell Framework
645 # so use loader_path to go back to the root output directory.
646 ldflags += [
647 "-rpath",
648 "@loader_path/../../../..",
649 ]
650 }
625 651
626 info_plist_target = ":content_shell_framework_plist" 652 info_plist_target = ":content_shell_framework_plist"
627 } 653 }
628 654
629 tweak_info_plist("content_shell_helper_plist") { 655 tweak_info_plist("content_shell_helper_plist") {
630 testonly = true 656 testonly = true
631 info_plist = "app/helper-Info.plist" 657 info_plist = "app/helper-Info.plist"
632 args = [ 658 args = [
633 "--breakpad=0", 659 "--breakpad=0",
634 "--keystone=0", 660 "--keystone=0",
635 "--scm=0", 661 "--scm=0",
636 "--version", 662 "--version",
637 content_shell_version, 663 content_shell_version,
638 ] 664 ]
639 } 665 }
640 666
641 mac_app_bundle("content_shell_helper_app") { 667 mac_app_bundle("content_shell_helper_app") {
642 testonly = true 668 testonly = true
643 output_name = content_shell_helper_name 669 output_name = content_shell_helper_name
644 sources = [ 670 sources = [
645 "app/shell_main.cc", 671 "app/shell_main.cc",
646 ] 672 ]
647 deps = [ 673 deps = [
648 ":content_shell_framework+link", 674 ":content_shell_framework+link",
649 ] 675 ]
650 ldflags = [ 676 ldflags = [
651 # The helper is in Content Shell.app/Contents/Frameworks/Content Shell Hel per.app/Contents/MacOS/ 677 # The helper is in Content Shell.app/Contents/Frameworks/Content Shell Hel per.app/Contents/MacOS/
652 # so set rpath up to the base. 678 # so set rpath up to Contents/ so that the loader can find Frameworks/.
653 "-rpath", 679 "-rpath",
654 "@loader_path/../../../../../..", 680 "@executable_path/../../../..",
655 ] 681 ]
656 info_plist_target = ":content_shell_helper_plist" 682 info_plist_target = ":content_shell_helper_plist"
657 } 683 }
658 684
659 # The install_name_tool can only operate in-place, rather than producing a
660 # unique output. Use the xcrun wrapper script to write a fake stamp output
661 # file. After :content_shell_helper_app has been built and bundled, this
662 # will run, modifying the executable in the bundle and writing out the
663 # --stamp specified. This will change the mtime on the executable, but
664 # because the stamp will also be updated, the
665 # :content_shell_framework_bundle_data will re-copy the output. This only
666 # works because nothing else depends on the output of
667 # :content_shell_helper_app.
668 # TODO(rsesek): After GYP is gone, re-write content_shell_main to be like
669 # chrome_main and use dlopen() instead of a linked framework.
670 action("fix_helper_link_framework") {
671 testonly = true
672 script = "//build/config/mac/xcrun.py"
673 inputs = [
674 "$root_out_dir/$content_shell_helper_name.app/Contents/MacOS/$content_shel l_helper_name",
675 ]
676
677 stamp_file = "$target_out_dir/xcrun_$target_name.stamp"
678 outputs = [
679 stamp_file,
680 ]
681
682 # TODO(rsesek): Figure out something like GYP's postbuilds to allow
683 # install_name_tool to operate in-place <https://crbug.com/607292>.
684 args = [
685 "--stamp",
686 rebase_path(stamp_file, root_build_dir),
687
688 # xcrun arguments:
689 "install_name_tool",
690 "-change",
691 "@executable_path/../Frameworks/$content_shell_framework_name.frame work/$content_shell_framework_name",
692 "@executable_path/../../../$content_shell_framework_name.framework/ $content_shell_framework_name",
693 ] + rebase_path(inputs, root_build_dir)
694 public_deps = [
695 ":content_shell_helper_app",
696 ]
697 }
698
699 bundle_data("content_shell_framework_bundle_data") { 685 bundle_data("content_shell_framework_bundle_data") {
700 testonly = true 686 testonly = true
701 sources = [ 687 sources = [
702 "$root_out_dir/$content_shell_framework_name.framework", 688 "$root_out_dir/$content_shell_framework_name.framework",
703 "$root_out_dir/$content_shell_helper_name.app", 689 "$root_out_dir/$content_shell_helper_name.app",
704 ] 690 ]
705 outputs = [ 691 outputs = [
706 "{{bundle_root_dir}}/Frameworks/{{source_file_part}}", 692 "{{bundle_root_dir}}/Frameworks/{{source_file_part}}",
707 ] 693 ]
708 public_deps = [ 694 public_deps = [
709 ":content_shell_framework+link", 695 ":content_shell_framework+link",
710 ":fix_helper_link_framework", 696 ":content_shell_helper_app",
711 ] 697 ]
712 } 698 }
713 699
714 bundle_data("content_shell_resources_bundle_data") { 700 bundle_data("content_shell_resources_bundle_data") {
715 testonly = true 701 testonly = true
716 sources = [ 702 sources = [
717 "app/app.icns", 703 "app/app.icns",
718 ] 704 ]
719 outputs = [ 705 outputs = [
720 "{{bundle_resources_dir}}/{{source_file_part}}", 706 "{{bundle_resources_dir}}/{{source_file_part}}",
721 ] 707 ]
722 } 708 }
723 } 709 }
724 710
725 mojom("mojo_bindings") { 711 mojom("mojo_bindings") {
726 sources = [ 712 sources = [
727 "common/layout_test/layout_test_bluetooth_fake_adapter_setter.mojom", 713 "common/layout_test/layout_test_bluetooth_fake_adapter_setter.mojom",
728 ] 714 ]
729 } 715 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698