ya.make 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. LIBRARY()
  2. LICENSE(
  3. BSD-1-Clause AND
  4. BSD-2-Clause AND
  5. BSD-3-Clause AND
  6. ISC
  7. )
  8. LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
  9. NO_COMPILER_WARNINGS()
  10. NO_UTIL()
  11. NO_RUNTIME()
  12. IF (NOT OS_WINDOWS)
  13. SRCS(
  14. string.c
  15. )
  16. ENDIF()
  17. DISABLE(PROVIDE_GETRANDOM_GETENTROPY)
  18. DISABLE(PROVIDE_REALLOCARRAY)
  19. # Android libc function appearance is documented here:
  20. # https://android.googlesource.com/platform/bionic/+/master/docs/status.md
  21. #
  22. # NB: nested IF's are needed due to the lack of lazy evaluation of logical statements: DEVTOOLS-7837
  23. IF (OS_ANDROID)
  24. SRCS(
  25. strlcat.c
  26. strlcpy.c
  27. )
  28. IF (ANDROID_API < 28)
  29. SRCS(
  30. glob.c
  31. )
  32. ENABLE(PROVIDE_GETRANDOM_GETENTROPY)
  33. ENABLE(PROVIDE_REALLOCARRAY)
  34. ENDIF()
  35. IF (ANDROID_API < 24)
  36. SRCS(
  37. ifaddrs.c
  38. )
  39. ADDINCL(
  40. GLOBAL contrib/libs/libc_compat/include/ifaddrs
  41. )
  42. ENDIF()
  43. IF (ANDROID_API < 21)
  44. SRCS(
  45. stpcpy.c
  46. )
  47. ENDIF()
  48. ENDIF()
  49. IF (OS_WINDOWS OR OS_DARWIN OR OS_IOS)
  50. SRCS(
  51. memrchr.c
  52. )
  53. ENDIF()
  54. IF (OS_DARWIN)
  55. SRCS(
  56. explicit_bzero.c
  57. )
  58. ENABLE(PROVIDE_REALLOCARRAY)
  59. ENDIF()
  60. IF (OS_WINDOWS)
  61. ADDINCL(
  62. GLOBAL contrib/libs/libc_compat/include/windows
  63. )
  64. SRCS(
  65. explicit_bzero.c
  66. stpcpy.c
  67. strlcat.c
  68. strlcpy.c
  69. strcasestr.c
  70. strsep.c
  71. src/windows/sys/uio.c
  72. )
  73. ENABLE(PROVIDE_REALLOCARRAY)
  74. ENDIF()
  75. IF (OS_LINUX)
  76. ADDINCL(
  77. GLOBAL contrib/libs/libc_compat/include/readpassphrase
  78. )
  79. SRCS(
  80. readpassphrase.c
  81. )
  82. ENDIF()
  83. IF (OS_LINUX AND NOT MUSL)
  84. IF (OS_SDK == "ubuntu-12")
  85. ADDINCL(
  86. # uchar.h was introduced in glibc=2.16
  87. GLOBAL contrib/libs/libc_compat/include/uchar
  88. )
  89. ENDIF()
  90. IF (OS_SDK == "ubuntu-12" OR OS_SDK == "ubuntu-14" OR OS_SDK == "ubuntu-16")
  91. # getrandom and getentropy were added in glibc=2.25
  92. ENABLE(PROVIDE_GETRANDOM_GETENTROPY)
  93. SRCS(
  94. # explicit_bzero was added in glibc=2.25
  95. explicit_bzero.c
  96. # memfd_create was added in glibc=2.27
  97. memfd_create.c
  98. )
  99. ENDIF()
  100. IF (OS_SDK != "ubuntu-20")
  101. # reallocarray was added in glibc=2.29
  102. ENABLE(PROVIDE_REALLOCARRAY)
  103. ENDIF()
  104. SRCS(
  105. # glibc does not offer strlcat / strlcpy yet
  106. strlcat.c
  107. strlcpy.c
  108. )
  109. IF (SANITIZER_TYPE == "memory")
  110. # llvm sanitized runtime is missing an interceptor for a buggy (getservbyname{_r}).
  111. # See: https://github.com/google/sanitizers/issues/1138
  112. ENABLE(PROVIDE_GETSERVBYNAME)
  113. ENDIF()
  114. ENDIF()
  115. IF (PROVIDE_REALLOCARRAY)
  116. SRCS(
  117. reallocarray/reallocarray.c
  118. )
  119. ADDINCL(
  120. GLOBAL contrib/libs/libc_compat/reallocarray
  121. )
  122. ENDIF()
  123. IF (PROVIDE_GETRANDOM_GETENTROPY)
  124. PEERDIR(
  125. library/cpp/sanitizer/include
  126. )
  127. SRCS(
  128. random/getrandom.c
  129. random/getentropy.c
  130. )
  131. ADDINCL(
  132. GLOBAL contrib/libs/libc_compat/random
  133. )
  134. ENDIF()
  135. IF (PROVIDE_GETSERVBYNAME)
  136. SRCS(
  137. getservbyname/getservbyname.c
  138. getservbyname/getservbyname_r.c
  139. getservbyname/lookup_serv.c
  140. )
  141. ENDIF()
  142. END()