Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Secure Socket Layer" |
| 2 | DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools." |
| 3 | HOMEPAGE = "http://www.openssl.org/" |
| 4 | BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html" |
| 5 | SECTION = "libs/network" |
| 6 | |
| 7 | # "openssl | SSLeay" dual license |
| 8 | LICENSE = "openssl" |
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=f9a8f968107345e0b75aa8c2ecaa7ec8" |
| 10 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 11 | DEPENDS = "hostperl-runtime-native" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | DEPENDS_append_class-target = " openssl-native" |
| 13 | |
| 14 | SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ |
| 15 | " |
| 16 | S = "${WORKDIR}/openssl-${PV}" |
| 17 | |
| 18 | PACKAGECONFIG[perl] = ",,," |
| 19 | |
| 20 | AR_append = " r" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 21 | TERMIO_libc-musl = "-DTERMIOS" |
| 22 | TERMIO ?= "-DTERMIO" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | # Avoid binaries being marked as requiring an executable stack since it |
| 24 | # doesn't(which causes and this causes issues with SELinux |
| 25 | CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 26 | ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | |
| 28 | export DIRS = "crypto ssl apps" |
| 29 | export EX_LIBS = "-lgcc -ldl" |
| 30 | export AS = "${CC} -c" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 31 | EXTRA_OEMAKE = "-e MAKEFLAGS=" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | |
| 33 | inherit pkgconfig siteinfo multilib_header ptest |
| 34 | |
| 35 | PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 36 | FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}" |
| 37 | FILES_libssl = "${libdir}/libssl${SOLIBS}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | FILES_${PN} =+ " ${libdir}/ssl/*" |
| 39 | FILES_${PN}-misc = "${libdir}/ssl/misc ${bindir}/c_rehash" |
| 40 | RDEPENDS_${PN}-misc = "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 41 | |
| 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. |
| 46 | FILES_openssl-conf = "${libdir}/ssl/openssl.cnf" |
| 47 | CONFFILES_openssl-conf = "${libdir}/ssl/openssl.cnf" |
| 48 | RRECOMMENDS_libcrypto += "openssl-conf" |
| 49 | RDEPENDS_${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 |
| 53 | EXTRA_OECONF = " -no-ssl3" |
| 54 | |
| 55 | do_configure_prepend_darwin () { |
| 56 | sed -i -e '/version-script=openssl\.ld/d' Configure |
| 57 | } |
| 58 | |
| 59 | do_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 Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 116 | linux-*-mips64 | linux-mips64) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 117 | target=linux-mips |
| 118 | ;; |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 119 | linux-microblaze*|linux-nios2*) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 120 | 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 | |
| 147 | do_compile_prepend_class-target () { |
| 148 | sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile |
| 149 | } |
| 150 | |
| 151 | do_compile () { |
| 152 | oe_runmake |
| 153 | } |
| 154 | |
| 155 | do_compile_ptest () { |
| 156 | oe_runmake buildtest |
| 157 | } |
| 158 | |
| 159 | do_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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 168 | 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 | |
| 184 | do_install_ptest () { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 185 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 192 | cp -r certs ${D}${PTEST_PATH} |
| 193 | mkdir -p ${D}${PTEST_PATH}/apps |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 194 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 197 | 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 | |
| 203 | do_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 | |
| 211 | BBCLASSEXTEND = "native nativesdk" |