• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 openssl.
6config("openssl_config") {
7  include_dirs = []
8  if (cpu_arch == "x64") {
9    # Ensure the 64-bit opensslconf.h header is used in preference to the one
10    # in openssl/include.
11    include_dirs += [ "config/x64" ]
12  }
13
14  include_dirs += [ "openssl/include" ]
15}
16
17# Config internal to this build file.
18config("openssl_internal_config") {
19  visibility = ":*"  # Only targets in this file can depend on this.
20}
21
22# The list of OpenSSL files is kept in openssl.gypi. Read it.
23gypi_values = exec_script(
24    "//build/gypi_to_gn.py",
25    [ rebase_path("//third_party/openssl/openssl.gypi") ],
26    "scope",
27    [ "//third_party/openssl/openssl.gypi" ])
28
29component("openssl") {
30  sources = gypi_values.openssl_common_sources
31
32  defines = gypi_values.openssl_common_defines
33  defines += [
34    "PURIFY",
35    "MONOLITH",
36  ]
37
38  direct_dependent_configs = [ ":openssl_config" ]
39
40  cflags = []
41
42  # Also gets the include dirs from :openssl_config
43  include_dirs = [
44    ".",
45    "openssl",
46    "openssl/crypto",
47    "openssl/crypto/asn1",
48    "openssl/crypto/evp",
49    "openssl/crypto/modes",
50  ]
51
52  if (is_posix && !is_android) {
53    defines += [
54      # ENGINESDIR must be defined if OPENSSLDIR is.
55      "ENGINESDIR=\"/dev/null\"",
56      # Set to ubuntu default path for convenience. If necessary, override
57      # this at runtime with the SSL_CERT_DIR environment variable.
58      "OPENSSLDIR=\"/etc/ssl\"",
59    ]
60  }
61
62  if (cpu_arch == "x64") {
63    sources += gypi_values.openssl_x86_64_sources
64    sources -= gypi_values.openssl_x86_64_source_excludes
65    defines += gypi_values.openssl_x86_64_defines
66  } else if (cpu_arch == "x86") {
67    sources += gypi_values.openssl_x86_sources
68    sources -= gypi_values.openssl_x86_source_excludes
69    defines += gypi_values.openssl_x86_defines
70  } else if (cpu_arch == "arm") {
71    # The ARM sources do not compile with full warnings enabled.
72    configs -= [ "//build/config/compiler:chromium_code" ]
73    configs += [ "//build/config/compiler:no_chromium_code" ]
74
75    sources += gypi_values.openssl_arm_sources
76    sources -= gypi_values.openssl_arm_source_excludes
77    defines += gypi_values.openssl_arm_defines
78  } else if (cpu_arch == "mips") {
79    sources += gypi_values.openssl_mips_sources
80    sources -= gypi_values.openssl_mips_source_excludes
81    defines += gypi_values.openssl_mips_defines
82  }
83
84  if (is_clang) {
85    cflags += [
86      # OpenSSL has a few |if ((foo == NULL))| checks.
87      "-Wno-parentheses-equality",
88      # OpenSSL uses several function-style macros and then ignores the
89      # returned value.
90      "-Wno-unused-value",
91    ]
92  } else {
93    cflags += [
94      "-Wno-unused-variable",
95    ]
96  }
97}
98