OLD | NEW |
---|---|
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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/clang/clang.gni") | |
5 import("//build/config/ios/ios_sdk.gni") | 6 import("//build/config/ios/ios_sdk.gni") |
6 import("//build/config/mac/base_rules.gni") | 7 import("//build/config/mac/base_rules.gni") |
7 import("//build/config/mac/symbols.gni") | 8 import("//build/config/mac/symbols.gni") |
9 import("//build/config/sanitizers/sanitizers.gni") | |
8 | 10 |
9 # Invokes lipo on multiple arch-specific binaries to create a fat binary. | 11 # Invokes lipo on multiple arch-specific binaries to create a fat binary. |
10 # | 12 # |
11 # Arguments | 13 # Arguments |
12 # | 14 # |
13 # arch_binary_target | 15 # arch_binary_target |
14 # name of the target generating the arch-specific binaries, they must | 16 # name of the target generating the arch-specific binaries, they must |
15 # be named $target_out_dir/$toolchain_cpu/$arch_binary_output. | 17 # be named $target_out_dir/$toolchain_cpu/$arch_binary_output. |
16 # | 18 # |
17 # arch_binary_output | 19 # arch_binary_output |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 # bundle_binary_target | 140 # bundle_binary_target |
139 # string, label of the target generating the bundle main binary. | 141 # string, label of the target generating the bundle main binary. |
140 # | 142 # |
141 # bundle_binary_output | 143 # bundle_binary_output |
142 # (optional) string, base name of the binary generated by the | 144 # (optional) string, base name of the binary generated by the |
143 # bundle_binary_target target, defaults to the target name. | 145 # bundle_binary_target target, defaults to the target name. |
144 # | 146 # |
145 # extra_system_frameworks | 147 # extra_system_frameworks |
146 # (optional) list of system framework to copy to the bundle. | 148 # (optional) list of system framework to copy to the bundle. |
147 # | 149 # |
150 # extra_system_libraries | |
151 # (optional) list of system libraries to copy to the bundle. | |
152 # | |
148 # enable_code_signing | 153 # enable_code_signing |
149 # (optional) boolean, control whether code signing is enabled or not, | 154 # (optional) boolean, control whether code signing is enabled or not, |
150 # default to ios_enable_code_signing if not defined. | 155 # default to ios_enable_code_signing if not defined. |
151 # | 156 # |
152 template("create_signed_bundle") { | 157 template("create_signed_bundle") { |
153 assert(defined(invoker.product_type), | 158 assert(defined(invoker.product_type), |
154 "product_type must be defined for $target_name") | 159 "product_type must be defined for $target_name") |
155 assert(defined(invoker.bundle_extension), | 160 assert(defined(invoker.bundle_extension), |
156 "bundle_extension must be defined for $target_name") | 161 "bundle_extension must be defined for $target_name") |
157 assert(defined(invoker.bundle_binary_target), | 162 assert(defined(invoker.bundle_binary_target), |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 code_signing_outputs += [ "$_bundle_root_dir/embedded.mobileprovision" ] | 232 code_signing_outputs += [ "$_bundle_root_dir/embedded.mobileprovision" ] |
228 } | 233 } |
229 | 234 |
230 if (defined(invoker.extra_system_frameworks)) { | 235 if (defined(invoker.extra_system_frameworks)) { |
231 foreach(_framework, invoker.extra_system_frameworks) { | 236 foreach(_framework, invoker.extra_system_frameworks) { |
232 code_signing_outputs += [ "$bundle_root_dir/Frameworks/" + | 237 code_signing_outputs += [ "$bundle_root_dir/Frameworks/" + |
233 get_path_info(_framework, "file") ] | 238 get_path_info(_framework, "file") ] |
234 } | 239 } |
235 } | 240 } |
236 | 241 |
242 if (defined(invoker.extra_system_libraries)) { | |
243 foreach(_library, invoker.extra_system_libraries) { | |
244 code_signing_outputs += | |
245 [ "$bundle_root_dir/" + get_path_info(_library, "file") ] | |
246 } | |
247 } | |
248 | |
237 code_signing_args = [ | 249 code_signing_args = [ |
238 "code-sign-bundle", | 250 "code-sign-bundle", |
239 "-t=" + ios_sdk_name, | 251 "-t=" + ios_sdk_name, |
240 "-i=" + ios_code_signing_identity, | 252 "-i=" + ios_code_signing_identity, |
241 "-e=" + rebase_path(_entitlements_path, root_build_dir), | 253 "-e=" + rebase_path(_entitlements_path, root_build_dir), |
242 "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir), | 254 "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir), |
243 rebase_path(bundle_root_dir, root_build_dir), | 255 rebase_path(bundle_root_dir, root_build_dir), |
244 ] | 256 ] |
245 if (!_enable_code_signing) { | 257 if (!_enable_code_signing) { |
246 code_signing_args += [ "--disable-code-signature" ] | 258 code_signing_args += [ "--disable-code-signature" ] |
247 } | 259 } |
248 if (defined(invoker.extra_system_frameworks)) { | 260 if (defined(invoker.extra_system_frameworks)) { |
249 # All framework in extra_system_frameworks are expected to be | 261 # All framework in extra_system_frameworks are expected to be |
250 # system framework and the path to be already system absolute | 262 # system framework and the path to be already system absolute |
251 # so do not use rebase_path here. | 263 # so do not use rebase_path here. |
252 foreach(_framework, invoker.extra_system_frameworks) { | 264 foreach(_framework, invoker.extra_system_frameworks) { |
253 code_signing_args += [ "-F=" + _framework ] | 265 code_signing_args += [ "-F=" + _framework ] |
254 } | 266 } |
255 } | 267 } |
268 if (defined(invoker.extra_system_libraries)) { | |
269 # All libraries in extra_system_libraries are expected to be | |
270 # system libraries and the path to be already system absolute | |
271 # so do not use rebase_path here. | |
272 foreach(_library, invoker.extra_system_libraries) { | |
273 code_signing_args += [ "-L=" + _library ] | |
274 } | |
275 } | |
256 } | 276 } |
257 } | 277 } |
258 | 278 |
259 # Generates Info.plist files for Mac apps and frameworks. | 279 # Generates Info.plist files for Mac apps and frameworks. |
260 # | 280 # |
261 # Arguments | 281 # Arguments |
262 # | 282 # |
263 # info_plist: | 283 # info_plist: |
264 # (optional) string, path to the Info.plist file that will be used for | 284 # (optional) string, path to the Info.plist file that will be used for |
265 # the bundle. | 285 # the bundle. |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
598 data_deps += [ "//testing/iossim" ] | 618 data_deps += [ "//testing/iossim" ] |
599 } | 619 } |
600 | 620 |
601 if (!defined(product_type)) { | 621 if (!defined(product_type)) { |
602 product_type = "com.apple.product-type.application" | 622 product_type = "com.apple.product-type.application" |
603 } | 623 } |
604 | 624 |
605 if (!defined(bundle_extension)) { | 625 if (!defined(bundle_extension)) { |
606 bundle_extension = ".app" | 626 bundle_extension = ".app" |
607 } | 627 } |
628 | |
629 if (using_sanitizer) { | |
630 if (!defined(extra_system_libraries)) { | |
631 extra_system_libraries = [] | |
632 } | |
633 extra_system_libraries += | |
634 [ rebase_path("$clang_base_path/lib/clang/$clang_version/lib/" + | |
635 "darwin/libclang_rt.asan_iossim_dynamic.dylib", | |
justincohen
2016/09/26 15:14:02
does this change if we are building with Xcode cla
sdefresne
2016/09/26 15:20:43
Yes, it will probably change, though we currently
justincohen
2016/09/26 16:09:00
I think at least a comment explaining this won't w
| |
636 root_build_dir) ] | |
637 } | |
608 } | 638 } |
609 } | 639 } |
610 } | 640 } |
611 | 641 |
612 set_defaults("ios_app_bundle") { | 642 set_defaults("ios_app_bundle") { |
613 configs = default_executable_configs | 643 configs = default_executable_configs |
614 } | 644 } |
615 | 645 |
616 # Template to build an application extension bundle for iOS. | 646 # Template to build an application extension bundle for iOS. |
617 # | 647 # |
(...skipping 27 matching lines...) Expand all Loading... | |
645 ios_app_bundle(target_name) { | 675 ios_app_bundle(target_name) { |
646 forward_variables_from(invoker, | 676 forward_variables_from(invoker, |
647 "*", | 677 "*", |
648 [ | 678 [ |
649 "bundle_extension", | 679 "bundle_extension", |
650 "product_type", | 680 "product_type", |
651 ]) | 681 ]) |
652 bundle_extension = ".appex" | 682 bundle_extension = ".appex" |
653 product_type = "com.apple.product-type.app-extension" | 683 product_type = "com.apple.product-type.app-extension" |
654 | 684 |
685 # The application extensions use the same runtime library as their main | |
686 # application, so filter the bundle deps from the application extension | |
687 # bundle. | |
688 if (using_sanitizer) { | |
689 if (!defined(bundle_deps_filter)) { | |
690 bundle_deps_filter = [] | |
691 } | |
692 bundle_deps_filter += | |
693 [ "//build/config/sanitizers:asan_runtime_bundle_data" ] | |
694 } | |
695 | |
655 # Add linker flags required for an application extension (determined by | 696 # Add linker flags required for an application extension (determined by |
656 # inspecting the link command-line when using Xcode 9.0+). | 697 # inspecting the link command-line when using Xcode 9.0+). |
657 if (!defined(ldflags)) { | 698 if (!defined(ldflags)) { |
658 ldflags = [] | 699 ldflags = [] |
659 } | 700 } |
660 ldflags += [ | 701 ldflags += [ |
661 "-e", | 702 "-e", |
662 "_NSExtensionMain", | 703 "_NSExtensionMain", |
663 "-fapplication-extension", | 704 "-fapplication-extension", |
664 ] | 705 ] |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1341 "-rpath", | 1382 "-rpath", |
1342 "-Xlinker", | 1383 "-Xlinker", |
1343 "@loader_path/Frameworks", | 1384 "@loader_path/Frameworks", |
1344 ] | 1385 ] |
1345 } | 1386 } |
1346 } | 1387 } |
1347 | 1388 |
1348 set_defaults("ios_xctest_test") { | 1389 set_defaults("ios_xctest_test") { |
1349 configs = default_executable_configs | 1390 configs = default_executable_configs |
1350 } | 1391 } |
OLD | NEW |