diff options
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl.inc')
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl.inc | 191 |
1 files changed, 191 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl.inc b/meta/recipes-connectivity/openssl/openssl.inc new file mode 100644 index 0000000000..82f3734525 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl.inc | |||
@@ -0,0 +1,191 @@ | |||
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 | |||
11 | DEPENDS = "perl-native-runtime" | ||
12 | |||
13 | SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ | ||
14 | " | ||
15 | S = "${WORKDIR}/openssl-${PV}" | ||
16 | |||
17 | PACKAGECONFIG[perl] = ",,," | ||
18 | |||
19 | AR_append = " r" | ||
20 | # Avoid binaries being marked as requiring an executable stack since it | ||
21 | # doesn't(which causes and this causes issues with SELinux | ||
22 | CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \ | ||
23 | -DTERMIO ${CFLAGS} -Wall -Wa,--noexecstack" | ||
24 | |||
25 | # -02 does not work on mipsel: ssh hangs when it tries to read /dev/urandom | ||
26 | CFLAG_mtx-1 := "${@'${CFLAG}'.replace('-O2', '')}" | ||
27 | CFLAG_mtx-2 := "${@'${CFLAG}'.replace('-O2', '')}" | ||
28 | |||
29 | export DIRS = "crypto ssl apps" | ||
30 | export EX_LIBS = "-lgcc -ldl" | ||
31 | export AS = "${CC} -c" | ||
32 | |||
33 | inherit pkgconfig siteinfo multilib_header ptest | ||
34 | |||
35 | PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf" | ||
36 | FILES_libcrypto = "${base_libdir}/libcrypto${SOLIBS}" | ||
37 | FILES_libssl = "${libdir}/libssl.so.*" | ||
38 | FILES_${PN} =+ " ${libdir}/ssl/*" | ||
39 | FILES_${PN}-misc = "${libdir}/ssl/misc ${libdir}/ssl/openssl.cnf ${bindir}/c_rehash" | ||
40 | RDEPENDS_${PN}-misc = "${@base_contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" | ||
41 | FILES_${PN}-dev += "${base_libdir}/libcrypto${SOLIBSDEV}" | ||
42 | |||
43 | # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto | ||
44 | # package RRECOMMENDS on this package. This will enable the configuration | ||
45 | # file to be installed for both the base openssl package and the libcrypto | ||
46 | # package since the base openssl package depends on the libcrypto package. | ||
47 | FILES_openssl-conf = "${libdir}/ssl/openssl.cnf" | ||
48 | CONFFILES_openssl-conf = "${libdir}/ssl/openssl.cnf" | ||
49 | RRECOMMENDS_libcrypto += "openssl-conf" | ||
50 | |||
51 | RDEPENDS_${PN}-ptest = "openssl-misc" | ||
52 | |||
53 | do_configure_prepend_darwin () { | ||
54 | sed -i -e '/version-script=openssl\.ld/d' Configure | ||
55 | } | ||
56 | |||
57 | do_configure () { | ||
58 | cd util | ||
59 | perl perlpath.pl ${STAGING_BINDIR_NATIVE} | ||
60 | cd .. | ||
61 | ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/ | ||
62 | |||
63 | os=${HOST_OS} | ||
64 | if [ "x$os" = "xlinux-uclibc" ]; then | ||
65 | os=linux | ||
66 | elif [ "x$os" = "xlinux-uclibceabi" ]; then | ||
67 | os=linux | ||
68 | elif [ "x$os" = "xlinux-uclibcspe" ]; then | ||
69 | os=linux | ||
70 | elif [ "x$os" = "xlinux-gnuspe" ]; then | ||
71 | os=linux | ||
72 | elif [ "x$os" = "xlinux-gnueabi" ]; then | ||
73 | os=linux | ||
74 | fi | ||
75 | target="$os-${HOST_ARCH}" | ||
76 | case $target in | ||
77 | linux-arm) | ||
78 | target=linux-armv4 | ||
79 | ;; | ||
80 | linux-armeb) | ||
81 | target=linux-elf-armeb | ||
82 | ;; | ||
83 | linux-aarch64*) | ||
84 | target=linux-generic64 | ||
85 | ;; | ||
86 | linux-sh3) | ||
87 | target=debian-sh3 | ||
88 | ;; | ||
89 | linux-sh4) | ||
90 | target=debian-sh4 | ||
91 | ;; | ||
92 | linux-i486) | ||
93 | target=debian-i386-i486 | ||
94 | ;; | ||
95 | linux-i586 | linux-viac3) | ||
96 | target=debian-i386-i586 | ||
97 | ;; | ||
98 | linux-i686) | ||
99 | target=debian-i386-i686/cmov | ||
100 | ;; | ||
101 | linux-gnux32-x86_64) | ||
102 | target=linux-x32 | ||
103 | ;; | ||
104 | linux-gnu64-x86_64) | ||
105 | target=linux-x86_64 | ||
106 | ;; | ||
107 | linux-mips) | ||
108 | target=debian-mips | ||
109 | ;; | ||
110 | linux-mipsel) | ||
111 | target=debian-mipsel | ||
112 | ;; | ||
113 | linux-*-mips64) | ||
114 | target=linux-mips | ||
115 | ;; | ||
116 | linux-powerpc) | ||
117 | target=linux-ppc | ||
118 | ;; | ||
119 | linux-powerpc64) | ||
120 | target=linux-ppc64 | ||
121 | ;; | ||
122 | linux-supersparc) | ||
123 | target=linux-sparcv8 | ||
124 | ;; | ||
125 | linux-sparc) | ||
126 | target=linux-sparcv8 | ||
127 | ;; | ||
128 | darwin-i386) | ||
129 | target=darwin-i386-cc | ||
130 | ;; | ||
131 | esac | ||
132 | # inject machine-specific flags | ||
133 | sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure | ||
134 | useprefix=${prefix} | ||
135 | if [ "x$useprefix" = "x" ]; then | ||
136 | useprefix=/ | ||
137 | fi | ||
138 | perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=`basename ${libdir}` $target | ||
139 | } | ||
140 | |||
141 | do_compile () { | ||
142 | oe_runmake | ||
143 | } | ||
144 | |||
145 | do_compile_ptest () { | ||
146 | oe_runmake buildtest | ||
147 | } | ||
148 | |||
149 | do_install () { | ||
150 | oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install | ||
151 | |||
152 | oe_libinstall -so libcrypto ${D}${libdir} | ||
153 | oe_libinstall -so libssl ${D}${libdir} | ||
154 | |||
155 | # Moving libcrypto to /lib | ||
156 | if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then | ||
157 | mkdir -p ${D}/${base_libdir}/ | ||
158 | mv ${D}${libdir}/libcrypto* ${D}${base_libdir}/ | ||
159 | sed -i s#libdir=\$\{exec_prefix\}\/lib#libdir=${base_libdir}# ${D}/${libdir}/pkgconfig/libcrypto.pc | ||
160 | fi | ||
161 | |||
162 | install -d ${D}${includedir} | ||
163 | cp --dereference -R include/openssl ${D}${includedir} | ||
164 | |||
165 | oe_multilib_header openssl/opensslconf.h | ||
166 | if [ "${@base_contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" = "perl" ]; then | ||
167 | install -m 0755 ${S}/tools/c_rehash ${D}${bindir} | ||
168 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${bindir}/c_rehash | ||
169 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl | ||
170 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget | ||
171 | # The c_rehash utility isn't installed by the normal installation process. | ||
172 | else | ||
173 | rm -f ${D}${bindir}/c_rehash | ||
174 | rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget | ||
175 | fi | ||
176 | } | ||
177 | |||
178 | do_install_ptest () { | ||
179 | cp -r Makefile test ${D}${PTEST_PATH} | ||
180 | mkdir -p ${D}${PTEST_PATH}/apps | ||
181 | ln -sf /usr/lib/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps | ||
182 | ln -sf /usr/lib/ssl/openssl.cnf ${D}${PTEST_PATH}/apps | ||
183 | ln -sf /usr/bin/openssl ${D}${PTEST_PATH}/apps | ||
184 | cp apps/server2.pem ${D}${PTEST_PATH}/apps | ||
185 | mkdir -p ${D}${PTEST_PATH}/util | ||
186 | install util/opensslwrap.sh ${D}${PTEST_PATH}/util | ||
187 | install util/shlib_wrap.sh ${D}${PTEST_PATH}/util | ||
188 | } | ||
189 | |||
190 | BBCLASSEXTEND = "native nativesdk" | ||
191 | |||