Home | History | Annotate | Download | only in boringssl
      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 component("boringssl") {
     29   sources = gypi_values.boringssl_lib_sources
     30 
     31   public_configs = [ ":openssl_config" ]
     32 
     33   cflags = []
     34   defines = [
     35     "BORINGSSL_IMPLEMENTATION",
     36     "BORINGSSL_NO_STATIC_INITIALIZER",
     37   ]
     38   if (is_component_build) {
     39     defines += [
     40       "BORINGSSL_SHARED_LIBRARY",
     41     ]
     42   }
     43 
     44   configs -= [ "//build/config/compiler:chromium_code" ]
     45   configs += [ "//build/config/compiler:no_chromium_code" ]
     46 
     47   # Also gets the include dirs from :openssl_config
     48   include_dirs = [
     49     "src/include",
     50     # This is for arm_arch.h, which is needed by some asm files. Since the
     51     # asm files are generated and kept in a different directory, they
     52     # cannot use relative paths to find this file.
     53     "src/crypto",
     54   ]
     55 
     56   if (cpu_arch == "x64") {
     57     if (is_mac) {
     58       sources += gypi_values.boringssl_mac_x86_64_sources
     59     } else if (is_linux || is_android) {
     60       sources += gypi_values.boringssl_linux_x86_64_sources
     61     } else if (is_win) {
     62       sources += gypi_values.boringssl_win_x86_64_sources
     63     } else {
     64       defines += [ "OPENSSL_NO_ASM" ]
     65     }
     66   } else if (cpu_arch == "x86") {
     67     if (is_mac) {
     68       sources += gypi_values.boringssl_mac_x86_sources
     69     } else if (is_linux || is_android) {
     70       sources += gypi_values.boringssl_linux_x86_sources
     71     } else {
     72       defines += [ "OPENSSL_NO_ASM" ]
     73     }
     74   } else if (cpu_arch == "arm") {
     75     sources += gypi_values.boringssl_linux_arm_sources
     76   } else {
     77     defines += [ "OPENSSL_NO_ASM" ]
     78   }
     79 }
     80