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
|
import os
from devtools.yamaker.project import NixProject
def post_install(self):
with self.yamakes["static"] as libaio:
# Drop sources providing libaio==0.1 ABI compatibility,
# as we build everything from the sources.
os.remove(f"{self.dstdir}/src/compat-0_1.c")
libaio.SRCS.remove("compat-0_1.c")
self.make_dll_dispatcher(
switch_flag="USE_AIO",
switch_as_enum=True,
handle_local=True,
default_local_flags={
"CFLAGS": ("USE_LOCAL_AIO_CFLAGS",),
"LDFLAGS": ("USE_LOCAL_AIO_LDFLAGS", "-laio"),
},
# It is hard to maintain both static and dynamic linkage against versioned symbols.
# We will create library with every symbol visible to the linker.
exports_script=None,
before_switch="""
IF(EXPORT_CMAKE)
OPENSOURCE_EXPORT_REPLACEMENT(
CMAKE AIO
CMAKE_TARGET AIO::aio
)
ENDIF()
""",
or_local_condition="EXPORT_CMAKE",
)
libaio = NixProject(
arcdir="contrib/libs/libaio",
nixattr="libaio",
put={
"aio": "static",
},
inclink={
"include": ["src/libaio.h"],
},
addincl_global={
"static": ["../include"],
},
copy_sources=[
"src/syscall-generic.h",
],
disable_includes=[
"syscall-alpha.h",
"syscall-arm.h",
"syscall-i386.h",
"syscall-ia64.h",
"syscall-ppc.h",
"syscall-s390.h",
"syscall-sparc.h",
],
post_install=post_install,
)
|