Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

155 Zeilen
4.1 KiB

  1. # Copyright (c) 2016, Google Inc.
  2. #
  3. # Permission to use, copy, modify, and/or distribute this software for any
  4. # purpose with or without fee is hereby granted, provided that the above
  5. # copyright notice and this permission notice appear in all copies.
  6. #
  7. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  10. # SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12. # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
  14. licenses(["notice"])
  15. exports_files(["LICENSE"])
  16. load(
  17. ":BUILD.generated.bzl",
  18. "crypto_headers",
  19. "crypto_internal_headers",
  20. "crypto_sources",
  21. "crypto_sources_linux_x86_64",
  22. "crypto_sources_mac_x86_64",
  23. "fips_fragments",
  24. "ssl_headers",
  25. "ssl_internal_headers",
  26. "ssl_sources",
  27. "tool_sources",
  28. "tool_headers",
  29. )
  30. config_setting(
  31. name = "linux_x86_64",
  32. values = {"cpu": "k8"},
  33. )
  34. config_setting(
  35. name = "mac_x86_64",
  36. values = {"cpu": "darwin"},
  37. )
  38. config_setting(
  39. name = "windows_x86_64",
  40. values = {"cpu": "x64_windows"},
  41. )
  42. config_setting(
  43. name = "android",
  44. values = {"crosstool_top": "//external:android/crosstool"}
  45. )
  46. posix_copts = [
  47. # Assembler option --noexecstack adds .note.GNU-stack to each object to
  48. # ensure that binaries can be built with non-executable stack.
  49. "-Wa,--noexecstack",
  50. # This is needed on Linux systems (at least) to get rwlock in pthread.
  51. "-D_XOPEN_SOURCE=700",
  52. # This list of warnings should match those in the top-level CMakeLists.txt.
  53. "-Wall",
  54. "-Werror",
  55. "-Wformat=2",
  56. "-Wsign-compare",
  57. "-Wmissing-field-initializers",
  58. "-Wwrite-strings",
  59. "-Wshadow",
  60. "-fno-common",
  61. # Modern build environments should be able to set this to use atomic
  62. # operations for reference counting rather than locks. However, it's
  63. # known not to work on some Android builds.
  64. # "-DOPENSSL_C11_ATOMIC",
  65. ]
  66. boringssl_copts = select({
  67. ":linux_x86_64": posix_copts,
  68. ":mac_x86_64": posix_copts,
  69. ":windows_x86_64": [
  70. "-DWIN32_LEAN_AND_MEAN",
  71. "-DOPENSSL_NO_ASM",
  72. ],
  73. "//conditions:default": ["-DOPENSSL_NO_ASM"],
  74. })
  75. crypto_sources_asm = select({
  76. ":linux_x86_64": crypto_sources_linux_x86_64,
  77. ":mac_x86_64": crypto_sources_mac_x86_64,
  78. "//conditions:default": [],
  79. })
  80. # For C targets only (not C++), compile with C11 support.
  81. posix_copts_c11 = [
  82. "-std=c11",
  83. "-Wmissing-prototypes",
  84. "-Wold-style-definition",
  85. "-Wstrict-prototypes",
  86. ]
  87. boringssl_copts_c11 = boringssl_copts + select({
  88. ":linux_x86_64": posix_copts_c11,
  89. ":mac_x86_64": posix_copts_c11,
  90. "//conditions:default": [],
  91. })
  92. # For C++ targets only (not C), compile with C++11 support.
  93. posix_copts_cxx = [
  94. "-std=c++11",
  95. "-Wmissing-declarations",
  96. ]
  97. boringssl_copts_cxx = boringssl_copts + select({
  98. ":linux_x86_64": posix_copts_cxx,
  99. ":mac_x86_64": posix_copts_cxx,
  100. "//conditions:default": [],
  101. })
  102. cc_library(
  103. name = "crypto",
  104. srcs = crypto_sources + crypto_internal_headers + crypto_sources_asm,
  105. hdrs = crypto_headers + fips_fragments,
  106. copts = boringssl_copts_c11,
  107. includes = ["src/include"],
  108. linkopts = select({
  109. ":mac_x86_64": [],
  110. # Android supports pthreads, but does not provide a libpthread
  111. # to link against.
  112. ":android": [],
  113. "//conditions:default": ["-lpthread"],
  114. }),
  115. visibility = ["//visibility:public"],
  116. )
  117. cc_library(
  118. name = "ssl",
  119. srcs = ssl_sources + ssl_internal_headers,
  120. hdrs = ssl_headers,
  121. copts = boringssl_copts_cxx,
  122. includes = ["src/include"],
  123. visibility = ["//visibility:public"],
  124. deps = [
  125. ":crypto",
  126. ],
  127. )
  128. cc_binary(
  129. name = "bssl",
  130. srcs = tool_sources + tool_headers,
  131. copts = boringssl_copts_cxx,
  132. visibility = ["//visibility:public"],
  133. deps = [":ssl"],
  134. )