1 |
%define maj 1.0.0 |
2 |
%define engines_name %mklibname openssl-engines %{maj} |
3 |
%define libname %mklibname openssl %{maj} |
4 |
%define develname %mklibname openssl -d |
5 |
%define staticname %mklibname openssl -s -d |
6 |
|
7 |
%define conflict1 %mklibname openssl 0.9.7 |
8 |
%define conflict2 %mklibname openssl 0.9.8 |
9 |
|
10 |
# Number of threads to spawn when testing some threading fixes. |
11 |
#define thread_test_threads %{?threads:%{threads}}%{!?threads:1} |
12 |
|
13 |
# French policy is to not use ciphers stronger than 128 bits |
14 |
%define french_policy 0 |
15 |
|
16 |
%define with_krb5 %{?_with_krb5:1}%{!?_with_krb5:0} |
17 |
|
18 |
Summary: Secure Sockets Layer communications libs & utils |
19 |
Name: openssl |
20 |
Version: %{maj}c |
21 |
Release: %mkrel 1 |
22 |
License: BSD-like |
23 |
Group: System/Libraries |
24 |
URL: http://www.openssl.org/ |
25 |
Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz |
26 |
Source1: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz.asc |
27 |
Source2: Makefile.certificate |
28 |
Source3: make-dummy-cert |
29 |
Source4: openssl-thread-test.c |
30 |
Source5: README.pkcs11 |
31 |
# (gb) 0.9.6b-5mdk: Limit available SSL ciphers to 128 bits |
32 |
Patch0: openssl-0.9.6b-mdkconfig.patch |
33 |
# (gb) 0.9.7b-4mdk: Handle RPM_OPT_FLAGS in Configure |
34 |
Patch2: openssl-optflags.diff |
35 |
# (oe) support Brazilian Government OTHERNAME X509v3 field (#14158) |
36 |
# http://www.iti.gov.br/resolucoes/RESOLU__O_13_DE_26_04_2002.PDF |
37 |
Patch6: openssl-0.9.8-beta6-icpbrasil.diff |
38 |
Patch7: openssl-1.0.0-defaults.patch |
39 |
Patch8: openssl-0.9.8a-link-krb5.patch |
40 |
Patch10: openssl-0.9.7-beta6-ia64.patch |
41 |
Patch12: openssl-0.9.6-x509.patch |
42 |
Patch13: openssl-0.9.7-beta5-version-add-engines.patch |
43 |
# http://qa.mandriva.com/show_bug.cgi?id=32621 |
44 |
Patch15: openssl-0.9.8e-crt.patch |
45 |
# http://blogs.sun.com/janp/ |
46 |
Patch16: pkcs11_engine-1.0.0.diff |
47 |
# MIPS and ARM support |
48 |
Patch300: openssl-1.0.0-mips.patch |
49 |
Patch301: openssl-1.0.0-arm.patch |
50 |
Patch302: openssl-1.0.0-enginesdir.patch |
51 |
Requires: %{libname} = %{version}-%{release} |
52 |
Requires: perl-base |
53 |
Requires: rootcerts |
54 |
%{?_with_krb5:BuildRequires: krb5-devel} |
55 |
BuildRequires: multiarch-utils >= 1.0.3 |
56 |
BuildRequires: chrpath |
57 |
BuildRequires: zlib-devel |
58 |
# (tv) for test suite: |
59 |
BuildRequires: bc |
60 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot |
61 |
|
62 |
%description |
63 |
The openssl certificate management tool and the shared libraries that provide |
64 |
various encryption and decription algorithms and protocols, including DES, RC4, |
65 |
RSA and SSL. |
66 |
|
67 |
%package -n %{engines_name} |
68 |
Summary: Engines for openssl |
69 |
Group: System/Libraries |
70 |
Obsoletes: openssl-engines < 1.0.0a-5 |
71 |
Provides: openssl-engines = %{version}-%{release} |
72 |
|
73 |
%description -n %{engines_name} |
74 |
This package provides engines for openssl. |
75 |
|
76 |
%package -n %{libname} |
77 |
Summary: Secure Sockets Layer communications libs |
78 |
Group: System/Libraries |
79 |
Requires: %{engines_name} >= %{version}-%{release} |
80 |
Provides: %{libname} = %{version}-%{release} |
81 |
|
82 |
%description -n %{libname} |
83 |
The libraries files are needed for various cryptographic algorithms |
84 |
and protocols, including DES, RC4, RSA and SSL. |
85 |
|
86 |
%package -n %{develname} |
87 |
Summary: Secure Sockets Layer communications libs & headers & utils |
88 |
Group: Development/Other |
89 |
Requires: %{libname} = %{version}-%{release} |
90 |
Provides: libopenssl-devel |
91 |
Provides: openssl-devel = %{version}-%{release} |
92 |
Obsoletes: openssl-devel |
93 |
# temporary opsolete, will be a conflict later. a compat package |
94 |
# with openssl-0.9.7 devel libs will be provided soon |
95 |
Obsoletes: %{conflict1}-devel |
96 |
Obsoletes: %{conflict2}-devel |
97 |
Obsoletes: %{mklibname openssl 1.0.0}-devel |
98 |
Provides: %{name}-devel = %{version}-%{release} |
99 |
|
100 |
%description -n %{develname} |
101 |
The libraries and include files needed to compile apps with support |
102 |
for various cryptographic algorithms and protocols, including DES, RC4, RSA |
103 |
and SSL. |
104 |
|
105 |
%package -n %{staticname} |
106 |
Summary: Secure Sockets Layer communications static libs |
107 |
Group: Development/Other |
108 |
Requires: %{develname} = %{version}-%{release} |
109 |
Provides: libopenssl-static-devel |
110 |
Provides: openssl-static-devel = %{version}-%{release} |
111 |
# temporary opsolete, will be a conflict later. a compat package |
112 |
# with openssl-0.9.7 static-devel libs will be provided soon |
113 |
Obsoletes: %{conflict1}-static-devel |
114 |
Obsoletes: %{conflict2}-static-devel |
115 |
Obsoletes: %{mklibname openssl 1.0.0}-static-devel |
116 |
Provides: %{name}-static-devel = %{version}-%{release} |
117 |
|
118 |
%description -n %{staticname} |
119 |
The static libraries needed to compile apps with support for various |
120 |
cryptographic algorithms and protocols, including DES, RC4, RSA and SSL. |
121 |
|
122 |
%prep |
123 |
|
124 |
%setup -q -n %{name}-%{version} |
125 |
%if %{french_policy} |
126 |
%patch0 -p1 -b .frenchpolicy |
127 |
%endif |
128 |
%patch2 -p1 -b .optflags |
129 |
%patch6 -p0 -b .icpbrasil |
130 |
%patch7 -p1 -b .defaults |
131 |
%{?_with_krb5:%patch8 -p1 -b .krb5} |
132 |
%patch10 -p0 -b .ia64 |
133 |
%patch12 -p1 -b .x509 |
134 |
%patch13 -p1 -b .version-add-engines |
135 |
%patch15 -p1 -b .crt |
136 |
%patch16 -p1 -b .pkcs11_engine |
137 |
|
138 |
%patch300 -p1 -b .mips |
139 |
%patch301 -p1 -b .arm |
140 |
%patch302 -p1 -b .engines |
141 |
|
142 |
perl -pi -e "s,^(OPENSSL_LIBNAME=).+$,\1%{_lib}," Makefile.org engines/Makefile |
143 |
|
144 |
# fix perl path |
145 |
perl util/perlpath.pl %{_bindir}/perl |
146 |
|
147 |
cp %{SOURCE2} Makefile.certificate |
148 |
cp %{SOURCE3} make-dummy-cert |
149 |
cp %{SOURCE4} openssl-thread-test.c |
150 |
cp %{SOURCE5} README.pkcs11 |
151 |
|
152 |
%build |
153 |
%serverbuild |
154 |
|
155 |
# Figure out which flags we want to use. |
156 |
# default |
157 |
sslarch=%{_os}-%{_arch} |
158 |
%ifarch %ix86 |
159 |
sslarch=linux-elf |
160 |
if ! echo %{_target} | grep -q i[56]86 ; then |
161 |
sslflags="no-asm" |
162 |
fi |
163 |
%endif |
164 |
%ifarch sparcv9 |
165 |
sslarch=linux-sparcv9 |
166 |
%endif |
167 |
%ifarch alpha |
168 |
sslarch=linux-alpha-gcc |
169 |
%endif |
170 |
%ifarch s390 |
171 |
sslarch="linux-generic32 -DB_ENDIAN -DNO_ASM" |
172 |
%endif |
173 |
%ifarch s390x |
174 |
sslarch="linux-generic64 -DB_ENDIAN -DNO_ASM" |
175 |
%endif |
176 |
|
177 |
# ia64, x86_64, ppc, ppc64 are OK by default |
178 |
# Configure the build tree. Override OpenSSL defaults with known-good defaults |
179 |
# usable on all platforms. The Configure script already knows to use -fPIC and |
180 |
# RPM_OPT_FLAGS, so we can skip specifiying them here. |
181 |
./Configure \ |
182 |
--openssldir=%{_sysconfdir}/pki/tls ${sslflags} \ |
183 |
--enginesdir=%{_libdir}/openssl-%{version}/engines \ |
184 |
--prefix=%{_prefix} --libdir=%{_lib}/ %{?_with_krb5:--with-krb5-flavor=MIT -I%{_prefix}/kerberos/include -L%{_prefix}/kerberos/%{_lib}} \ |
185 |
no-idea no-rc5 enable-camellia shared enable-tlsext ${sslarch} --pk11-libname=%{_libdir}/pkcs11/PKCS11_API.so |
186 |
|
187 |
# zlib no-idea no-mdc2 no-rc5 no-ec no-ecdh no-ecdsa shared ${sslarch} |
188 |
|
189 |
# Add -Wa,--noexecstack here so that libcrypto's assembler modules will be |
190 |
# marked as not requiring an executable stack. |
191 |
RPM_OPT_FLAGS="%{optflags} -Wa,--noexecstack" |
192 |
make depend |
193 |
make all build-shared |
194 |
|
195 |
# Generate hashes for the included certs. |
196 |
make rehash build-shared |
197 |
|
198 |
%check |
199 |
# Verify that what was compiled actually works. |
200 |
export LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} |
201 |
|
202 |
make -C test apps tests |
203 |
|
204 |
gcc -o openssl-thread-test \ |
205 |
%{?_with_krb5:`krb5-config --cflags`} \ |
206 |
-I./include \ |
207 |
%{optflags} \ |
208 |
openssl-thread-test.c \ |
209 |
-L. -lssl -lcrypto \ |
210 |
%{?_with_krb5:`krb5-config --libs`} \ |
211 |
-lpthread -lz -ldl |
212 |
|
213 |
./openssl-thread-test --threads %{thread_test_threads} |
214 |
|
215 |
%install |
216 |
rm -fr %{buildroot} |
217 |
|
218 |
%makeinstall \ |
219 |
INSTALL_PREFIX=%{buildroot} \ |
220 |
MANDIR=%{_mandir} \ |
221 |
build-shared |
222 |
|
223 |
# the makefiles is too borked... |
224 |
install -d %{buildroot}%{_libdir}/openssl-%{version} |
225 |
mv %{buildroot}%{_libdir}/engines %{buildroot}%{_libdir}/openssl-%{version}/engines |
226 |
|
227 |
# make the rootcerts dir |
228 |
install -d %{buildroot}%{_sysconfdir}/pki/tls/rootcerts |
229 |
|
230 |
# Install a makefile for generating keys and self-signed certs, and a script |
231 |
# for generating them on the fly. |
232 |
install -d %{buildroot}%{_sysconfdir}/pki/tls/certs |
233 |
install -m0644 Makefile.certificate %{buildroot}%{_sysconfdir}/pki/tls/certs/Makefile |
234 |
install -m0755 make-dummy-cert %{buildroot}%{_sysconfdir}/pki/tls/certs/make-dummy-cert |
235 |
|
236 |
# Pick a CA script. |
237 |
mv %{buildroot}%{_sysconfdir}/pki/tls/misc/CA.sh %{buildroot}%{_sysconfdir}/pki/tls/misc/CA |
238 |
|
239 |
install -d %{buildroot}%{_sysconfdir}/pki/CA |
240 |
install -d %{buildroot}%{_sysconfdir}/pki/CA/private |
241 |
|
242 |
# openssl was named ssleay in "ancient" times. |
243 |
ln -snf openssl %{buildroot}%{_bindir}/ssleay |
244 |
|
245 |
# The man pages rand.3 and passwd.1 conflict with other packages |
246 |
# Rename them to ssl-* and also make a symlink from openssl-* to ssl-* |
247 |
mv %{buildroot}%{_mandir}/man1/passwd.1 %{buildroot}%{_mandir}/man1/ssl-passwd.1 |
248 |
ln -sf ssl-passwd.1.bz2 %{buildroot}%{_mandir}/man1/openssl-passwd.1.bz2 |
249 |
|
250 |
for i in rand err; do |
251 |
mv %{buildroot}%{_mandir}/man3/$i.3 %{buildroot}%{_mandir}/man3/ssl-$i.3 |
252 |
ln -snf ssl-$i.3.bz2 %{buildroot}%{_mandir}/man3/openssl-$i.3.bz2 |
253 |
done |
254 |
|
255 |
rm -rf {main,devel}-doc-info |
256 |
mkdir -p {main,devel}-doc-info |
257 |
cat - << EOF > main-doc-info/README.Mandriva-manpage |
258 |
Warning: |
259 |
The man page of passwd, passwd.1, has been renamed to ssl-passwd.1 |
260 |
to avoid a conflict with passwd.1 man page from the package passwd. |
261 |
EOF |
262 |
|
263 |
cat - << EOF > devel-doc-info/README.Mandriva-manpage |
264 |
Warning: |
265 |
The man page of rand, rand.3, has been renamed to ssl-rand.3 |
266 |
to avoid a conflict with rand.3 from the package man-pages |
267 |
The man page of err, err.3, has been renamed to ssl-err.3 |
268 |
to avoid a conflict with err.3 from the package man-pages |
269 |
EOF |
270 |
|
271 |
chmod 755 %{buildroot}%{_libdir}/pkgconfig |
272 |
|
273 |
%multiarch_includes %{buildroot}%{_includedir}/openssl/opensslconf.h |
274 |
|
275 |
# strip cannot touch these unless 755 |
276 |
chmod 755 %{buildroot}%{_libdir}/openssl-%{version}/engines/*.so* |
277 |
chmod 755 %{buildroot}%{_libdir}/*.so* |
278 |
chmod 755 %{buildroot}%{_bindir}/* |
279 |
|
280 |
# nuke a mistake |
281 |
rm -f %{buildroot}%{_mandir}/man3/.3 |
282 |
|
283 |
# nuke rpath |
284 |
chrpath -d %{buildroot}%{_bindir}/openssl |
285 |
|
286 |
# Fix libdir. |
287 |
pushd %{buildroot}%{_libdir}/pkgconfig |
288 |
for i in *.pc ; do |
289 |
sed 's,^libdir=${exec_prefix}/lib$,libdir=${exec_prefix}/%{_lib},g' \ |
290 |
$i >$i.tmp && \ |
291 |
cat $i.tmp >$i && \ |
292 |
rm -f $i.tmp |
293 |
done |
294 |
popd |
295 |
|
296 |
# adjust ssldir |
297 |
perl -pi -e "s|^CATOP=.*|CATOP=%{_sysconfdir}/pki/tls|g" %{buildroot}%{_sysconfdir}/pki/tls/misc/CA |
298 |
perl -pi -e "s|^\\\$CATOP\=\".*|\\\$CATOP\=\"%{_sysconfdir}/pki/tls\";|g" %{buildroot}%{_sysconfdir}/pki/tls/misc/CA.pl |
299 |
perl -pi -e "s|\./demoCA|%{_sysconfdir}/pki/tls|g" %{buildroot}%{_sysconfdir}/pki/tls/openssl.cnf |
300 |
|
301 |
%clean |
302 |
rm -fr %{buildroot} |
303 |
|
304 |
%files |
305 |
%defattr(-,root,root) |
306 |
%doc FAQ INSTALL LICENSE NEWS PROBLEMS main-doc-info/README* |
307 |
%doc README README.ASN1 README.ENGINE README.pkcs11 |
308 |
%dir %{_sysconfdir}/pki |
309 |
%dir %{_sysconfdir}/pki/CA |
310 |
%dir %{_sysconfdir}/pki/CA/private |
311 |
%dir %{_sysconfdir}/pki/tls |
312 |
%dir %{_sysconfdir}/pki/tls/certs |
313 |
%dir %{_sysconfdir}/pki/tls/misc |
314 |
%dir %{_sysconfdir}/pki/tls/private |
315 |
%dir %{_sysconfdir}/pki/tls/rootcerts |
316 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pki/tls/openssl.cnf |
317 |
%attr(0755,root,root) %{_sysconfdir}/pki/tls/certs/make-dummy-cert |
318 |
%attr(0644,root,root) %{_sysconfdir}/pki/tls/certs/Makefile |
319 |
%attr(0755,root,root) %{_sysconfdir}/pki/tls/misc/* |
320 |
%attr(0755,root,root) %{_bindir}/* |
321 |
%attr(0644,root,root) %{_mandir}/man[157]/* |
322 |
|
323 |
%files -n %{libname} |
324 |
%defattr(-,root,root) |
325 |
%doc FAQ INSTALL LICENSE NEWS PROBLEMS README* |
326 |
%attr(0755,root,root) %{_libdir}/lib*.so.* |
327 |
|
328 |
%files -n %{engines_name} |
329 |
%defattr(-,root,root) |
330 |
%attr(0755,root,root) %dir %{_libdir}/openssl-%{version}/engines |
331 |
%attr(0755,root,root) %{_libdir}/openssl-%{version}/engines/*.so |
332 |
|
333 |
%files -n %{develname} |
334 |
%defattr(-,root,root) |
335 |
%doc CHANGES doc/* devel-doc-info/README* |
336 |
%attr(0755,root,root) %dir %{_includedir}/openssl |
337 |
%multiarch %{multiarch_includedir}/openssl/opensslconf.h |
338 |
%attr(0644,root,root) %{_includedir}/openssl/* |
339 |
%attr(0755,root,root) %{_libdir}/lib*.so |
340 |
%attr(0644,root,root) %{_mandir}/man3/* |
341 |
%attr(0644,root,root) %{_libdir}/pkgconfig/* |
342 |
|
343 |
%files -n %{staticname} |
344 |
%defattr(-,root,root) |
345 |
%attr(0644,root,root) %{_libdir}/lib*.a |
346 |
|
347 |
|