blob: f3a2c5abd722441aff6c1c0cd1dfb088a11c5d48 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "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
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011DEPENDS = "makedepend-native hostperl-runtime-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012DEPENDS_append_class-target = " openssl-native"
13
14SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
15 "
16S = "${WORKDIR}/openssl-${PV}"
17
18PACKAGECONFIG[perl] = ",,,"
19
20AR_append = " r"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050021TERMIO_libc-musl = "-DTERMIOS"
22TERMIO ?= "-DTERMIO"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023# Avoid binaries being marked as requiring an executable stack since it
24# doesn't(which causes and this causes issues with SELinux
25CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026 ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027
28export DIRS = "crypto ssl apps"
29export EX_LIBS = "-lgcc -ldl"
30export AS = "${CC} -c"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050031EXTRA_OEMAKE = "-e MAKEFLAGS="
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032
33inherit pkgconfig siteinfo multilib_header ptest
34
35PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050036FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
37FILES_libssl = "${libdir}/libssl${SOLIBS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038FILES_${PN} =+ " ${libdir}/ssl/*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060039FILES_${PN}-misc = "${libdir}/ssl/misc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050040RDEPENDS_${PN}-misc = "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041
42# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
43# package RRECOMMENDS on this package. This will enable the configuration
44# file to be installed for both the base openssl package and the libcrypto
45# package since the base openssl package depends on the libcrypto package.
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
47CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048RRECOMMENDS_libcrypto += "openssl-conf"
49RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc"
50
51# Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE
52# vulnerability
53EXTRA_OECONF = " -no-ssl3"
54
55do_configure_prepend_darwin () {
56 sed -i -e '/version-script=openssl\.ld/d' Configure
57}
58
59do_configure () {
60 cd util
61 perl perlpath.pl ${STAGING_BINDIR_NATIVE}
62 cd ..
63 ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
64
65 os=${HOST_OS}
66 case $os in
67 linux-uclibc |\
68 linux-uclibceabi |\
69 linux-gnueabi |\
70 linux-uclibcspe |\
71 linux-gnuspe |\
72 linux-musl*)
73 os=linux
74 ;;
75 *)
76 ;;
77 esac
78 target="$os-${HOST_ARCH}"
79 case $target in
80 linux-arm)
81 target=linux-armv4
82 ;;
83 linux-armeb)
84 target=linux-elf-armeb
85 ;;
86 linux-aarch64*)
87 target=linux-generic64
88 ;;
89 linux-sh3)
90 target=debian-sh3
91 ;;
92 linux-sh4)
93 target=debian-sh4
94 ;;
95 linux-i486)
96 target=debian-i386-i486
97 ;;
98 linux-i586 | linux-viac3)
99 target=debian-i386-i586
100 ;;
101 linux-i686)
102 target=debian-i386-i686/cmov
103 ;;
104 linux-gnux32-x86_64)
105 target=linux-x32
106 ;;
107 linux-gnu64-x86_64)
108 target=linux-x86_64
109 ;;
110 linux-mips)
111 target=debian-mips
112 ;;
113 linux-mipsel)
114 target=debian-mipsel
115 ;;
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500116 linux-*-mips64 | linux-mips64)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600117 target=debian-mips64
118 ;;
119 linux-*-mips64el | linux-mips64el)
120 target=debian-mips64el
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500121 ;;
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500122 linux-microblaze*|linux-nios2*)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500123 target=linux-generic32
124 ;;
125 linux-powerpc)
126 target=linux-ppc
127 ;;
128 linux-powerpc64)
129 target=linux-ppc64
130 ;;
131 linux-supersparc)
132 target=linux-sparcv8
133 ;;
134 linux-sparc)
135 target=linux-sparcv8
136 ;;
137 darwin-i386)
138 target=darwin-i386-cc
139 ;;
140 esac
141 # inject machine-specific flags
142 sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure
143 useprefix=${prefix}
144 if [ "x$useprefix" = "x" ]; then
145 useprefix=/
146 fi
147 perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=`basename ${libdir}` $target
148}
149
150do_compile_prepend_class-target () {
151 sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile
152}
153
154do_compile () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600155 oe_runmake depend
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500156 oe_runmake
157}
158
159do_compile_ptest () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600160 # build dependencies for test directory too
161 export DIRS="$DIRS test"
162 oe_runmake depend
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500163 oe_runmake buildtest
164}
165
166do_install () {
167 # Create ${D}/${prefix} to fix parallel issues
168 mkdir -p ${D}/${prefix}/
169
170 oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install
171
172 oe_libinstall -so libcrypto ${D}${libdir}
173 oe_libinstall -so libssl ${D}${libdir}
174
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500175 install -d ${D}${includedir}
176 cp --dereference -R include/openssl ${D}${includedir}
177
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600178 install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash
179 sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash
180
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500181 oe_multilib_header openssl/opensslconf.h
182 if [ "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" = "perl" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500183 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl
184 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500185 else
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500186 rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget
187 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600188
189 # Create SSL structure
190 install -d ${D}${sysconfdir}/ssl/
191 mv ${D}${libdir}/ssl/openssl.cnf \
192 ${D}${libdir}/ssl/certs \
193 ${D}${libdir}/ssl/private \
194 \
195 ${D}${sysconfdir}/ssl/
196 ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs
197 ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private
198 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500199}
200
201do_install_ptest () {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500202 cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH}
203 cp Configure config e_os.h ${D}${PTEST_PATH}
204 cp -r -L include ${D}${PTEST_PATH}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600205 ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500206 ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH}
207 mkdir -p ${D}${PTEST_PATH}/crypto
208 cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500209 cp -r certs ${D}${PTEST_PATH}
210 mkdir -p ${D}${PTEST_PATH}/apps
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500211 ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600212 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500213 ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600214 cp apps/server.pem ${D}${PTEST_PATH}/apps
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500215 cp apps/server2.pem ${D}${PTEST_PATH}/apps
216 mkdir -p ${D}${PTEST_PATH}/util
217 install util/opensslwrap.sh ${D}${PTEST_PATH}/util
218 install util/shlib_wrap.sh ${D}${PTEST_PATH}/util
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600219 # Time stamps are relevant for "make alltests", otherwise
220 # make may try to recompile binaries. Not only must the
221 # binary files be newer than the sources, they also must
222 # be more recent than the header files in /usr/include.
223 #
224 # Using "cp -a" is not sufficient, because do_install
225 # does not preserve the original time stamps.
226 #
227 # So instead of using the original file stamps, we set
228 # the current time for all files. Binaries will get
229 # modified again later when stripping them, but that's okay.
230 touch ${D}${PTEST_PATH}
231 find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500232}
233
234do_install_append_class-native() {
235 create_wrapper ${D}${bindir}/openssl \
236 OPENSSL_CONF=${libdir}/ssl/openssl.cnf \
237 SSL_CERT_DIR=${libdir}/ssl/certs \
238 SSL_CERT_FILE=${libdir}/ssl/cert.pem \
239 OPENSSL_ENGINES=${libdir}/ssl/engines
240}
241
242BBCLASSEXTEND = "native nativesdk"