25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

147 lines
3.8 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. posix_copts = [
  43. # Assembler option --noexecstack adds .note.GNU-stack to each object to
  44. # ensure that binaries can be built with non-executable stack.
  45. "-Wa,--noexecstack",
  46. # This is needed on Linux systems (at least) to get rwlock in pthread.
  47. "-D_XOPEN_SOURCE=700",
  48. # This list of warnings should match those in the top-level CMakeLists.txt.
  49. "-Wall",
  50. "-Werror",
  51. "-Wformat=2",
  52. "-Wsign-compare",
  53. "-Wmissing-field-initializers",
  54. "-Wwrite-strings",
  55. "-Wshadow",
  56. "-fno-common",
  57. # Modern build environments should be able to set this to use atomic
  58. # operations for reference counting rather than locks. However, it's
  59. # known not to work on some Android builds.
  60. # "-DOPENSSL_C11_ATOMIC",
  61. ]
  62. boringssl_copts = select({
  63. ":linux_x86_64": posix_copts,
  64. ":mac_x86_64": posix_copts,
  65. ":windows_x86_64": [
  66. "-DWIN32_LEAN_AND_MEAN",
  67. "-DOPENSSL_NO_ASM",
  68. ],
  69. "//conditions:default": ["-DOPENSSL_NO_ASM"],
  70. })
  71. crypto_sources_asm = select({
  72. ":linux_x86_64": crypto_sources_linux_x86_64,
  73. ":mac_x86_64": crypto_sources_mac_x86_64,
  74. "//conditions:default": [],
  75. })
  76. # For C targets only (not C++), compile with C11 support.
  77. posix_copts_c11 = [
  78. "-std=c11",
  79. "-Wmissing-prototypes",
  80. "-Wold-style-definition",
  81. "-Wstrict-prototypes",
  82. ]
  83. boringssl_copts_c11 = boringssl_copts + select({
  84. ":linux_x86_64": posix_copts_c11,
  85. ":mac_x86_64": posix_copts_c11,
  86. "//conditions:default": [],
  87. })
  88. # For C++ targets only (not C), compile with C++11 support.
  89. posix_copts_cxx = [
  90. "-std=c++11",
  91. "-Wmissing-declarations",
  92. ]
  93. boringssl_copts_cxx = boringssl_copts + select({
  94. ":linux_x86_64": posix_copts_cxx,
  95. ":mac_x86_64": posix_copts_cxx,
  96. "//conditions:default": [],
  97. })
  98. cc_library(
  99. name = "crypto",
  100. srcs = crypto_sources + crypto_internal_headers + crypto_sources_asm,
  101. hdrs = crypto_headers + fips_fragments,
  102. copts = boringssl_copts_c11,
  103. includes = ["src/include"],
  104. linkopts = select({
  105. ":mac_x86_64": [],
  106. "//conditions:default": ["-lpthread"],
  107. }),
  108. visibility = ["//visibility:public"],
  109. )
  110. cc_library(
  111. name = "ssl",
  112. srcs = ssl_sources + ssl_internal_headers,
  113. hdrs = ssl_headers,
  114. copts = boringssl_copts_cxx,
  115. includes = ["src/include"],
  116. visibility = ["//visibility:public"],
  117. deps = [
  118. ":crypto",
  119. ],
  120. )
  121. cc_binary(
  122. name = "bssl",
  123. srcs = tool_sources + tool_headers,
  124. copts = boringssl_copts_cxx,
  125. visibility = ["//visibility:public"],
  126. deps = [":ssl"],
  127. )