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