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