aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libevent/.yandex_meta/__init__.py
blob: 71462737f0795b86aa91c2c16748d377ac28cbe3 (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
128
129
130
131
132
133
134
135
import os
import os.path
import shutil

from devtools.yamaker.modules import Linkable, Switch
from devtools.yamaker.project import GNUMakeNixProject


def libevent_post_install(self):
    own_compat = os.path.join(self.arcdir, "compat")
    for p, m in self.yamakes.items():
        if own_compat in m.ADDINCL:
            m.ADDINCL.remove(own_compat)
        m.PEERDIR.add("contrib/libs/libc_compat")
        m.CFLAGS.append("-DEVENT__HAVE_STRLCPY=1")

    shutil.rmtree(os.path.join(self.dstdir, "compat"))
    os.remove(os.path.join(self.dstdir, "strlcpy.c"))

    with self.yamakes["event_core"] as m:
        m.SRCS -= {"epoll.c", "poll.c", "select.c", "strlcpy.c"}

        m.after(
            "SRCS",
            Switch(
                OS_WINDOWS=Linkable(
                    SRCS=[
                        "buffer_iocp.c",
                        "bufferevent_async.c",
                        "event_iocp.c",
                        "win32select.c",
                    ],
                ),
                default=Linkable(
                    SRCS=[
                        "poll.c",
                        "select.c",
                    ],
                ),
            ),
        )
        m.after(
            "SRCS",
            Switch(
                OS_LINUX=Linkable(
                    SRCS=["epoll.c"],
                )
            ),
        )
        m.after(
            "SRCS",
            Switch(
                {
                    "OS_FREEBSD OR OS_DARWIN": Linkable(
                        SRCS=["kqueue.c"],
                    )
                }
            ),
        )

    with self.yamakes["event_thread"] as m:
        orig_srcs = m.SRCS
        m.SRCS = {}
        m.after(
            "SRCS",
            Switch(
                OS_WINDOWS=Linkable(
                    SRCS=["evthread_win32.c"],
                ),
                default=Linkable(SRCS=orig_srcs),
            ),
        )

    with self.yamakes["."] as m:
        m.SRCS = {}
        m.PEERDIR = [
            os.path.join(self.arcdir, p)
            for p in (
                "event_core",
                "event_extra",
                "event_openssl",
                "event_thread",
            )
        ]


libevent = GNUMakeNixProject(
    owners=["g:cpp-contrib", "kikht", "dldmitry", "efmv"],
    arcdir="contrib/libs/libevent",
    nixattr="libevent",
    ignore_commands=["bash", "sed"],
    license="BSD-3-Clause",
    copy_sources=[
        "include/**/*.h",
        "*.c",
        "*.h",
        "whatsnew-2.0.txt",
    ],
    put={
        "event-2.1": ".",
        "event_core-2.1": "event_core",
        "event_extra-2.1": "event_extra",
        "event_pthreads-2.1": "event_thread",
        "event_openssl-2.1": "event_openssl",
    },
    ignore_targets={
        "bench",
        "bench_cascade",
        "bench_http",
        "bench_httpclient",
        "dns-example",
        "event-read-fifo",
        "hello-world",
        "http-connect",
        "http-server",
        "https-client",
        "le-proxy",
        "regress",
        "signal-test",
        "test-changelist",
        "test-closed",
        "test-dumpevents",
        "test-eof",
        "test-fdleak",
        "test-init",
        "test-ratelim",
        "test-time",
        "test-weof",
        "time-test",
    },
    platform_dispatchers=["include/event2/event-config.h"],
    addincl_global={".": {"./include"}},
    post_install=libevent_post_install,
    disable_includes=["afunix.h", "netinet/in6.h", "vproc.h"],
)