Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / boringssl / BUILD.gn
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
3 # found in the LICENSE file.
4
5 # Config for us and everybody else depending on BoringSSL.
6 config("openssl_config") {
7   include_dirs = []
8   include_dirs += [ "src/include" ]
9   if (is_component_build) {
10     defines = [
11       "BORINGSSL_SHARED_LIBRARY",
12     ]
13   }
14 }
15
16 # Config internal to this build file.
17 config("openssl_internal_config") {
18   visibility = [ ":*" ]  # Only targets in this file can depend on this.
19 }
20
21 # The list of BoringSSL files is kept in boringssl.gypi.
22 gypi_values = exec_script(
23     "//build/gypi_to_gn.py",
24     [ rebase_path("//third_party/boringssl/boringssl.gypi") ],
25     "scope",
26     [ "//third_party/boringssl/boringssl.gypi" ])
27
28 # Windows' assembly is built with Yasm. The other platforms use the platform
29 # assembler.
30 if (is_win) {
31   import("//third_party/yasm/yasm_assemble.gni")
32   yasm_assemble("boringssl_asm") {
33     if (cpu_arch == "x64") {
34       sources = gypi_values.boringssl_win_x86_64_sources
35     } else if (cpu_arch == "x86") {
36       sources = gypi_values.boringssl_win_x86_sources
37     }
38   }
39 }
40
41 component("boringssl") {
42   sources = gypi_values.boringssl_lib_sources
43
44   public_configs = [ ":openssl_config" ]
45
46   cflags = []
47   defines = [
48     "BORINGSSL_IMPLEMENTATION",
49     "BORINGSSL_NO_STATIC_INITIALIZER",
50   ]
51   if (is_component_build) {
52     defines += [
53       "BORINGSSL_SHARED_LIBRARY",
54     ]
55   }
56
57   configs -= [ "//build/config/compiler:chromium_code" ]
58   configs += [ "//build/config/compiler:no_chromium_code" ]
59
60   # Also gets the include dirs from :openssl_config
61   include_dirs = [
62     "src/include",
63     # This is for arm_arch.h, which is needed by some asm files. Since the
64     # asm files are generated and kept in a different directory, they
65     # cannot use relative paths to find this file.
66     "src/crypto",
67   ]
68
69   if (is_win) {
70     # TODO(davidben): Fix size_t truncations in BoringSSL.
71     # https://crbug.com/429039
72     cflags += [ "/wd4267"]
73   }
74
75   if (cpu_arch == "x64") {
76     if (is_mac) {
77       sources += gypi_values.boringssl_mac_x86_64_sources
78     } else if (is_linux || is_android) {
79       sources += gypi_values.boringssl_linux_x86_64_sources
80     } else if (is_win) {
81       deps += [ ":boringssl_asm" ]
82     } else {
83       defines += [ "OPENSSL_NO_ASM" ]
84     }
85   } else if (cpu_arch == "x86") {
86     if (is_mac) {
87       sources += gypi_values.boringssl_mac_x86_sources
88     } else if (is_linux || is_android) {
89       sources += gypi_values.boringssl_linux_x86_sources
90     } else if (is_win) {
91       deps += [ ":boringssl_asm" ]
92     } else {
93       defines += [ "OPENSSL_NO_ASM" ]
94     }
95   } else if (cpu_arch == "arm") {
96     sources += gypi_values.boringssl_linux_arm_sources
97   } else {
98     defines += [ "OPENSSL_NO_ASM" ]
99   }
100 }