blob: 8af423f1a748ba2c00c7ff626960d7387b188508 [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
11DEPENDS = "perl-native-runtime"
12DEPENDS_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"
21# Avoid binaries being marked as requiring an executable stack since it
22# doesn't(which causes and this causes issues with SELinux
23CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
24 -DTERMIO ${CFLAGS} -Wall -Wa,--noexecstack"
25
26# -02 does not work on mipsel: ssh hangs when it tries to read /dev/urandom
27CFLAG_mtx-1 := "${@'${CFLAG}'.replace('-O2', '')}"
28CFLAG_mtx-2 := "${@'${CFLAG}'.replace('-O2', '')}"
29
30export DIRS = "crypto ssl apps"
31export EX_LIBS = "-lgcc -ldl"
32export AS = "${CC} -c"
33
34inherit pkgconfig siteinfo multilib_header ptest
35
36PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf"
37FILES_libcrypto = "${base_libdir}/libcrypto${SOLIBS}"
38FILES_libssl = "${libdir}/libssl.so.*"
39FILES_${PN} =+ " ${libdir}/ssl/*"
40FILES_${PN}-misc = "${libdir}/ssl/misc ${bindir}/c_rehash"
41RDEPENDS_${PN}-misc = "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}"
42FILES_${PN}-dev += "${base_libdir}/libcrypto${SOLIBSDEV}"
43
44# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
45# package RRECOMMENDS on this package. This will enable the configuration
46# file to be installed for both the base openssl package and the libcrypto
47# package since the base openssl package depends on the libcrypto package.
48FILES_openssl-conf = "${libdir}/ssl/openssl.cnf"
49CONFFILES_openssl-conf = "${libdir}/ssl/openssl.cnf"
50RRECOMMENDS_libcrypto += "openssl-conf"
51RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc"
52
53# Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE
54# vulnerability
55EXTRA_OECONF = " -no-ssl3"
56
57do_configure_prepend_darwin () {
58 sed -i -e '/version-script=openssl\.ld/d' Configure
59}
60
61do_configure () {
62 cd util
63 perl perlpath.pl ${STAGING_BINDIR_NATIVE}
64 cd ..
65 ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
66
67 os=${HOST_OS}
68 case $os in
69 linux-uclibc |\
70 linux-uclibceabi |\
71 linux-gnueabi |\
72 linux-uclibcspe |\
73 linux-gnuspe |\
74 linux-musl*)
75 os=linux
76 ;;
77 *)
78 ;;
79 esac
80 target="$os-${HOST_ARCH}"
81 case $target in
82 linux-arm)
83 target=linux-armv4
84 ;;
85 linux-armeb)
86 target=linux-elf-armeb
87 ;;
88 linux-aarch64*)
89 target=linux-generic64
90 ;;
91 linux-sh3)
92 target=debian-sh3
93 ;;
94 linux-sh4)
95 target=debian-sh4
96 ;;
97 linux-i486)
98 target=debian-i386-i486
99 ;;
100 linux-i586 | linux-viac3)
101 target=debian-i386-i586
102 ;;
103 linux-i686)
104 target=debian-i386-i686/cmov
105 ;;
106 linux-gnux32-x86_64)
107 target=linux-x32
108 ;;
109 linux-gnu64-x86_64)
110 target=linux-x86_64
111 ;;
112 linux-mips)
113 target=debian-mips
114 ;;
115 linux-mipsel)
116 target=debian-mipsel
117 ;;
118 linux-*-mips64)
119 target=linux-mips
120 ;;
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500121 linux-microblaze*|linux-nios2*)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500122 target=linux-generic32
123 ;;
124 linux-powerpc)
125 target=linux-ppc
126 ;;
127 linux-powerpc64)
128 target=linux-ppc64
129 ;;
130 linux-supersparc)
131 target=linux-sparcv8
132 ;;
133 linux-sparc)
134 target=linux-sparcv8
135 ;;
136 darwin-i386)
137 target=darwin-i386-cc
138 ;;
139 esac
140 # inject machine-specific flags
141 sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure
142 useprefix=${prefix}
143 if [ "x$useprefix" = "x" ]; then
144 useprefix=/
145 fi
146 perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=`basename ${libdir}` $target
147}
148
149do_compile_prepend_class-target () {
150 sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile
151}
152
153do_compile () {
154 oe_runmake
155}
156
157do_compile_ptest () {
158 oe_runmake buildtest
159}
160
161do_install () {
162 # Create ${D}/${prefix} to fix parallel issues
163 mkdir -p ${D}/${prefix}/
164
165 oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install
166
167 oe_libinstall -so libcrypto ${D}${libdir}
168 oe_libinstall -so libssl ${D}${libdir}
169
170 # Moving libcrypto to /lib
171 if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
172 mkdir -p ${D}/${base_libdir}/
173 mv ${D}${libdir}/libcrypto* ${D}${base_libdir}/
174 sed -i s#libdir=\$\{exec_prefix\}\/lib#libdir=${base_libdir}# ${D}/${libdir}/pkgconfig/libcrypto.pc
175 fi
176
177 install -d ${D}${includedir}
178 cp --dereference -R include/openssl ${D}${includedir}
179
180 oe_multilib_header openssl/opensslconf.h
181 if [ "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" = "perl" ]; then
182 install -m 0755 ${S}/tools/c_rehash ${D}${bindir}
183 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${bindir}/c_rehash
184 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl
185 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget
186 # The c_rehash utility isn't installed by the normal installation process.
187 else
188 rm -f ${D}${bindir}/c_rehash
189 rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget
190 fi
191}
192
193do_install_ptest () {
194 cp -r Makefile test ${D}${PTEST_PATH}
195 cp -r certs ${D}${PTEST_PATH}
196 mkdir -p ${D}${PTEST_PATH}/apps
197 ln -sf /usr/lib/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps
198 ln -sf /usr/lib/ssl/openssl.cnf ${D}${PTEST_PATH}/apps
199 ln -sf /usr/bin/openssl ${D}${PTEST_PATH}/apps
200 cp apps/server2.pem ${D}${PTEST_PATH}/apps
201 mkdir -p ${D}${PTEST_PATH}/util
202 install util/opensslwrap.sh ${D}${PTEST_PATH}/util
203 install util/shlib_wrap.sh ${D}${PTEST_PATH}/util
204}
205
206do_install_append_class-native() {
207 create_wrapper ${D}${bindir}/openssl \
208 OPENSSL_CONF=${libdir}/ssl/openssl.cnf \
209 SSL_CERT_DIR=${libdir}/ssl/certs \
210 SSL_CERT_FILE=${libdir}/ssl/cert.pem \
211 OPENSSL_ENGINES=${libdir}/ssl/engines
212}
213
214BBCLASSEXTEND = "native nativesdk"