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