1 %define __strip %{_mingw32_strip}
2 %define __objdump %{_mingw32_objdump}
3 %define _use_internal_dependency_generator 0
4 %define __find_requires %{_mingw32_findrequires}
5 %define __find_provides %{_mingw32_findprovides}
10 # 0.9.6a soversion = 2
11 # 0.9.6c soversion = 3
12 # 0.9.7a soversion = 4
13 # 0.9.7ef soversion = 5
14 # 0.9.8ab soversion = 6
15 # 0.9.8g soversion = 7
16 # 0.9.8j + EAP-FAST soversion = 8
20 # These only work some of the time, but fail randomly at other times
21 # (although I have had them complete a few times, so I don't think
22 # there is any actual problem with the binaries).
25 # Number of threads to spawn when testing some threading fixes.
26 %define thread_test_threads %{?threads:%{threads}}%{!?threads:1}
31 Summary: MinGW port of the OpenSSL toolkit
34 Group: Development/Libraries
35 URL: http://www.openssl.org/
37 # Use the hobble-openssl script to create the source file.
38 Source0: openssl-%{version}-usa.tar.bz2
40 Source1: hobble-openssl
41 Source2: Makefile.certificate
42 Source6: make-dummy-cert
43 Source8: openssl-thread-test.c
44 Source9: opensslconf-new.h
45 Source10: opensslconf-new-warning.h
47 # Patches from Fedora native package.
49 Patch0: openssl-0.9.8j-redhat.patch
50 Patch1: openssl-0.9.8a-defaults.patch
51 Patch2: openssl-0.9.8a-link-krb5.patch
52 Patch3: openssl-0.9.8j-soversion.patch
53 Patch4: openssl-0.9.8j-enginesdir.patch
54 Patch5: openssl-0.9.8a-no-rpath.patch
55 Patch6: openssl-0.9.8b-test-use-localhost.patch
56 Patch7: openssl-0.9.8j-shlib-version.patch
58 Patch21: openssl-0.9.8b-aliasing-bug.patch
59 Patch22: openssl-0.9.8b-x509-name-cmp.patch
60 Patch23: openssl-0.9.8g-default-paths.patch
61 Patch24: openssl-0.9.8g-no-extssl.patch
62 # Functionality changes
63 Patch32: openssl-0.9.8g-ia64.patch
64 Patch33: openssl-0.9.8j-ca-dir.patch
65 Patch34: openssl-0.9.6-x509.patch
66 Patch35: openssl-0.9.8j-version-add-engines.patch
67 Patch38: openssl-0.9.8a-reuse-cipher-change.patch
68 # Disabled this because it uses getaddrinfo which is lacking on Windows.
69 #Patch39: openssl-0.9.8g-ipv6-apps.patch
70 Patch40: openssl-0.9.8j-nocanister.patch
71 Patch41: openssl-0.9.8j-use-fipscheck.patch
72 Patch42: openssl-0.9.8j-fipscheck-hmac.patch
73 Patch43: openssl-0.9.8j-evp-nonfips.patch
74 Patch44: openssl-0.9.8j-kernel-fipsmode.patch
75 Patch45: openssl-0.9.8j-env-nozlib.patch
76 Patch46: openssl-0.9.8j-eap-fast.patch
77 Patch47: openssl-0.9.8j-readme-warning.patch
78 Patch48: openssl-0.9.8j-bad-mime.patch
79 Patch49: openssl-0.9.8j-fips-no-pairwise.patch
80 # Backported fixes including security fixes
82 # MinGW-specific patches.
83 Patch100: mingw32-openssl-0.9.8j-header-files.patch
84 Patch101: mingw32-openssl-0.9.8j-configure.patch
85 Patch102: mingw32-openssl-0.9.8j-shared.patch
86 Patch103: mingw32-openssl-0.9.8g-global.patch
87 Patch104: mingw32-openssl-0.9.8g-sfx.patch
89 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
93 BuildRequires: mingw32-filesystem >= 40
94 BuildRequires: mingw32-gcc
95 BuildRequires: mingw32-binutils
97 BuildRequires: mingw32-zlib
98 BuildRequires: mingw32-pthreads
100 BuildRequires: mktemp
101 #BuildRequires: krb5-devel
104 BuildRequires: /usr/bin/cmp
105 BuildRequires: /usr/bin/rename
107 # XXX Not really sure about this one. The build script uses
108 # /usr/bin/makedepend which comes from imake.
112 # Required both to build, and to run the tests.
113 # XXX This needs to be fixed - cross-compilation should not
114 # require running executables.
117 # Required to run the tests.
118 BuildRequires: xorg-x11-server-Xvfb
121 #Requires: ca-certificates >= 2008-5
126 The OpenSSL toolkit provides support for secure communications between
127 machines. OpenSSL includes a certificate management tool and shared
128 libraries which provide various cryptographic algorithms and
131 This package contains Windows (MinGW) libraries and development tools.
135 %setup -q -n openssl-%{version}
137 %{SOURCE1} > /dev/null
138 %patch0 -p1 -b .redhat
139 %patch1 -p1 -b .defaults
140 # Fix link line for libssl (bug #111154).
142 %patch3 -p1 -b .soversion
143 %patch4 -p1 -b .enginesdir
144 %patch5 -p1 -b .no-rpath
145 %patch6 -p1 -b .use-localhost
146 %patch7 -p1 -b .shlib-version
148 %patch21 -p1 -b .aliasing-bug
149 %patch22 -p1 -b .name-cmp
150 %patch23 -p1 -b .default-paths
151 %patch24 -p1 -b .no-extssl
153 %patch32 -p1 -b .ia64
154 #patch33 is applied after make test
155 %patch34 -p1 -b .x509
156 %patch35 -p1 -b .version-add-engines
157 %patch38 -p1 -b .cipher-change
158 #%patch39 -p1 -b .ipv6-apps
159 %patch40 -p1 -b .nocanister
160 %patch41 -p1 -b .use-fipscheck
161 %patch42 -p1 -b .fipscheck-hmac
162 %patch43 -p1 -b .evp-nonfips
163 %patch44 -p1 -b .fipsmode
164 %patch45 -p1 -b .env-nozlib
165 %patch46 -p1 -b .eap-fast
166 %patch47 -p1 -b .warning
167 %patch48 -p1 -b .bad-mime
168 %patch49 -p1 -b .no-pairwise
170 %patch100 -p1 -b .mingw-header-files
171 %patch101 -p1 -b .mingw-configure
172 %patch102 -p1 -b .mingw-shared
173 %patch103 -p1 -b .mingw-global
174 %patch104 -p1 -b .mingw-sfx
176 # Modify the various perl scripts to reference perl in the right location.
177 perl util/perlpath.pl `dirname %{__perl}`
179 # Generate a table with the compile settings for my perusal.
181 make TABLE PERL=%{__perl}
184 # NB: 'no-hw' is vital. MinGW cannot build the hardware drivers
185 # and if you don't have this you'll get an obscure link error.
187 sed -i -e "s/MINGW32_CC/%{_mingw32_cc}/" -e "s/MINGW32_CFLAGS/%{_mingw32_cflags}/" -e "s/MINGW32_RANLIB/%{_mingw32_ranlib}/" Configure; \
189 --prefix=%{_mingw32_prefix} \
190 --openssldir=%{_mingw32_sysconfdir}/pki/tls \
191 zlib enable-camellia enable-seed enable-tlsext enable-rfc3779 \
192 no-idea no-mdc2 no-rc5 no-ec no-ecdh no-ecdsa no-hw shared \
193 --enginesdir=%{_mingw32_libdir}/openssl/engines \
195 # --with-krb5-flavor=MIT
196 # -I%{_mingw32_prefix}/kerberos/include -L%{_mingw32_prefix}/kerberos/%{_lib}
197 %{_mingw32_make} depend
198 %{_mingw32_make} all build-shared
200 # Generate hashes for the included certs.
201 %{_mingw32_make} rehash build-shared
204 #----------------------------------------------------------------------
205 # Run some tests. I don't know why this isn't in a %-check section
206 # but this is how it is in the native RPM.
208 # This is a bit of a hack, but the test scripts look for 'openssl'
211 ln -s openssl.exe openssl
214 # This is useful for diagnosing Wine problems.
218 # Make sure we can find the installed DLLs.
219 WINEDLLPATH=%{_mingw32_bindir}
222 # The tests run Wine and require an X server (but don't really use
223 # it). Therefore we create a virtual framebuffer for the duration of
225 # XXX There is no good way to choose a random, unused display.
226 # XXX Setting depth to 24 bits avoids bug 458219.
229 Xvfb $display -screen 0 1024x768x24 -ac -noreset & xpid=$!
230 trap "kill -TERM $xpid ||:" EXIT
235 %{_mingw32_make} LDCMD=%{_mingw32_cc} -C test apps tests
237 # Disable this thread test, because we don't have pthread on Windows.
238 %{_mingw32_cc} -o openssl-thread-test \
240 %-{_mingw32_cflags} \
246 ## `krb5-config --cflags`
247 ## `krb5-config --libs`
249 ./openssl-thread-test --threads %{thread_test_threads}
251 #----------------------------------------------------------------------
254 # Patch33 must be patched after tests otherwise they will fail
255 patch -p1 -b -z .ca-dir < %{PATCH33}
257 # Add generation of HMAC checksum of the final stripped library
258 #%define __spec_install_post \
259 # %{?__debug_package:%{__debug_install_post}} \
260 # %{__arch_install_post} \
261 # %{__os_install_post} \
262 # fips/fips_standalone_sha1 $RPM_BUILD_ROOT/%{_lib}/libcrypto.so.%{version} >$RPM_BUILD_ROOT/%{_lib}/.libcrypto.so.%{version}.hmac \
263 # ln -sf .libcrypto.so.%{version}.hmac $RPM_BUILD_ROOT/%{_lib}/.libcrypto.so.%{soversion}.hmac \
266 if ! iconv -f UTF-8 -t ASCII//TRANSLIT CHANGES >/dev/null 2>&1 ; then
267 iconv -f ISO-8859-1 -t UTF-8 -o CHANGES.utf8 CHANGES && \
268 mv -f CHANGES.utf8 CHANGES
273 rm -rf $RPM_BUILD_ROOT
274 mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}
275 mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}/openssl
276 mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir}
277 mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir}
278 mkdir -p $RPM_BUILD_ROOT%{_mingw32_mandir}
279 make INSTALL_PREFIX=$RPM_BUILD_ROOT install build-shared
281 # Install the actual DLLs.
282 install libcrypto-%{soversion}.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
283 install libssl-%{soversion}.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
285 # Remove static libraries but DON'T remove *.dll.a files.
286 rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libcrypto.a
287 rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libssl.a
289 # I have no idea why it installs the manpages in /etc, but
290 # we remove them anyway.
291 rm -r $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/pki/tls/man
293 # Set permissions on lib*.dll.a so that strip works.
294 chmod 0755 $RPM_BUILD_ROOT%{_mingw32_libdir}/libcrypto.dll.a
295 chmod 0755 $RPM_BUILD_ROOT%{_mingw32_libdir}/libssl.dll.a
297 # Install a makefile for generating keys and self-signed certs, and a script
298 # for generating them on the fly.
299 mkdir -p $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/pki/tls/certs
300 install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/pki/tls/certs/Makefile
301 install -m755 %{SOURCE6} $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/pki/tls/certs/make-dummy-cert
304 pushd $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/pki/tls/misc
308 mkdir -m700 $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/pki/CA
309 mkdir -m700 $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/pki/CA/private
312 rm -rf $RPM_BUILD_ROOT
316 %defattr(-,root,root)
318 %{_mingw32_bindir}/openssl.exe
319 %{_mingw32_bindir}/c_rehash
320 %{_mingw32_bindir}/libcrypto-%{soversion}.dll
321 %{_mingw32_bindir}/libssl-%{soversion}.dll
322 #{_mingw32_bindir}/.libcrypto*.hmac
323 %{_mingw32_libdir}/libcrypto.dll.a
324 %{_mingw32_libdir}/libssl.dll.a
325 %{_mingw32_libdir}/engines
326 %{_mingw32_libdir}/pkgconfig/*.pc
327 %{_mingw32_includedir}/openssl
328 %config(noreplace) %{_mingw32_sysconfdir}/pki
332 * Mon Feb 2 2009 Levente Farkas <lfarkas@lfarkas.org> - 0.9.8j-2
333 - Various build fixes.
335 * Wed Jan 28 2009 Levente Farkas <lfarkas@lfarkas.org> - 0.9.8j-1
336 - update to new upstream version.
338 * Mon Dec 29 2008 Levente Farkas <lfarkas@lfarkas.org> - 0.9.8g-2
341 * Tue Sep 30 2008 Richard W.M. Jones <rjones@redhat.com> - 0.9.8g-1
342 - Initial RPM release.