diff options
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl10.inc')
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl10.inc | 266 |
1 files changed, 266 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl10.inc b/meta/recipes-connectivity/openssl/openssl10.inc new file mode 100644 index 0000000000..c93d5d8738 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl10.inc | |||
@@ -0,0 +1,266 @@ | |||
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 = "makedepend-native hostperl-runtime-native" | ||
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 | TERMIO_libc-musl = "-DTERMIOS" | ||
21 | TERMIO ?= "-DTERMIO" | ||
22 | # Avoid binaries being marked as requiring an executable stack since it | ||
23 | # doesn't(which causes and this causes issues with SELinux | ||
24 | CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \ | ||
25 | ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack" | ||
26 | |||
27 | export DIRS = "crypto ssl apps" | ||
28 | export EX_LIBS = "-lgcc -ldl" | ||
29 | export AS = "${CC} -c" | ||
30 | |||
31 | inherit pkgconfig siteinfo multilib_header ptest relative_symlinks | ||
32 | |||
33 | PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf" | ||
34 | FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}" | ||
35 | FILES_libssl = "${libdir}/libssl${SOLIBS}" | ||
36 | FILES_${PN} =+ " ${libdir}/ssl/*" | ||
37 | FILES_${PN}-misc = "${libdir}/ssl/misc" | ||
38 | RDEPENDS_${PN}-misc = "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" | ||
39 | |||
40 | # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto | ||
41 | # package RRECOMMENDS on this package. This will enable the configuration | ||
42 | # file to be installed for both the base openssl package and the libcrypto | ||
43 | # package since the base openssl package depends on the libcrypto package. | ||
44 | FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
45 | CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
46 | RRECOMMENDS_libcrypto += "openssl-conf" | ||
47 | RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc" | ||
48 | |||
49 | # Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE | ||
50 | # vulnerability | ||
51 | EXTRA_OECONF = " -no-ssl3" | ||
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 | case $os in | ||
65 | linux-gnueabi |\ | ||
66 | linux-gnuspe |\ | ||
67 | linux-musleabi |\ | ||
68 | linux-muslspe |\ | ||
69 | linux-musl ) | ||
70 | os=linux | ||
71 | ;; | ||
72 | *) | ||
73 | ;; | ||
74 | esac | ||
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-aarch64 | ||
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 | linux-muslx32-x86_64 ) | ||
102 | target=linux-x32 | ||
103 | ;; | ||
104 | linux-gnu64-x86_64) | ||
105 | target=linux-x86_64 | ||
106 | ;; | ||
107 | linux-gnun32-mips*el) | ||
108 | target=debian-mipsn32el | ||
109 | ;; | ||
110 | linux-gnun32-mips*) | ||
111 | target=debian-mipsn32 | ||
112 | ;; | ||
113 | linux-mips*64*el) | ||
114 | target=debian-mips64el | ||
115 | ;; | ||
116 | linux-mips*64*) | ||
117 | target=debian-mips64 | ||
118 | ;; | ||
119 | linux-mips*el) | ||
120 | target=debian-mipsel | ||
121 | ;; | ||
122 | linux-mips*) | ||
123 | target=debian-mips | ||
124 | ;; | ||
125 | linux-microblaze*|linux-nios2*) | ||
126 | target=linux-generic32 | ||
127 | ;; | ||
128 | linux-powerpc) | ||
129 | target=linux-ppc | ||
130 | ;; | ||
131 | linux-powerpc64) | ||
132 | target=linux-ppc64 | ||
133 | ;; | ||
134 | linux-supersparc) | ||
135 | target=linux-sparcv8 | ||
136 | ;; | ||
137 | linux-sparc) | ||
138 | target=linux-sparcv8 | ||
139 | ;; | ||
140 | darwin-i386) | ||
141 | target=darwin-i386-cc | ||
142 | ;; | ||
143 | esac | ||
144 | # inject machine-specific flags | ||
145 | sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure | ||
146 | useprefix=${prefix} | ||
147 | if [ "x$useprefix" = "x" ]; then | ||
148 | useprefix=/ | ||
149 | fi | ||
150 | perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=`basename ${libdir}` $target | ||
151 | } | ||
152 | |||
153 | do_compile_prepend_class-target () { | ||
154 | sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile | ||
155 | } | ||
156 | |||
157 | do_compile () { | ||
158 | oe_runmake depend | ||
159 | oe_runmake | ||
160 | } | ||
161 | |||
162 | do_compile_ptest () { | ||
163 | # build dependencies for test directory too | ||
164 | export DIRS="$DIRS test" | ||
165 | oe_runmake depend | ||
166 | oe_runmake buildtest | ||
167 | } | ||
168 | |||
169 | do_install () { | ||
170 | # Create ${D}/${prefix} to fix parallel issues | ||
171 | mkdir -p ${D}/${prefix}/ | ||
172 | |||
173 | oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install | ||
174 | |||
175 | oe_libinstall -so libcrypto ${D}${libdir} | ||
176 | oe_libinstall -so libssl ${D}${libdir} | ||
177 | |||
178 | install -d ${D}${includedir} | ||
179 | cp --dereference -R include/openssl ${D}${includedir} | ||
180 | |||
181 | install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash | ||
182 | sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash | ||
183 | |||
184 | oe_multilib_header openssl/opensslconf.h | ||
185 | if [ "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" ]; then | ||
186 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl | ||
187 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget | ||
188 | else | ||
189 | rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget | ||
190 | fi | ||
191 | |||
192 | # Create SSL structure | ||
193 | install -d ${D}${sysconfdir}/ssl/ | ||
194 | mv ${D}${libdir}/ssl/openssl.cnf \ | ||
195 | ${D}${libdir}/ssl/certs \ | ||
196 | ${D}${libdir}/ssl/private \ | ||
197 | \ | ||
198 | ${D}${sysconfdir}/ssl/ | ||
199 | ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs | ||
200 | ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private | ||
201 | ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf | ||
202 | } | ||
203 | |||
204 | do_install_ptest () { | ||
205 | cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH} | ||
206 | |||
207 | # Replace the path to native perl with the path to target perl | ||
208 | sed -i 's,^PERL=.*,PERL=${bindir}/perl,' ${D}${PTEST_PATH}/Makefile | ||
209 | |||
210 | cp Configure config e_os.h ${D}${PTEST_PATH} | ||
211 | cp -r -L include ${D}${PTEST_PATH} | ||
212 | ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH} | ||
213 | ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH} | ||
214 | mkdir -p ${D}${PTEST_PATH}/crypto | ||
215 | cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto | ||
216 | cp -r certs ${D}${PTEST_PATH} | ||
217 | mkdir -p ${D}${PTEST_PATH}/apps | ||
218 | ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps | ||
219 | ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps | ||
220 | ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps | ||
221 | cp apps/server.pem ${D}${PTEST_PATH}/apps | ||
222 | cp apps/server2.pem ${D}${PTEST_PATH}/apps | ||
223 | mkdir -p ${D}${PTEST_PATH}/util | ||
224 | install util/opensslwrap.sh ${D}${PTEST_PATH}/util | ||
225 | install util/shlib_wrap.sh ${D}${PTEST_PATH}/util | ||
226 | # Time stamps are relevant for "make alltests", otherwise | ||
227 | # make may try to recompile binaries. Not only must the | ||
228 | # binary files be newer than the sources, they also must | ||
229 | # be more recent than the header files in /usr/include. | ||
230 | # | ||
231 | # Using "cp -a" is not sufficient, because do_install | ||
232 | # does not preserve the original time stamps. | ||
233 | # | ||
234 | # So instead of using the original file stamps, we set | ||
235 | # the current time for all files. Binaries will get | ||
236 | # modified again later when stripping them, but that's okay. | ||
237 | touch ${D}${PTEST_PATH} | ||
238 | find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH} | ||
239 | |||
240 | # exclude binary files or the package won't install | ||
241 | for d in ssltest_old v3ext x509aux; do | ||
242 | rm -rf ${D}${libdir}/${BPN}/ptest/test/$d | ||
243 | done | ||
244 | } | ||
245 | |||
246 | do_install_append_class-native() { | ||
247 | create_wrapper ${D}${bindir}/openssl \ | ||
248 | OPENSSL_CONF=${libdir}/ssl/openssl.cnf \ | ||
249 | SSL_CERT_DIR=${libdir}/ssl/certs \ | ||
250 | SSL_CERT_FILE=${libdir}/ssl/cert.pem \ | ||
251 | OPENSSL_ENGINES=${libdir}/ssl/engines | ||
252 | } | ||
253 | |||
254 | BBCLASSEXTEND = "native nativesdk" | ||
255 | |||
256 | PACKAGE_PREPROCESS_FUNCS += "openssl_package_preprocess" | ||
257 | |||
258 | openssl_package_preprocess () { | ||
259 | for file in `find ${PKGD} -name *.h -o -name *.pc -o -name *.so`; do | ||
260 | rm $file | ||
261 | done | ||
262 | rm ${PKGD}/usr/bin/openssl | ||
263 | rm ${PKGD}/usr/bin/c_rehash | ||
264 | rmdir ${PKGD}/usr/bin | ||
265 | |||
266 | } | ||