blob: 749ba08cbff9c9fab8e0efca2acbffbb251ef75c [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Config for us and everybody else depending on openssl.
config("openssl_config") {
include_dirs = []
if (cpu_arch == "x64") {
# Ensure the 64-bit opensslconf.h header is used in preference to the one
# in openssl/include.
include_dirs += [ "config/x64" ]
}
include_dirs += [ "openssl/include" ]
}
# Config internal to this build file.
config("openssl_internal_config") {
visibility = ":*" # Only targets in this file can depend on this.
}
# The list of OpenSSL files is kept in openssl.gypi. Read it.
gypi_values = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("//third_party/openssl/openssl.gypi") ],
"scope",
[ "//third_party/openssl/openssl.gypi" ])
component("openssl") {
sources = gypi_values.openssl_common_sources
defines = gypi_values.openssl_common_defines
defines += [
"PURIFY",
"MONOLITH",
]
direct_dependent_configs = [ ":openssl_config" ]
cflags = []
# Also gets the include dirs from :openssl_config
include_dirs = [
".",
"openssl",
"openssl/crypto",
"openssl/crypto/asn1",
"openssl/crypto/evp",
"openssl/crypto/modes",
]
if (is_posix && !is_android) {
defines += [
# ENGINESDIR must be defined if OPENSSLDIR is.
"ENGINESDIR=\"/dev/null\"",
# Set to ubuntu default path for convenience. If necessary, override
# this at runtime with the SSL_CERT_DIR environment variable.
"OPENSSLDIR=\"/etc/ssl\"",
]
}
if (cpu_arch == "x64") {
sources += gypi_values.openssl_x86_64_sources
sources -= gypi_values.openssl_x86_64_source_excludes
defines += gypi_values.openssl_x86_64_defines
} else if (cpu_arch == "x86") {
sources += gypi_values.openssl_x86_sources
sources -= gypi_values.openssl_x86_source_excludes
defines += gypi_values.openssl_x86_defines
} else if (cpu_arch == "arm") {
# The ARM sources do not compile with full warnings enabled.
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
sources += gypi_values.openssl_arm_sources
sources -= gypi_values.openssl_arm_source_excludes
defines += gypi_values.openssl_arm_defines
} else if (cpu_arch == "mips") {
sources += gypi_values.openssl_mips_sources
sources -= gypi_values.openssl_mips_source_excludes
defines += gypi_values.openssl_mips_defines
}
if (is_clang) {
cflags += [
# OpenSSL has a few |if ((foo == NULL))| checks.
"-Wno-parentheses-equality",
# OpenSSL uses several function-style macros and then ignores the
# returned value.
"-Wno-unused-value",
]
} else {
cflags += [
"-Wno-unused-variable",
]
}
}