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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
import os.path as P
from devtools.yamaker.fileutil import subcopy
from devtools.yamaker.modules import Linkable, Switch
from devtools.yamaker.project import NixProject
def post_install(self):
def d(s):
return self.dstdir + "/" + s
# Move asm sources to asm/linux.
subcopy(self.dstdir, d("asm/linux"), ["**/*.s"], move=True)
with self.yamakes["crypto"] as m:
asm = {s for s in m.SRCS if s.endswith(".s")}
m.SRCS -= asm
m.after(
"SRCS",
Switch(
dict(
{
"OS_LINUX AND ARCH_X86_64": Linkable(
SRCS={"../asm/linux/" + s for s in asm},
)
}
)
),
)
# Shorten paths.
m.SRCDIR = []
m.SRCS = {P.relpath(s, "crypto") for s in m.SRCS}
m.SRCS -= {"dso/dso_dlfcn.c", "rand/rand_vms.c"}
# Add suppression for ubsan, see also https://github.com/openssl/openssl/issues/22896
with self.yamakes["crypto"] as m:
m.after("NO_RUNTIME", "SUPPRESSIONS(ubsan.supp)")
self.yamakes["crypto"].PEERDIR.add("library/cpp/sanitizer/include")
self.yamakes["apps"].PEERDIR.add("library/cpp/sanitizer/include")
with self.yamakes["."] as m:
m.after(
"ORIGINAL_SOURCE",
"""IF (OPENSOURCE_REPLACE_OPENSSL AND EXPORT_CMAKE)
OPENSOURCE_EXPORT_REPLACEMENT(
CMAKE OpenSSL
CMAKE_TARGET OpenSSL::OpenSSL
CONAN openssl/${OPENSOURCE_REPLACE_OPENSSL}
)
ELSE()
ADDINCL(
GLOBAL contrib/libs/openssl/include
)
ENDIF()
""",
)
m.ADDINCL = []
with self.yamakes["crypto"] as m:
m.after(
"LICENSE_TEXTS",
"""IF (OPENSOURCE_REPLACE_OPENSSL)
OPENSOURCE_EXPORT_REPLACEMENT(
CMAKE OpenSSL
CMAKE_PACKAGE_COMPONENT Crypto
CMAKE_TARGET OpenSSL::Crypto
CONAN openssl/${OPENSOURCE_REPLACE_OPENSSL}
)
ENDIF() # IF (OPENSOURCE_REPLACE_OPENSSL)
""",
)
m.ADDINCL = []
openssl = NixProject(
license="OpenSSL AND SSLeay",
owners=["g:cpp-contrib"],
arcdir="contrib/libs/openssl",
nixattr="openssl",
ignore_commands=["bash", "perl"],
put_with={"openssl": ["apps"]},
install_targets=["crypto", "openssl", "ssl"],
put={"ssl": "."},
disable_includes=[
"efndef.h",
"iosbdef.h",
"rmidef.h",
"sys/ldr.h",
# if defined(OPENSSL_SYS_VXWORKS)
"ioLib.h",
"sockLib.h",
"sysLib.h",
"taskLib.h",
"tickLib.h",
"vxWorks.h",
# if defined(OPENSSL_SYS_VMS)
"descrip.h",
"dvidef.h",
"gen64def.h",
"iledef.h",
"iodef.h",
"jpidef.h",
"lib$routines.h",
"libfildef.h",
"libfisdef.h",
"rms.h",
"rmsdef.h",
"times.h",
"ssdef.h",
"starlet.h",
"str$routines.h",
"stsdef.h",
"syidef.h",
"unixio.h",
],
copy_sources=[
"apps/**/*.c",
"apps/**/*.h",
"crypto/**/*.asm",
"crypto/**/*.c",
"crypto/**/*.h",
"engines/**/*.c",
"engines/**/*.h",
"include/**/*.h",
],
platform_dispatchers=[
"apps/progs.h",
"crypto/buildinf.h",
"include/crypto/bn_conf.h",
"include/crypto/dso_conf.h",
"include/openssl/opensslconf.h",
],
keep_paths=[
"asm/aarch64/",
"asm/android/",
"asm/darwin/",
"asm/darwin-arm64/",
"asm/ios/",
"asm/ppc64le/",
"asm/windows/",
"openssl.package.json",
"sanitizers.h",
"crypto/ubsan.supp",
],
post_install=post_install,
)
|