blob: a5ddf4d4b01157dec5dc56d95b46186d6e49af94 [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 Williamsd8c66bc2016-06-20 12:57:21 -050011DEPENDS = "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/*"
39FILES_${PN}-misc = "${libdir}/ssl/misc ${bindir}/c_rehash"
40RDEPENDS_${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.
46FILES_openssl-conf = "${libdir}/ssl/openssl.cnf"
47CONFFILES_openssl-conf = "${libdir}/ssl/openssl.cnf"
48RRECOMMENDS_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 Williamsc124f4f2015-09-15 14:41:29 -0500117 target=linux-mips
118 ;;
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500119 linux-microblaze*|linux-nios2*)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500120 target=linux-generic32
121 ;;
122 linux-powerpc)
123 target=linux-ppc
124 ;;
125 linux-powerpc64)
126 target=linux-ppc64
127 ;;
128 linux-supersparc)
129 target=linux-sparcv8
130 ;;
131 linux-sparc)
132 target=linux-sparcv8
133 ;;
134 darwin-i386)
135 target=darwin-i386-cc
136 ;;
137 esac
138 # inject machine-specific flags
139 sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure
140 useprefix=${prefix}
141 if [ "x$useprefix" = "x" ]; then
142 useprefix=/
143 fi
144 perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=`basename ${libdir}` $target
145}
146
147do_compile_prepend_class-target () {
148 sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile
149}
150
151do_compile () {
152 oe_runmake
153}
154
155do_compile_ptest () {
156 oe_runmake buildtest
157}
158
159do_install () {
160 # Create ${D}/${prefix} to fix parallel issues
161 mkdir -p ${D}/${prefix}/
162
163 oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install
164
165 oe_libinstall -so libcrypto ${D}${libdir}
166 oe_libinstall -so libssl ${D}${libdir}
167
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500168 install -d ${D}${includedir}
169 cp --dereference -R include/openssl ${D}${includedir}
170
171 oe_multilib_header openssl/opensslconf.h
172 if [ "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" = "perl" ]; then
173 install -m 0755 ${S}/tools/c_rehash ${D}${bindir}
174 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${bindir}/c_rehash
175 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl
176 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget
177 # The c_rehash utility isn't installed by the normal installation process.
178 else
179 rm -f ${D}${bindir}/c_rehash
180 rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget
181 fi
182}
183
184do_install_ptest () {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500185 cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH}
186 cp Configure config e_os.h ${D}${PTEST_PATH}
187 cp -r -L include ${D}${PTEST_PATH}
188 ln -sf ${base_libdir}/libcrypto.a ${D}${PTEST_PATH}
189 ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH}
190 mkdir -p ${D}${PTEST_PATH}/crypto
191 cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500192 cp -r certs ${D}${PTEST_PATH}
193 mkdir -p ${D}${PTEST_PATH}/apps
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500194 ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps
195 ln -sf ${libdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps
196 ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500197 cp apps/server2.pem ${D}${PTEST_PATH}/apps
198 mkdir -p ${D}${PTEST_PATH}/util
199 install util/opensslwrap.sh ${D}${PTEST_PATH}/util
200 install util/shlib_wrap.sh ${D}${PTEST_PATH}/util
201}
202
203do_install_append_class-native() {
204 create_wrapper ${D}${bindir}/openssl \
205 OPENSSL_CONF=${libdir}/ssl/openssl.cnf \
206 SSL_CERT_DIR=${libdir}/ssl/certs \
207 SSL_CERT_FILE=${libdir}/ssl/cert.pem \
208 OPENSSL_ENGINES=${libdir}/ssl/engines
209}
210
211BBCLASSEXTEND = "native nativesdk"