VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.3/Config.kmk@ 95338

Last change on this file since 95338 was 95261, checked in by vboxsync, 3 years ago

libs/openssl-3.0.3: Copy over an additional header required for curl-7.83.1, bugref:8515

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.5 KB
Line 
1# $Id: Config.kmk 95261 2022-06-13 16:29:49Z vboxsync $
2## @file
3# OpenSSL kBuild Configuration file.
4#
5
6#
7# Copyright (C) 2006-2022 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18# Include the top-level configure file.
19ifndef VBOX_ROOT_CONFIG_KMK_INCLUDED
20 include $(PATH_ROOT)/Config.kmk
21endif
22
23# Figure out openssl perl asm style for the target
24VBOX_CRYPTO_ASM_SCHEME := portme
25if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
26 VBOX_CRYPTO_ASM_SCHEME := elf
27else ifeq ($(KBUILD_TARGET), darwin)
28 VBOX_CRYPTO_ASM_SCHEME := macosx
29else ifeq ($(KBUILD_TARGET), win)
30 VBOX_CRYPTO_ASM_SCHEME := nasm
31endif
32
33# Can't use relative paths when dealing with sub-makefiles.
34VBOX_PATH_OPENSSL := $(PATH_ROOT)/src/libs/openssl-3.0.3
35VBOX_PATH_CRYPTO := $(VBOX_PATH_OPENSSL)/crypto
36VBOX_PATH_CRYPTO_GENASM := $(VBOX_PATH_CRYPTO)/genasm-$(VBOX_CRYPTO_ASM_SCHEME)
37VBOX_PATH_CRYPTO_AES := $(VBOX_PATH_CRYPTO)/aes
38VBOX_PATH_CRYPTO_BN := $(VBOX_PATH_CRYPTO)/bn
39VBOX_PATH_CRYPTO_CHACHA := $(VBOX_PATH_CRYPTO)/chacha
40VBOX_PATH_CRYPTO_EC := $(VBOX_PATH_CRYPTO)/ec
41VBOX_PATH_CRYPTO_MD5 := $(VBOX_PATH_CRYPTO)/md5
42VBOX_PATH_CRYPTO_MODES := $(VBOX_PATH_CRYPTO)/modes
43VBOX_PATH_CRYPTO_POLY1305 := $(VBOX_PATH_CRYPTO)/poly1305
44VBOX_PATH_CRYPTO_RC4 := $(VBOX_PATH_CRYPTO)/rc4
45VBOX_PATH_CRYPTO_SHA := $(VBOX_PATH_CRYPTO)/sha
46VBOX_PATH_CRYPTO_DES := $(VBOX_PATH_CRYPTO)/des
47VBOX_PATH_CRYPTO_CAMELLIA := $(VBOX_PATH_CRYPTO)/camellia
48VBOX_INST_CRYPTO_HEADERS := obj/$(if-expr "$(CURSUBDIR)" == ".",,$(CURSUBDIR)/)crypto-3.0.3-headers/include/openssl/
49VBOX_PATH_CRYPTO_HEADERS := $(abspath $(PATH_OUT))/$(patsubst %/,%,$(VBOX_INST_CRYPTO_HEADERS))
50VBOX_PATH_CRYPTO_PROVIDERS := $(VBOX_PATH_OPENSSL)/providers
51
52# Enable asm implementation of crypto.
53if1of ($(KBUILD_TARGET_ARCH), x86 amd64)
54 ifneq ($(VBOX_CRYPTO_ASM_SCHEME),portme)
55 ifn1of ($(KBUILD_TARGET), ) # Selective exclusion for testing.
56 VBOX_WITH_CRYPTO_ASM = 1
57 endif
58 endif
59endif
60
61#
62# A target for installer the header files into a include directory
63# for the build. We have to put this in the Config.kmk because it
64# is required when running make from a sub directory too.
65#
66INSTALLS += crypto-headers
67crypto-headers_INST = $(VBOX_INST_CRYPTO_HEADERS)
68crypto-headers_MODE = a+r,u+w
69crypto-headers_DEFPATH = $(VBOX_PATH_OPENSSL)
70crypto-headers_SOURCES = \
71 include/openssl/aes.h=>aes.h \
72 include/openssl/asn1err.h=>asn1err.h \
73 include/openssl/asn1_mac.h=>asn1_mac.h \
74 include/openssl/async.h=>async.h \
75 include/openssl/asyncerr.h=>asyncerr.h \
76 include/openssl/bioerr.h=>bioerr.h \
77 include/openssl/blowfish.h=>blowfish.h \
78 include/openssl/bn.h=>bn.h \
79 include/openssl/bnerr.h=>bnerr.h \
80 include/openssl/buffer.h=>buffer.h \
81 include/openssl/buffererr.h=>buffererr.h \
82 include/openssl/camellia.h=>camellia.h \
83 include/openssl/cast.h=>cast.h \
84 include/openssl/cmac.h=>cmac.h \
85 include/openssl/cmserr.h=>cmserr.h \
86 include/openssl/comp.h=>comp.h \
87 include/openssl/comperr.h=>comperr.h \
88 include/openssl/conferr.h=>conferr.h \
89 include/openssl/conf_api.h=>conf_api.h \
90 include/openssl/conftypes.h=>conftypes.h \
91 include/openssl/core.h=>core.h \
92 include/openssl/core_dispatch.h=>core_dispatch.h \
93 include/openssl/core_names.h=>core_names.h \
94 include/openssl/cryptoerr.h=>cryptoerr.h \
95 include/openssl/cryptoerr_legacy.h=>cryptoerr_legacy.h \
96 include/openssl/cterr.h=>cterr.h \
97 include/openssl/des.h=>des.h \
98 include/openssl/dh.h=>dh.h \
99 include/openssl/dherr.h=>dherr.h \
100 include/openssl/dsa.h=>dsa.h \
101 include/openssl/dsaerr.h=>dsaerr.h \
102 include/openssl/dtls1.h=>dtls1.h \
103 include/openssl/ebcdic.h=>ebcdic.h \
104 include/openssl/ec.h=>ec.h \
105 include/openssl/ecerr.h=>ecerr.h \
106 include/openssl/ecdh.h=>ecdh.h \
107 include/openssl/ecdsa.h=>ecdsa.h \
108 include/openssl/engine.h=>engine.h \
109 include/openssl/engineerr.h=>engineerr.h \
110 include/openssl/evp.h=>evp.h \
111 include/openssl/evperr.h=>evperr.h \
112 include/openssl/e_os2.h=>e_os2.h \
113 include/openssl/hmac.h=>hmac.h \
114 include/openssl/http.h=>http.h \
115 include/openssl/idea.h=>idea.h \
116 include/openssl/macros.h=>macros.h \
117 include/openssl/md2.h=>md2.h \
118 include/openssl/md4.h=>md4.h \
119 include/openssl/md5.h=>md5.h \
120 include/openssl/mdc2.h=>mdc2.h \
121 include/openssl/modes.h=>modes.h \
122 include/openssl/objects.h=>objects.h \
123 include/openssl/objectserr.h=>objectserr.h \
124 include/openssl/obj_mac.h=>obj_mac.h \
125 include/openssl/ocsperr.h=>ocsperr.h \
126 openssl-mangling.h=>openssl-mangling.h \
127 include/openssl/opensslconf.h=>opensslconf.h \
128 include/openssl/ossl_typ.h=>ossl_typ.h \
129 include/openssl/params.h=>params.h \
130 include/openssl/pem.h=>pem.h \
131 include/openssl/pemerr.h=>pemerr.h \
132 include/openssl/pem2.h=>pem2.h \
133 include/openssl/pkcs12err.h=>pkcs12err.h \
134 include/openssl/pkcs7err.h=>pkcs7err.h \
135 include/openssl/prov_ssl.h=>prov_ssl.h \
136 include/openssl/rand.h=>rand.h \
137 include/openssl/randerr.h=>randerr.h \
138 include/openssl/rc2.h=>rc2.h \
139 include/openssl/rc4.h=>rc4.h \
140 include/openssl/ripemd.h=>ripemd.h \
141 include/openssl/rsa.h=>rsa.h \
142 include/openssl/rsaerr.h=>rsaerr.h \
143 include/openssl/seed.h=>seed.h \
144 include/openssl/sha.h=>sha.h \
145 include/openssl/srtp.h=>srtp.h \
146 include/openssl/sslerr.h=>sslerr.h \
147 include/openssl/sslerr_legacy.h=>sslerr_legacy.h \
148 include/openssl/ssl2.h=>ssl2.h \
149 include/openssl/ssl3.h=>ssl3.h \
150 include/openssl/stack.h=>stack.h \
151 include/openssl/symhacks.h=>symhacks.h \
152 include/openssl/tls1.h=>tls1.h \
153 include/openssl/ts.h=>ts.h \
154 include/openssl/txt_db.h=>txt_db.h \
155 include/openssl/types.h=>types.h \
156 include/openssl/uierr.h=>uierr.h \
157 include/openssl/x509err.h=>x509err.h \
158 include/openssl/x509v3err.h=>x509v3err.h \
159 gen-includes/openssl/asn1.h=>asn1.h \
160 gen-includes/openssl/asn1t.h=>asn1t.h \
161 gen-includes/openssl/bio.h=>bio.h \
162 gen-includes/openssl/cmp.h=>cmp.h \
163 gen-includes/openssl/cms.h=>cms.h \
164 gen-includes/openssl/conf.h=>conf.h \
165 gen-includes/openssl/configuration.h=>configuration.h \
166 gen-includes/openssl/crmf.h=>crmf.h \
167 gen-includes/openssl/crypto.h=>crypto.h \
168 gen-includes/openssl/ct.h=>ct.h \
169 gen-includes/openssl/err.h=>err.h \
170 gen-includes/openssl/ess.h=>ess.h \
171 gen-includes/openssl/fipskey.h=>fipskey.h \
172 gen-includes/openssl/lhash.h=>lhash.h \
173 gen-includes/openssl/ocsp.h=>ocsp.h \
174 gen-includes/openssl/opensslv.h=>opensslv.h \
175 gen-includes/openssl/pkcs12.h=>pkcs12.h \
176 gen-includes/openssl/pkcs7.h=>pkcs7.h \
177 gen-includes/openssl/safestack.h=>safestack.h \
178 gen-includes/openssl/srp.h=>srp.h \
179 gen-includes/openssl/ssl.h=>ssl.h \
180 gen-includes/openssl/ui.h=>ui.h \
181 gen-includes/openssl/x509.h=>x509.h \
182 gen-includes/openssl/x509_vfy.h=>x509_vfy.h \
183 gen-includes/openssl/x509v3.h=>x509v3.h
184
185#
186# The templates used for the crypo lib and all its sublibraries.
187#
188TEMPLATE_LIBCRYPTO = Template for the OpenSSL crypto library.
189TEMPLATE_LIBCRYPTO_EXTENDS = VBoxR3RuntimeDllNonPedantic
190ifneq ($(KBUILD_TARGET), win)
191 ## @todo correct inheritance here to make it use all the VBOXR3NP settings instead of overriding all of them.
192 TEMPLATE_LIBCRYPTO_ASTOOL = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_TOOL)
193 TEMPLATE_LIBCRYPTO_ASFLAGS = -include $(VBOX_PATH_OPENSSL)/openssl-mangling.h
194 TEMPLATE_LIBCRYPTO_ASFLAGS.x86 = -m32
195 TEMPLATE_LIBCRYPTO_ASFLAGS.amd64 = -m64
196 TEMPLATE_LIBCRYPTO_ASDEFS = $(NO_SUCH_VARIABLE)
197 TEMPLATE_LIBCRYPTO_ASDEFS.darwin = OPENSSL_MANGLE_ASM
198endif
199
200TEMPLATE_LIBCRYPTO_DEFS = \
201 $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_DEFS) \
202 VBOX_SUFF_DLL=$(VBOX_SUFF_DLL) \
203 IN_RT_R3 \
204 DSO_NONE \
205 OPENSSL_USE_NODELETE \
206 OPENSSL_PIC \
207 OPENSSL_IA32_SSE2 \
208 OPENSSL_BUILDING_OPENSSL
209ifdef VBOX_WITH_CRYPTO_ASM
210TEMPLATE_LIBCRYPTO_DEFS += \
211 OPENSSL_BN_ASM_MONT \
212 OPENSSL_BN_ASM_GF2m \
213 SHA1_ASM \
214 SHA256_ASM \
215 SHA512_ASM \
216 RC4_ASM \
217 MD5_ASM \
218 AES_ASM \
219 VPAES_ASM \
220 ECP_NISTZ256_ASM \
221 PADLOCK_ASM \
222 POLY1305_ASM
223TEMPLATE_LIBCRYPTO_DEFS.amd64 = \
224 BSAES_ASM \
225 GHASH_ASM \
226 KECCAK1600_ASM \
227 OPENSSL_BN_ASM_MONT5 \
228 X25519_ASM
229else
230TEMPLATE_LIBCRYPTO_DEFS += \
231 OPENSSL_NO_ASM
232endif
233if1of ($(KBUILD_TARGET), linux solaris)
234TEMPLATE_LIBCRYPTO_DEFS += \
235 _REENTRANT \
236 _GNU_SOURCE
237endif
238ifeq ($(sort $(filter -fPIC,$(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS))),-fPIC)
239TEMPLATE_LIBCRYPTO_DEFS += \
240 OPENSSL_PIC
241endif
242TEMPLATE_LIBCRYPTO_DEFS.amd64 += \
243 MD32_REG_T=int
244ifeq ($(KBUILD_TARGET),win)
245TEMPLATE_LIBCRYPTO_DEFS += \
246 OPENSSL_SYSNAME_WIN32 \
247 OPENSSL_RAND_SEED_OS
248# Exclude WinCrypt.h, causes trouble all over the place
249TEMPLATE_LIBCRYPTO_DEFS += \
250 NOCRYPT
251endif
252if1of ($(KBUILD_TARGET_ARCH), x86 amd64 arm64)
253TEMPLATE_LIBCRYPTO_DEFS += \
254 L_ENDIAN
255else
256TEMPLATE_LIBCRYPTO_DEFS += \
257 B_ENDIAN
258endif
259ifeq ($(KBUILD_TARGET),os2)
260TEMPLATE_LIBCRYPTO_DEFS += \
261 OPENSSL_NO_SECURE_MEMORY
262endif
263if defined(VBOX_WITH_PARFAIT) #&& VBOX_GCC_VERSION_CC == 50301
264 TEMPLATE_LIBCRYPTO_DEFS += __STDC_NO_ATOMICS__
265endif
266# Enable for running with valgrind:
267#TEMPLATE_LIBCRYPTO_DEFS += PURIFY
268
269TEMPLATE_LIBCRYPTO_CFLAGS = $(filter-out $(VBOX_GCC_fvisibility-hidden),$(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS))
270TEMPLATE_LIBCRYPTO_CFLAGS.win = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS.win)
271TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4305 # asn1_lib.c(455) : warning C4305: 'type cast' : truncation from 'const unsigned char *' to 'unsigned long'
272TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4306 # tasn_new.c(338) : warning C4306: 'type cast' : conversion from 'int' to 'ASN1_VALUE *' of greater size
273TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4701 # tasn_dec.c(840) : warning C4701: potentially uninitialized local variable 'buf' used
274TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4101 # bn_asm.c(619) : warning C4101: 'bh' : unreferenced local variable
275TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4206 # e_camellia.c(120) : warning C4206: nonstandard extension used : translation unit is empty
276TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4232 # warning C4232: nonstandard extension used : 'malloc_func' : address of dllimport 'malloc' is not stati c, identity not guaranteed
277TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4146 # x_long.c(79) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
278TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4130 # b_addr.c(750) : warning C4130: '==' : logical operation on address of string constant
279TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4090 # ssl_lib.c(229) : warning C4090: 'function' : different 'const' qualifiers
280TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4310 # bss_acpt.c(223) : warning C4310: cast truncates constant value [(int)INVALID_SOCKET]
281TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4210 # bn_exp.c(913) : warning C4210: nonstandard extension used : function given file scope
282TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4067 # mem.c(14) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
283
284if1of ($(VBOX_VCC_TOOL_STEM), VCC120)
285 TEMPLATE_LIBCRYPTO_CFLAGS.win += -wd4005 # sdk\v7.1\include\sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition
286endif
287TEMPLATE_LIBCRYPTO_CFLAGS.freebsd = -std=gnu99
288
289TEMPLATE_LIBCRYPTO_INCS := \
290 $(VBOX_PATH_OPENSSL) \
291 $(VBOX_PATH_OPENSSL)/include \
292 $(VBOX_PATH_OPENSSL)/providers/common/include \
293 $(VBOX_PATH_OPENSSL)/providers/implementations/include \
294 $(VBOX_PATH_OPENSSL)/gen-includes \
295 $(VBOX_PATH_CRYPTO)/include \
296 $(VBOX_PATH_CRYPTO_MODES) \
297 $(VBOX_PATH_CRYPTO)/ec/curve448 \
298 $(VBOX_PATH_CRYPTO)/ec/curve448/arch_32 \
299 $(patsubst %/openssl,%,$(VBOX_PATH_CRYPTO_HEADERS))
300
301#TEMPLATE_LIBCRYPTO_INTERMEDIATES = $($(crypto-headers)_1_STAGE_TARGET)
302TEMPLATE_LIBCRYPTO_INTERMEDIATES := \
303 $(foreach f,$(crypto-headers_SOURCES),$(VBOX_PATH_CRYPTO_HEADERS)/$(lastword $(subst =>, ,$(f))))
304
305# Same as LIBCRYPTO except that we don't install these libraries.
306TEMPLATE_SUBLIBCRYPTO = Template for the OpenSSL crypto sub-libraries.
307TEMPLATE_SUBLIBCRYPTO_EXTENDS = LIBCRYPTO
308TEMPLATE_SUBLIBCRYPTO_INSTTYPE = none
309
310# Somewhat similar to LIBCRYPTO.
311TEMPLATE_LIBCRYPTOTST = Template for the OpenSSL crypto testcases.
312TEMPLATE_LIBCRYPTOTST_EXTENDS = VBOXR3TSTEXE
313TEMPLATE_LIBCRYPTOTST_DEFS = $(TEMPLATE_VBOXR3TSTEXE_DEFS) $(filter-out $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_DEFS) IN_RT_R3,$(TEMPLATE_LIBCRYPTO_DEFS))
314TEMPLATE_LIBCRYPTOTST_INCS = $(TEMPLATE_LIBCRYPTO_INCS) $(TEMPLATE_VBOXR3TSTEXE_INCS)
315ifeq ($(KBUILD_TARGET),win)
316TEMPLATE_LIBCRYPTOTST_CFLAGS = $(filter-out $(VBOX_VCC_WERR), $(TEMPLATE_VBOXR3TSTEXE_CXXFLAGS)) $(VBOX_VCC_NON_PEDANTIC)
317else
318TEMPLATE_LIBCRYPTOTST_CFLAGS = $(filter-out $(VBOX_GCC_PEDANTIC_C), $(TEMPLATE_VBOXR3TSTEXE_CFLAGS)) $(VBOX_GCC_NON_PEDANTIC_C)
319endif
320TEMPLATE_LIBCRYPTOTST_LIBS = $(PATH_STAGE_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB) $(TEMPLATE_VBOXR3TSTEXE_LIBS)
321
322#
323# 32-bit version of LIBCRYPTO and SUBLIBCRYPTO.
324#
325TEMPLATE_VBoxLibCrypto-x86 = 32-bit template for the OpenSSL crypto library.
326TEMPLATE_VBoxLibCrypto-x86_EXTENDS = LIBCRYPTO
327TEMPLATE_VBoxLibCrypto-x86_BLD_TRG_ARCH = x86
328TEMPLATE_VBoxLibCrypto-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_LIBCRYPTO_DEFS)) HC_ARCH_BITS=32 ARCH_BITS=32
329
330TEMPLATE_VBoxSubLibCrypto-x86 = 32-bit template for the OpenSSL crypto sub-library.
331TEMPLATE_VBoxSubLibCrypto-x86_EXTENDS = VBoxLibCrypto-x86
332TEMPLATE_VBoxSubLibCrypto-x86_INSTTYPE = none
333
334ifdef VBOX_WITH_32_ON_64_MAIN_API # 32-bit edition.
335 define VBOX_OPENSSL_X86
336 $(eval LIBRARIES += $(1)-x86)
337 $(1)-x86_TEMPLATE := VBoxSubLibCrypto-x86
338 $(1)-x86_EXTENDS := $(1)
339 endef
340else
341 define VBOX_OPENSSL_X86
342 endef
343endif
344
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette