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