summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre McCurdy <armccurdy@gmail.com>2018-07-23 19:38:47 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-26 13:16:41 +0100
commitcfbe08fba26447faf7bf003ddecd8819eedeb21d (patch)
tree0585085bb288275606ba0c7b4cbc1a25cc11eeb1
parentb22e18b7a0e5979c7f80f8ca0ce1e21c8f04aa3c (diff)
downloadpoky-cfbe08fba26447faf7bf003ddecd8819eedeb21d.tar.gz
openssl_1.0: merge openssl10.inc into the openssl_1.0.2o.bb recipe
The openssl10.inc include file only has one user, so we can improve maintainability by merging the include file into the recipe which uses it. (From OE-Core rev: f5568740d5ff72090c3ca894ddfdc3078169da25) Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-connectivity/openssl/openssl10.inc296
-rw-r--r--meta/recipes-connectivity/openssl/openssl_1.0.2o.bb310
2 files changed, 300 insertions, 306 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl10.inc b/meta/recipes-connectivity/openssl/openssl10.inc
deleted file mode 100644
index 1f8834f2e8..0000000000
--- a/meta/recipes-connectivity/openssl/openssl10.inc
+++ /dev/null
@@ -1,296 +0,0 @@
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=f9a8f968107345e0b75aa8c2ecaa7ec8"
10
11DEPENDS = "makedepend-native hostperl-runtime-native"
12DEPENDS_append_class-target = " openssl-native"
13
14PROVIDES += "openssl10"
15
16SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
17 "
18S = "${WORKDIR}/openssl-${PV}"
19UPSTREAM_CHECK_REGEX = "openssl-(?P<pver>1\.0.+)\.tar"
20
21PACKAGECONFIG ?= "cryptodev-linux"
22PACKAGECONFIG[perl] = ",,,"
23PACKAGECONFIG[cryptodev-linux] = "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS,,cryptodev-linux"
24
25TERMIO_libc-musl = "-DTERMIOS"
26TERMIO ?= "-DTERMIO"
27# Avoid binaries being marked as requiring an executable stack since it
28# doesn't(which causes and this causes issues with SELinux
29CFLAG = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
30 ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack"
31
32export DIRS = "crypto ssl apps"
33export EX_LIBS = "-lgcc -ldl"
34export AS = "${CC} -c"
35
36# openssl fails with ccache: https://bugzilla.yoctoproject.org/show_bug.cgi?id=12810
37CCACHE = ""
38
39inherit pkgconfig siteinfo multilib_header ptest relative_symlinks
40
41PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf"
42FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
43FILES_libssl = "${libdir}/libssl${SOLIBS}"
44FILES_${PN} =+ " ${libdir}/ssl/*"
45FILES_${PN}-misc = "${libdir}/ssl/misc"
46RDEPENDS_${PN}-misc = "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}"
47
48# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
49# package RRECOMMENDS on this package. This will enable the configuration
50# file to be installed for both the base openssl package and the libcrypto
51# package since the base openssl package depends on the libcrypto package.
52FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
53CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
54RRECOMMENDS_libcrypto += "openssl-conf"
55RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc"
56
57# Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE
58# vulnerability
59EXTRA_OECONF = " -no-ssl3"
60
61do_configure_prepend_darwin () {
62 sed -i -e '/version-script=openssl\.ld/d' Configure
63}
64
65do_configure () {
66 cd util
67 perl perlpath.pl ${STAGING_BINDIR_NATIVE}
68 cd ..
69 ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
70
71 os=${HOST_OS}
72 case $os in
73 linux-gnueabi |\
74 linux-gnuspe |\
75 linux-musleabi |\
76 linux-muslspe |\
77 linux-musl )
78 os=linux
79 ;;
80 *)
81 ;;
82 esac
83 target="$os-${HOST_ARCH}"
84 case $target in
85 linux-arm)
86 target=linux-armv4
87 ;;
88 linux-armeb)
89 target=linux-elf-armeb
90 ;;
91 linux-aarch64*)
92 target=linux-aarch64
93 ;;
94 linux-sh3)
95 target=debian-sh3
96 ;;
97 linux-sh4)
98 target=debian-sh4
99 ;;
100 linux-i486)
101 target=debian-i386-i486
102 ;;
103 linux-i586 | linux-viac3)
104 target=debian-i386-i586
105 ;;
106 linux-i686)
107 target=debian-i386-i686/cmov
108 ;;
109 linux-gnux32-x86_64 | linux-muslx32-x86_64 )
110 target=linux-x32
111 ;;
112 linux-gnu64-x86_64)
113 target=linux-x86_64
114 ;;
115 linux-gnun32-mips*el)
116 target=debian-mipsn32el
117 ;;
118 linux-gnun32-mips*)
119 target=debian-mipsn32
120 ;;
121 linux-mips*64*el)
122 target=debian-mips64el
123 ;;
124 linux-mips*64*)
125 target=debian-mips64
126 ;;
127 linux-mips*el)
128 target=debian-mipsel
129 ;;
130 linux-mips*)
131 target=debian-mips
132 ;;
133 linux-microblaze*|linux-nios2*|linux-gnu*ilp32**)
134 target=linux-generic32
135 ;;
136 linux-powerpc)
137 target=linux-ppc
138 ;;
139 linux-powerpc64)
140 target=linux-ppc64
141 ;;
142 linux-riscv64)
143 target=linux-generic64
144 ;;
145 linux-riscv32)
146 target=linux-generic32
147 ;;
148 linux-supersparc)
149 target=linux-sparcv8
150 ;;
151 linux-sparc)
152 target=linux-sparcv8
153 ;;
154 darwin-i386)
155 target=darwin-i386-cc
156 ;;
157 esac
158 # inject machine-specific flags
159 sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure
160 useprefix=${prefix}
161 if [ "x$useprefix" = "x" ]; then
162 useprefix=/
163 fi
164 libdirleaf="$(echo ${libdir} | sed s:$useprefix::)"
165 perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=${libdirleaf} $target
166}
167
168do_compile_prepend_class-target () {
169 sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile
170 oe_runmake depend
171 cc_sanitized=`echo "${CC} ${CFLAG}" | sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' -e 's|${DEBUG_PREFIX_MAP}||g'`
172 oe_runmake CC_INFO="${cc_sanitized}"
173}
174
175do_compile () {
176 oe_runmake depend
177 oe_runmake
178}
179
180do_compile_ptest () {
181 # build dependencies for test directory too
182 export DIRS="$DIRS test"
183 oe_runmake depend
184 oe_runmake buildtest
185}
186
187do_install () {
188 # Create ${D}/${prefix} to fix parallel issues
189 mkdir -p ${D}/${prefix}/
190
191 oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install
192
193 oe_libinstall -so libcrypto ${D}${libdir}
194 oe_libinstall -so libssl ${D}${libdir}
195
196 install -d ${D}${includedir}
197 cp --dereference -R include/openssl ${D}${includedir}
198
199 install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash
200 sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash
201
202 oe_multilib_header openssl/opensslconf.h
203 if [ "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" ]; then
204 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl
205 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget
206 else
207 rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget
208 fi
209
210 # Create SSL structure
211 install -d ${D}${sysconfdir}/ssl/
212 mv ${D}${libdir}/ssl/openssl.cnf \
213 ${D}${libdir}/ssl/certs \
214 ${D}${libdir}/ssl/private \
215 \
216 ${D}${sysconfdir}/ssl/
217 ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs
218 ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private
219 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf
220
221 # Rename man pages to prefix openssl10-*
222 for f in `find ${D}${mandir} -type f`; do
223 mv $f $(dirname $f)/openssl10-$(basename $f)
224 done
225 for f in `find ${D}${mandir} -type l`; do
226 ln_f=`readlink $f`
227 rm -f $f
228 ln -s openssl10-$ln_f $(dirname $f)/openssl10-$(basename $f)
229 done
230}
231
232do_install_ptest () {
233 cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH}
234
235 # Replace the path to native perl with the path to target perl
236 sed -i 's,^PERL=.*,PERL=${bindir}/perl,' ${D}${PTEST_PATH}/Makefile
237
238 cp Configure config e_os.h ${D}${PTEST_PATH}
239 cp -r -L include ${D}${PTEST_PATH}
240 ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH}
241 ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH}
242 mkdir -p ${D}${PTEST_PATH}/crypto
243 cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto
244 cp -r certs ${D}${PTEST_PATH}
245 mkdir -p ${D}${PTEST_PATH}/apps
246 ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps
247 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps
248 ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps
249 cp apps/server.pem ${D}${PTEST_PATH}/apps
250 cp apps/server2.pem ${D}${PTEST_PATH}/apps
251 mkdir -p ${D}${PTEST_PATH}/util
252 install util/opensslwrap.sh ${D}${PTEST_PATH}/util
253 install util/shlib_wrap.sh ${D}${PTEST_PATH}/util
254 # Time stamps are relevant for "make alltests", otherwise
255 # make may try to recompile binaries. Not only must the
256 # binary files be newer than the sources, they also must
257 # be more recent than the header files in /usr/include.
258 #
259 # Using "cp -a" is not sufficient, because do_install
260 # does not preserve the original time stamps.
261 #
262 # So instead of using the original file stamps, we set
263 # the current time for all files. Binaries will get
264 # modified again later when stripping them, but that's okay.
265 touch ${D}${PTEST_PATH}
266 find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH}
267
268 # exclude binary files or the package won't install
269 for d in ssltest_old v3ext x509aux; do
270 rm -rf ${D}${libdir}/${BPN}/ptest/test/$d
271 done
272
273 # Remove build host references
274 sed -i \
275 -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
276 -e 's|${DEBUG_PREFIX_MAP}||g' \
277 ${D}${PTEST_PATH}/Makefile ${D}${PTEST_PATH}/Configure
278}
279
280do_install_append_class-native() {
281 create_wrapper ${D}${bindir}/openssl \
282 OPENSSL_CONF=${libdir}/ssl/openssl.cnf \
283 SSL_CERT_DIR=${libdir}/ssl/certs \
284 SSL_CERT_FILE=${libdir}/ssl/cert.pem \
285 OPENSSL_ENGINES=${libdir}/ssl/engines
286}
287
288do_install_append_class-nativesdk() {
289 mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
290 install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
291}
292
293FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
294
295BBCLASSEXTEND = "native nativesdk"
296
diff --git a/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb b/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb
index 7cae553f35..619f3d8bfa 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb
@@ -1,17 +1,20 @@
1require openssl10.inc 1SUMMARY = "Secure Socket Layer"
2 2DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools."
3# For target side versions of openssl enable support for OCF Linux driver 3HOMEPAGE = "http://www.openssl.org/"
4# if they are available. 4BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html"
5 5SECTION = "libs/network"
6CFLAG += "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS"
7CFLAG_append_class-native = " -fPIC"
8 6
7# "openssl | SSLeay" dual license
8LICENSE = "openssl"
9LIC_FILES_CHKSUM = "file://LICENSE;md5=f475368924827d06d4b416111c8bdb77" 9LIC_FILES_CHKSUM = "file://LICENSE;md5=f475368924827d06d4b416111c8bdb77"
10 10
11export DIRS = "crypto ssl apps engines" 11DEPENDS = "makedepend-native hostperl-runtime-native"
12export OE_LDFLAGS="${LDFLAGS}" 12DEPENDS_append_class-target = " openssl-native"
13
14PROVIDES += "openssl10"
13 15
14SRC_URI += "file://find.pl;subdir=openssl-${PV}/util/ \ 16SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
17 file://find.pl;subdir=openssl-${PV}/util/ \
15 file://run-ptest \ 18 file://run-ptest \
16 file://openssl-c_rehash.sh \ 19 file://openssl-c_rehash.sh \
17 file://configure-targets.patch \ 20 file://configure-targets.patch \
@@ -55,9 +58,64 @@ SRC_URI_append_class-nativesdk = " \
55SRC_URI[md5sum] = "44279b8557c3247cbe324e2322ecd114" 58SRC_URI[md5sum] = "44279b8557c3247cbe324e2322ecd114"
56SRC_URI[sha256sum] = "ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d" 59SRC_URI[sha256sum] = "ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d"
57 60
61S = "${WORKDIR}/openssl-${PV}"
62UPSTREAM_CHECK_REGEX = "openssl-(?P<pver>1\.0.+)\.tar"
63
64PACKAGECONFIG ?= "cryptodev-linux"
65PACKAGECONFIG[perl] = ",,,"
66PACKAGECONFIG[cryptodev-linux] = "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS,,cryptodev-linux"
67
68TERMIO_libc-musl = "-DTERMIOS"
69TERMIO ?= "-DTERMIO"
70# Avoid binaries being marked as requiring an executable stack since it
71# doesn't(which causes and this causes issues with SELinux
72CFLAG = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
73 ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack"
74
75# For target side versions of openssl enable support for OCF Linux driver
76# if they are available.
77
78CFLAG += "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS"
79CFLAG_append_class-native = " -fPIC"
80
81export DIRS = "crypto ssl apps engines"
82export EX_LIBS = "-lgcc -ldl"
83export AS = "${CC} -c"
84
85export OE_LDFLAGS = "${LDFLAGS}"
86
87# openssl fails with ccache: https://bugzilla.yoctoproject.org/show_bug.cgi?id=12810
88CCACHE = ""
89
90inherit pkgconfig siteinfo multilib_header ptest relative_symlinks
91
92PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf"
93FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
94FILES_libssl = "${libdir}/libssl${SOLIBS}"
95FILES_${PN} =+ " ${libdir}/ssl/*"
96FILES_${PN}-misc = "${libdir}/ssl/misc"
97RDEPENDS_${PN}-misc = "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}"
98
99# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
100# package RRECOMMENDS on this package. This will enable the configuration
101# file to be installed for both the base openssl package and the libcrypto
102# package since the base openssl package depends on the libcrypto package.
103FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
104CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
105RRECOMMENDS_libcrypto += "openssl-conf"
106RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc"
107
58PACKAGES =+ "${PN}-engines" 108PACKAGES =+ "${PN}-engines"
59FILES_${PN}-engines = "${libdir}/ssl/engines/*.so ${libdir}/engines" 109FILES_${PN}-engines = "${libdir}/ssl/engines/*.so ${libdir}/engines"
60 110
111# Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE
112# vulnerability
113EXTRA_OECONF = " -no-ssl3"
114
115do_configure_prepend_darwin () {
116 sed -i -e '/version-script=openssl\.ld/d' Configure
117}
118
61# The crypto_use_bigint patch means that perl's bignum module needs to be 119# The crypto_use_bigint patch means that perl's bignum module needs to be
62# installed, but some distributions (for example Fedora 23) don't ship it by 120# installed, but some distributions (for example Fedora 23) don't ship it by
63# default. As the resulting error is very misleading check for bignum before 121# default. As the resulting error is very misleading check for bignum before
@@ -67,3 +125,235 @@ do_configure_prepend() {
67 bbfatal "The perl module 'bignum' was not found but this is required to build openssl. Please install this module (often packaged as perl-bignum) and re-run bitbake." 125 bbfatal "The perl module 'bignum' was not found but this is required to build openssl. Please install this module (often packaged as perl-bignum) and re-run bitbake."
68 fi 126 fi
69} 127}
128
129do_configure () {
130 cd util
131 perl perlpath.pl ${STAGING_BINDIR_NATIVE}
132 cd ..
133 ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
134
135 os=${HOST_OS}
136 case $os in
137 linux-gnueabi |\
138 linux-gnuspe |\
139 linux-musleabi |\
140 linux-muslspe |\
141 linux-musl )
142 os=linux
143 ;;
144 *)
145 ;;
146 esac
147 target="$os-${HOST_ARCH}"
148 case $target in
149 linux-arm)
150 target=linux-armv4
151 ;;
152 linux-armeb)
153 target=linux-elf-armeb
154 ;;
155 linux-aarch64*)
156 target=linux-aarch64
157 ;;
158 linux-sh3)
159 target=debian-sh3
160 ;;
161 linux-sh4)
162 target=debian-sh4
163 ;;
164 linux-i486)
165 target=debian-i386-i486
166 ;;
167 linux-i586 | linux-viac3)
168 target=debian-i386-i586
169 ;;
170 linux-i686)
171 target=debian-i386-i686/cmov
172 ;;
173 linux-gnux32-x86_64 | linux-muslx32-x86_64 )
174 target=linux-x32
175 ;;
176 linux-gnu64-x86_64)
177 target=linux-x86_64
178 ;;
179 linux-gnun32-mips*el)
180 target=debian-mipsn32el
181 ;;
182 linux-gnun32-mips*)
183 target=debian-mipsn32
184 ;;
185 linux-mips*64*el)
186 target=debian-mips64el
187 ;;
188 linux-mips*64*)
189 target=debian-mips64
190 ;;
191 linux-mips*el)
192 target=debian-mipsel
193 ;;
194 linux-mips*)
195 target=debian-mips
196 ;;
197 linux-microblaze*|linux-nios2*|linux-gnu*ilp32**)
198 target=linux-generic32
199 ;;
200 linux-powerpc)
201 target=linux-ppc
202 ;;
203 linux-powerpc64)
204 target=linux-ppc64
205 ;;
206 linux-riscv64)
207 target=linux-generic64
208 ;;
209 linux-riscv32)
210 target=linux-generic32
211 ;;
212 linux-supersparc)
213 target=linux-sparcv8
214 ;;
215 linux-sparc)
216 target=linux-sparcv8
217 ;;
218 darwin-i386)
219 target=darwin-i386-cc
220 ;;
221 esac
222 # inject machine-specific flags
223 sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure
224 useprefix=${prefix}
225 if [ "x$useprefix" = "x" ]; then
226 useprefix=/
227 fi
228 libdirleaf="$(echo ${libdir} | sed s:$useprefix::)"
229 perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=${libdirleaf} $target
230}
231
232do_compile_prepend_class-target () {
233 sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile
234 oe_runmake depend
235 cc_sanitized=`echo "${CC} ${CFLAG}" | sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' -e 's|${DEBUG_PREFIX_MAP}||g'`
236 oe_runmake CC_INFO="${cc_sanitized}"
237}
238
239do_compile () {
240 oe_runmake depend
241 oe_runmake
242}
243
244do_compile_ptest () {
245 # build dependencies for test directory too
246 export DIRS="$DIRS test"
247 oe_runmake depend
248 oe_runmake buildtest
249}
250
251do_install () {
252 # Create ${D}/${prefix} to fix parallel issues
253 mkdir -p ${D}/${prefix}/
254
255 oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install
256
257 oe_libinstall -so libcrypto ${D}${libdir}
258 oe_libinstall -so libssl ${D}${libdir}
259
260 install -d ${D}${includedir}
261 cp --dereference -R include/openssl ${D}${includedir}
262
263 install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash
264 sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash
265
266 oe_multilib_header openssl/opensslconf.h
267 if [ "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" ]; then
268 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl
269 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget
270 else
271 rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget
272 fi
273
274 # Create SSL structure
275 install -d ${D}${sysconfdir}/ssl/
276 mv ${D}${libdir}/ssl/openssl.cnf \
277 ${D}${libdir}/ssl/certs \
278 ${D}${libdir}/ssl/private \
279 \
280 ${D}${sysconfdir}/ssl/
281 ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs
282 ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private
283 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf
284
285 # Rename man pages to prefix openssl10-*
286 for f in `find ${D}${mandir} -type f`; do
287 mv $f $(dirname $f)/openssl10-$(basename $f)
288 done
289 for f in `find ${D}${mandir} -type l`; do
290 ln_f=`readlink $f`
291 rm -f $f
292 ln -s openssl10-$ln_f $(dirname $f)/openssl10-$(basename $f)
293 done
294}
295
296do_install_ptest () {
297 cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH}
298
299 # Replace the path to native perl with the path to target perl
300 sed -i 's,^PERL=.*,PERL=${bindir}/perl,' ${D}${PTEST_PATH}/Makefile
301
302 cp Configure config e_os.h ${D}${PTEST_PATH}
303 cp -r -L include ${D}${PTEST_PATH}
304 ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH}
305 ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH}
306 mkdir -p ${D}${PTEST_PATH}/crypto
307 cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto
308 cp -r certs ${D}${PTEST_PATH}
309 mkdir -p ${D}${PTEST_PATH}/apps
310 ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps
311 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps
312 ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps
313 cp apps/server.pem ${D}${PTEST_PATH}/apps
314 cp apps/server2.pem ${D}${PTEST_PATH}/apps
315 mkdir -p ${D}${PTEST_PATH}/util
316 install util/opensslwrap.sh ${D}${PTEST_PATH}/util
317 install util/shlib_wrap.sh ${D}${PTEST_PATH}/util
318 # Time stamps are relevant for "make alltests", otherwise
319 # make may try to recompile binaries. Not only must the
320 # binary files be newer than the sources, they also must
321 # be more recent than the header files in /usr/include.
322 #
323 # Using "cp -a" is not sufficient, because do_install
324 # does not preserve the original time stamps.
325 #
326 # So instead of using the original file stamps, we set
327 # the current time for all files. Binaries will get
328 # modified again later when stripping them, but that's okay.
329 touch ${D}${PTEST_PATH}
330 find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH}
331
332 # exclude binary files or the package won't install
333 for d in ssltest_old v3ext x509aux; do
334 rm -rf ${D}${libdir}/${BPN}/ptest/test/$d
335 done
336
337 # Remove build host references
338 sed -i \
339 -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
340 -e 's|${DEBUG_PREFIX_MAP}||g' \
341 ${D}${PTEST_PATH}/Makefile ${D}${PTEST_PATH}/Configure
342}
343
344do_install_append_class-native() {
345 create_wrapper ${D}${bindir}/openssl \
346 OPENSSL_CONF=${libdir}/ssl/openssl.cnf \
347 SSL_CERT_DIR=${libdir}/ssl/certs \
348 SSL_CERT_FILE=${libdir}/ssl/cert.pem \
349 OPENSSL_ENGINES=${libdir}/ssl/engines
350}
351
352do_install_append_class-nativesdk() {
353 mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
354 install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
355}
356
357FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
358
359BBCLASSEXTEND = "native nativesdk"