diff options
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl_1.1.1a.bb')
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl_1.1.1a.bb | 205 |
1 files changed, 205 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl_1.1.1a.bb b/meta/recipes-connectivity/openssl/openssl_1.1.1a.bb new file mode 100644 index 0000000000..3629f7e6a1 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl_1.1.1a.bb | |||
@@ -0,0 +1,205 @@ | |||
1 | SUMMARY = "Secure Socket Layer" | ||
2 | DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools." | ||
3 | HOMEPAGE = "http://www.openssl.org/" | ||
4 | BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html" | ||
5 | SECTION = "libs/network" | ||
6 | |||
7 | # "openssl" here actually means both OpenSSL and SSLeay licenses apply | ||
8 | # (see meta/files/common-licenses/OpenSSL to which "openssl" is SPDXLICENSEMAPped) | ||
9 | LICENSE = "openssl" | ||
10 | LIC_FILES_CHKSUM = "file://LICENSE;md5=d57d511030c9d66ef5f5966bee5a7eff" | ||
11 | |||
12 | DEPENDS = "hostperl-runtime-native" | ||
13 | |||
14 | SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ | ||
15 | file://run-ptest \ | ||
16 | file://openssl-c_rehash.sh \ | ||
17 | file://0001-skip-test_symbol_presence.patch \ | ||
18 | file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ | ||
19 | file://afalg.patch \ | ||
20 | " | ||
21 | |||
22 | SRC_URI_append_class-nativesdk = " \ | ||
23 | file://environment.d-openssl.sh \ | ||
24 | " | ||
25 | |||
26 | SRC_URI[md5sum] = "963deb2272d6be7d4c2458afd2517b73" | ||
27 | SRC_URI[sha256sum] = "fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed3f9f41" | ||
28 | |||
29 | inherit lib_package multilib_header ptest | ||
30 | |||
31 | B = "${WORKDIR}/build" | ||
32 | do_configure[cleandirs] = "${B}" | ||
33 | |||
34 | #| ./libcrypto.so: undefined reference to `getcontext' | ||
35 | #| ./libcrypto.so: undefined reference to `setcontext' | ||
36 | #| ./libcrypto.so: undefined reference to `makecontext' | ||
37 | EXTRA_OECONF_append_libc-musl = " no-async" | ||
38 | |||
39 | # This prevents openssl from using getrandom() which is not available on older glibc versions | ||
40 | # (native versions can be built with newer glibc, but then relocated onto a system with older glibc) | ||
41 | EXTRA_OECONF_class-native = "--with-rand-seed=devrandom" | ||
42 | EXTRA_OECONF_class-nativesdk = "--with-rand-seed=devrandom" | ||
43 | |||
44 | # Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate. | ||
45 | CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin" | ||
46 | CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin" | ||
47 | |||
48 | do_configure () { | ||
49 | os=${HOST_OS} | ||
50 | case $os in | ||
51 | linux-gnueabi |\ | ||
52 | linux-gnuspe |\ | ||
53 | linux-musleabi |\ | ||
54 | linux-muslspe |\ | ||
55 | linux-musl ) | ||
56 | os=linux | ||
57 | ;; | ||
58 | *) | ||
59 | ;; | ||
60 | esac | ||
61 | target="$os-${HOST_ARCH}" | ||
62 | case $target in | ||
63 | linux-arm*) | ||
64 | target=linux-armv4 | ||
65 | ;; | ||
66 | linux-aarch64*) | ||
67 | target=linux-aarch64 | ||
68 | ;; | ||
69 | linux-i?86 | linux-viac3) | ||
70 | target=linux-x86 | ||
71 | ;; | ||
72 | linux-gnux32-x86_64 | linux-muslx32-x86_64 ) | ||
73 | target=linux-x32 | ||
74 | ;; | ||
75 | linux-gnu64-x86_64) | ||
76 | target=linux-x86_64 | ||
77 | ;; | ||
78 | linux-mips | linux-mipsel) | ||
79 | # specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags | ||
80 | target="linux-mips32 ${TARGET_CC_ARCH}" | ||
81 | ;; | ||
82 | linux-gnun32-mips*) | ||
83 | target=linux-mips64 | ||
84 | ;; | ||
85 | linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el) | ||
86 | target=linux64-mips64 | ||
87 | ;; | ||
88 | linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*) | ||
89 | target=linux-generic32 | ||
90 | ;; | ||
91 | linux-powerpc) | ||
92 | target=linux-ppc | ||
93 | ;; | ||
94 | linux-powerpc64) | ||
95 | target=linux-ppc64 | ||
96 | ;; | ||
97 | linux-riscv32) | ||
98 | target=linux-generic32 | ||
99 | ;; | ||
100 | linux-riscv64) | ||
101 | target=linux-generic64 | ||
102 | ;; | ||
103 | linux-sparc | linux-supersparc) | ||
104 | target=linux-sparcv9 | ||
105 | ;; | ||
106 | esac | ||
107 | |||
108 | useprefix=${prefix} | ||
109 | if [ "x$useprefix" = "x" ]; then | ||
110 | useprefix=/ | ||
111 | fi | ||
112 | # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the | ||
113 | # environment variables set by bitbake. Adjust the environment variables instead. | ||
114 | PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \ | ||
115 | perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target | ||
116 | perl ${B}/configdata.pm --dump | ||
117 | } | ||
118 | |||
119 | do_install () { | ||
120 | oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install | ||
121 | |||
122 | oe_multilib_header openssl/opensslconf.h | ||
123 | |||
124 | # Create SSL structure for packages such as ca-certificates which | ||
125 | # contain hard-coded paths to /etc/ssl. Debian does the same. | ||
126 | install -d ${D}${sysconfdir}/ssl | ||
127 | mv ${D}${libdir}/ssl-1.1/certs \ | ||
128 | ${D}${libdir}/ssl-1.1/private \ | ||
129 | ${D}${libdir}/ssl-1.1/openssl.cnf \ | ||
130 | ${D}${sysconfdir}/ssl/ | ||
131 | |||
132 | # Although absolute symlinks would be OK for the target, they become | ||
133 | # invalid if native or nativesdk are relocated from sstate. | ||
134 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-1.1/certs | ||
135 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-1.1/private | ||
136 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-1.1/openssl.cnf | ||
137 | } | ||
138 | |||
139 | do_install_append_class-native () { | ||
140 | create_wrapper ${D}${bindir}/openssl \ | ||
141 | OPENSSL_CONF=${libdir}/ssl-1.1/openssl.cnf \ | ||
142 | SSL_CERT_DIR=${libdir}/ssl-1.1/certs \ | ||
143 | SSL_CERT_FILE=${libdir}/ssl-1.1/cert.pem \ | ||
144 | OPENSSL_ENGINES=${libdir}/ssl-1.1/engines | ||
145 | |||
146 | # Install a custom version of c_rehash that can handle sysroots properly. | ||
147 | # This version is used for example when installing ca-certificates during | ||
148 | # image creation. | ||
149 | install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash | ||
150 | sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash | ||
151 | } | ||
152 | |||
153 | do_install_append_class-nativesdk () { | ||
154 | mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d | ||
155 | install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh | ||
156 | sed 's|/usr/lib/ssl/|/usr/lib/ssl-1.1/|g' -i ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh | ||
157 | } | ||
158 | |||
159 | do_install_ptest () { | ||
160 | # Prune the build tree | ||
161 | rm -f ${B}/fuzz/*.* ${B}/test/*.* | ||
162 | |||
163 | cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH} | ||
164 | cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH} | ||
165 | |||
166 | # For test_shlibload | ||
167 | ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/libcrypto.so | ||
168 | ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/libssl.so | ||
169 | |||
170 | install -d ${D}${PTEST_PATH}/apps | ||
171 | ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps | ||
172 | install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps | ||
173 | install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps | ||
174 | |||
175 | install -d ${D}${PTEST_PATH}/engines | ||
176 | install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines | ||
177 | } | ||
178 | |||
179 | # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto | ||
180 | # package RRECOMMENDS on this package. This will enable the configuration | ||
181 | # file to be installed for both the openssl-bin package and the libcrypto | ||
182 | # package since the openssl-bin package depends on the libcrypto package. | ||
183 | |||
184 | PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc" | ||
185 | |||
186 | FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}" | ||
187 | FILES_libssl = "${libdir}/libssl${SOLIBS}" | ||
188 | FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
189 | FILES_${PN}-engines = "${libdir}/engines-1.1" | ||
190 | FILES_${PN}-misc = "${libdir}/ssl-1.1/misc" | ||
191 | FILES_${PN} =+ "${libdir}/ssl-1.1/*" | ||
192 | FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh" | ||
193 | |||
194 | CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
195 | |||
196 | RRECOMMENDS_libcrypto += "openssl-conf" | ||
197 | RDEPENDS_${PN}-bin = "perl" | ||
198 | RDEPENDS_${PN}-misc = "perl" | ||
199 | RDEPENDS_${PN}-ptest += "openssl-bin perl perl-modules bash python" | ||
200 | |||
201 | RPROVIDES_openssl-conf = "openssl10-conf" | ||
202 | RREPLACES_openssl-conf = "openssl10-conf" | ||
203 | RCONFLICTS_openssl-conf = "openssl10-conf" | ||
204 | |||
205 | BBCLASSEXTEND = "native nativesdk" | ||