aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libc_compat/ya.make
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
committeralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
commitbf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0 (patch)
tree1d1df72c0541a59a81439842f46d95396d3e7189 /contrib/libs/libc_compat/ya.make
parent8bfdfa9a9bd19bddbc58d888e180fbd1218681be (diff)
downloadydb-bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0.tar.gz
add ymake export to ydb
Diffstat (limited to 'contrib/libs/libc_compat/ya.make')
-rw-r--r--contrib/libs/libc_compat/ya.make158
1 files changed, 158 insertions, 0 deletions
diff --git a/contrib/libs/libc_compat/ya.make b/contrib/libs/libc_compat/ya.make
new file mode 100644
index 0000000000..42e1116d45
--- /dev/null
+++ b/contrib/libs/libc_compat/ya.make
@@ -0,0 +1,158 @@
+LIBRARY()
+
+LICENSE(
+ BSD-1-Clause AND
+ BSD-2-Clause AND
+ BSD-3-Clause AND
+ ISC
+)
+
+LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
+
+NO_SANITIZE_HEADERS()
+
+NO_COMPILER_WARNINGS()
+
+NO_UTIL()
+
+NO_RUNTIME()
+
+IF (NOT OS_WINDOWS)
+ SRCS(
+ string.c
+ )
+ENDIF()
+
+DISABLE(PROVIDE_GETRANDOM_GETENTROPY)
+DISABLE(PROVIDE_REALLOCARRAY)
+
+# Android libc function appearance is documented here:
+# https://android.googlesource.com/platform/bionic/+/master/docs/status.md
+#
+# NB: nested IF's are needed due to the lack of lazy evaluation of logical statements: DEVTOOLS-7837
+IF (OS_ANDROID)
+ SRCS(
+ strlcat.c
+ strlcpy.c
+ )
+ IF (ANDROID_API < 28)
+ SRCS(
+ glob.c
+ )
+ ENABLE(PROVIDE_REALLOCARRAY)
+ ENDIF()
+ IF (ANDROID_API < 24)
+ SRCS(
+ ifaddrs.c
+ )
+ ADDINCL(
+ GLOBAL contrib/libs/libc_compat/include/ifaddrs
+ )
+ ENDIF()
+ IF (ANDROID_API < 21)
+ SRCS(
+ stpcpy.c
+ )
+ ENDIF()
+ENDIF()
+
+IF (OS_WINDOWS OR OS_DARWIN OR OS_IOS)
+ SRCS(
+ memrchr.c
+ )
+ENDIF()
+
+IF (OS_DARWIN)
+ SRCS(
+ explicit_bzero.c
+ )
+ ENABLE(PROVIDE_REALLOCARRAY)
+ENDIF()
+
+IF (OS_WINDOWS)
+ ADDINCL(
+ GLOBAL contrib/libs/libc_compat/include/windows
+ )
+ SRCS(
+ explicit_bzero.c
+ stpcpy.c
+ strlcat.c
+ strlcpy.c
+ strcasestr.c
+ strsep.c
+ src/windows/sys/uio.c
+ )
+ ENABLE(PROVIDE_REALLOCARRAY)
+ENDIF()
+
+IF (OS_LINUX)
+ ADDINCL(
+ GLOBAL contrib/libs/libc_compat/include/readpassphrase
+ )
+ SRCS(
+ readpassphrase.c
+ )
+ENDIF()
+
+IF (OS_LINUX AND NOT MUSL)
+ IF (OS_SDK == "ubuntu-12")
+ ADDINCL(
+ # uchar.h was introduced in glibc=2.16
+ GLOBAL contrib/libs/libc_compat/include/uchar
+ )
+ ENDIF()
+ IF (OS_SDK == "ubuntu-12" OR OS_SDK == "ubuntu-14" OR OS_SDK == "ubuntu-16")
+ # getrandom and getentropy were added in glibc=2.25
+ ENABLE(PROVIDE_GETRANDOM_GETENTROPY)
+
+ SRCS(
+ # explicit_bzero was added in glibc=2.25
+ explicit_bzero.c
+ # memfd_create was added in glibc=2.27
+ memfd_create.c
+ )
+ ENDIF()
+ IF (OS_SDK != "ubuntu-20")
+ # reallocarray was added in glibc=2.29
+ ENABLE(PROVIDE_REALLOCARRAY)
+ ENDIF()
+ SRCS(
+ # glibc does not offer strlcat / strlcpy yet
+ strlcat.c
+ strlcpy.c
+ )
+ IF (SANITIZER_TYPE == "memory")
+ # llvm sanitized runtime is missing an interceptor for a buggy (getservbyname{_r}).
+ # See: https://github.com/google/sanitizers/issues/1138
+ ENABLE(PROVIDE_GETSERVBYNAME)
+ ENDIF()
+ENDIF()
+
+IF (PROVIDE_REALLOCARRAY)
+ SRCS(
+ reallocarray/reallocarray.c
+ )
+ ADDINCL(
+ ONE_LEVEL contrib/libs/libc_compat/reallocarray
+ )
+ENDIF()
+
+IF (PROVIDE_GETRANDOM_GETENTROPY)
+ SRCS(
+ random/getrandom.c
+ random/getentropy.c
+ )
+ ADDINCL(
+ ONE_LEVEL contrib/libs/libc_compat/random
+ )
+ENDIF()
+
+IF (PROVIDE_GETSERVBYNAME)
+ SRCS(
+ getservbyname/getservbyname.c
+ getservbyname/getservbyname_r.c
+ getservbyname/lookup_serv.c
+ )
+ENDIF()
+
+END()