aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libc_compat/ya.make
blob: 49964fef9cc8d19ba03c186712e830b8fc29a2c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
OWNER(g:cpp-contrib)

LIBRARY()

LICENSE(
    BSD-1-Clause AND
    BSD-2-Clause AND
    BSD-3-Clause AND
    ISC
)

LICENSE_TEXTS(.yandex_meta/licenses.list.txt)

NO_COMPILER_WARNINGS()

NO_UTIL()

NO_RUNTIME()

IF (NOT OS_WINDOWS)
    SRCS(
        string.c
    )
ENDIF()

# 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
            reallocarray.c
        )
    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
        reallocarray.c
    )
ENDIF()

IF (OS_WINDOWS)
    ADDINCL(
        GLOBAL contrib/libs/libc_compat/include/windows
    )
    SRCS(
        explicit_bzero.c
        reallocarray.c
        stpcpy.c
        strlcat.c
        strlcpy.c
        strcasestr.c
        strsep.c
        src/windows/sys/uio.c
    )
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")
        ADDINCL(
            GLOBAL contrib/libs/libc_compat/include/random
        )
        SRCS(
            # explicit_bzero was added in glibc=2.25
            explicit_bzero.c
            # getrandom was added in glibc=2.25
            getrandom.c
            # memfd_create was added in glibc=2.27
            memfd_create.c
        )
    ENDIF()
    IF (OS_SDK != "ubuntu-20")
        SRCS(
            # reallocarray was added in glibc=2.29
            reallocarray.c
        )
    ENDIF()
    SRCS(
        # glibc does not offer strlcat / strlcpy yet
        strlcat.c
        strlcpy.c
    )
ENDIF()

END()