Ignore mingw32-boost for now, because it doesn't work.
[fedora-mingw.git] / openssl / mingw32-openssl.spec
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}
6
7 # Enable the tests.
8 # These only work some of the time, but fail randomly at other times
9 # (although I have had them complete a few times, so I don't think
10 # there is any actual problem with the binaries).
11 %define with_tests 0
12
13 Name:           mingw32-openssl
14 Version:        0.9.8g
15 Release:        1%{?dist}
16 Summary:        MinGW port of the OpenSSL toolkit
17
18 License:        OpenSSL
19 Group:          Development/Libraries
20 URL:            http://www.openssl.org/
21
22 # Use the hobble-openssl script to create the source file.
23 Source0:        openssl-%{version}-usa.tar.bz2
24
25 Source1:        hobble-openssl
26 Source2:        Makefile.certificate
27 Source6:        make-dummy-cert
28 Source8:        openssl-thread-test.c
29 Source9:        opensslconf-new.h
30 Source10:       opensslconf-new-warning.h
31
32 # Patches from Fedora native package.
33 Patch0:         openssl-0.9.8g-redhat.patch
34 Patch1:         openssl-0.9.8a-defaults.patch
35 Patch2:         openssl-0.9.8a-link-krb5.patch
36 Patch3:         openssl-0.9.8g-soversion.patch
37 Patch4:         openssl-0.9.8a-enginesdir.patch
38 Patch5:         openssl-0.9.8a-no-rpath.patch
39 Patch6:         openssl-0.9.8b-test-use-localhost.patch
40 Patch7:         openssl-0.9.8g-shlib-version.patch
41 Patch21:        openssl-0.9.8b-aliasing-bug.patch
42 Patch22:        openssl-0.9.8b-x509-name-cmp.patch
43 Patch23:        openssl-0.9.8g-default-paths.patch
44 Patch24:        openssl-0.9.8g-no-extssl.patch
45 Patch32:        openssl-0.9.8g-ia64.patch
46 Patch33:        openssl-0.9.7f-ca-dir.patch
47 Patch34:        openssl-0.9.6-x509.patch
48 Patch35:        openssl-0.9.7-beta5-version-add-engines.patch
49 Patch38:        openssl-0.9.8a-reuse-cipher-change.patch
50 # Disabled this because it uses getaddrinfo which is lacking on Windows.
51 #Patch39:        openssl-0.9.8g-ipv6-apps.patch
52 Patch50:        openssl-0.9.8g-speed-bug.patch
53 Patch51:        openssl-0.9.8g-bn-mul-bug.patch
54 Patch52:        openssl-0.9.8g-cve-2008-0891.patch
55 Patch53:        openssl-0.9.8g-cve-2008-1671.patch
56
57 # MinGW-specific patches.
58 Patch100:       mingw32-openssl-0.9.8g-header-files.patch
59 Patch101:       mingw32-openssl-0.9.8g-configure.patch
60 Patch102:       mingw32-openssl-0.9.8g-shared.patch
61 Patch103:       mingw32-openssl-0.9.8g-global.patch
62 Patch104:       mingw32-openssl-0.9.8g-sfx.patch
63
64 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
65
66 BuildArch:      noarch
67
68 BuildRequires:  mingw32-filesystem >= 26
69 BuildRequires:  mingw32-gcc
70 BuildRequires:  mingw32-binutils
71
72 BuildRequires:  mingw32-zlib
73
74 BuildRequires:  mktemp
75 #BuildRequires:  krb5-devel
76 BuildRequires:  perl
77 BuildRequires:  sed
78 BuildRequires:  /usr/bin/cmp
79 BuildRequires:  /usr/bin/rename
80
81 # XXX Not really sure about this one.  The build script uses
82 # /usr/bin/makedepend which comes from imake.
83 BuildRequires:  imake
84
85 # Required both to build, and to run the tests.
86 # XXX This needs to be fixed - cross-compilation should not
87 # require running executables.
88 BuildRequires:  wine
89
90 %if %{with_tests}
91 # Required to run the tests.
92 BuildRequires:  xorg-x11-server-Xvfb
93 %endif
94
95 #Requires:       ca-certificates >= 2008-5
96 Requires:       pkgconfig
97
98
99 %description
100 The OpenSSL toolkit provides support for secure communications between
101 machines. OpenSSL includes a certificate management tool and shared
102 libraries which provide various cryptographic algorithms and
103 protocols.
104
105 This package contains Windows (MinGW) libraries and development tools.
106
107
108 %prep
109 %setup -q -n openssl-%{version}
110
111 %{SOURCE1} > /dev/null
112 %patch0 -p1 -b .redhat
113 %patch1 -p1 -b .defaults
114 # Fix link line for libssl (bug #111154).
115 %patch2 -p1 -b .krb5
116 %patch3 -p1 -b .soversion
117 %patch4 -p1 -b .enginesdir
118 %patch5 -p1 -b .no-rpath
119 %patch6 -p1 -b .use-localhost
120 %patch7 -p1 -b .shlib-version
121
122 %patch21 -p1 -b .aliasing-bug
123 %patch22 -p1 -b .name-cmp
124 %patch23 -p1 -b .default-paths
125 %patch24 -p1 -b .no-extssl
126
127 %patch32 -p1 -b .ia64
128 #patch33 is applied after make test
129 %patch34 -p1 -b .x509
130 %patch35 -p1 -b .version-add-engines
131 %patch38 -p1 -b .cipher-change
132 #%patch39 -p1 -b .ipv6-apps
133 %patch50 -p1 -b .speed-bug
134 %patch51 -p1 -b .bn-mul-bug
135 %patch52 -p0 -b .srvname-crash
136 %patch53 -p0 -b .srv-kex-crash
137
138 %patch100 -p1 -b .mingw-header-files
139 %patch101 -p1 -b .mingw-configure
140 %patch102 -p1 -b .mingw-shared
141 %patch103 -p1 -b .mingw-global
142 %patch104 -p1 -b .mingw-sfx
143
144 # Modify the various perl scripts to reference perl in the right location.
145 perl util/perlpath.pl `dirname %{__perl}`
146
147 # Generate a table with the compile settings for my perusal.
148 touch Makefile
149 make TABLE PERL=%{__perl}
150
151
152 %build
153
154 cat > gcc <<EOS
155 #!/bin/sh -
156 %{_bindir}/i686-pc-mingw32-gcc -m32 "$@"
157 EOS
158 export PATH=.:$PATH
159
160 # NB: 'no-hw' is vital.  MinGW cannot build the hardware drivers
161 # and if you don't have this you'll get an obscure link error.
162 ./Configure \
163   --prefix=%{_mingw32_prefix} \
164   --openssldir=%{_mingw32_sysconfdir}/pki/tls \
165   zlib enable-camellia enable-seed enable-tlsext enable-rfc3779 \
166   no-idea no-mdc2 no-rc5 no-ec no-ecdh no-ecdsa no-hw shared \
167   --enginesdir=%{_mingw32_libdir}/openssl/engines \
168   mingw
169 #  --with-krb5-flavor=MIT
170 #  -I%{_mingw32_prefix}/kerberos/include -L%{_mingw32_prefix}/kerberos/%{_lib}
171 make depend
172 make all build-shared
173 make rehash build-shared
174
175 %if %{with_tests}
176 #----------------------------------------------------------------------
177 # Run some tests.  I don't know why this isn't in a %-check section
178 # but this is how it is in the native RPM.
179
180 # This is a bit of a hack, but the test scripts look for 'openssl'
181 # by name.
182 pushd apps
183 ln -s openssl.exe openssl
184 popd
185
186 # This is useful for diagnosing Wine problems.
187 WINEDEBUG=+loaddll
188 export WINEDEBUG
189
190 # Make sure we can find the installed DLLs.
191 WINEDLLPATH=%{_mingw32_bindir}
192 export WINEDLLPATH
193
194 # The tests run Wine and require an X server (but don't really use
195 # it).  Therefore we create a virtual framebuffer for the duration of
196 # the tests.
197 # XXX There is no good way to choose a random, unused display.
198 # XXX Setting depth to 24 bits avoids bug 458219.
199 unset DISPLAY
200 display=:21
201 Xvfb $display -screen 0 1024x768x24 -ac -noreset & xpid=$!
202 trap "kill -TERM $xpid ||:" EXIT
203 sleep 3
204 DISPLAY=$display
205 export DISPLAY
206
207 make LDCMD=%{_mingw32_cc} -C test apps tests
208
209 # Disable this thread test, because we don't have pthread on Windows.
210 #%-{_mingw32_cc} -o openssl-thread-test \
211 #  -I./include \
212 #  %-{_mingw32_cflags} \
213 #  %-{SOURCE8} \
214 #  -L. \
215 #  -lssl -lcrypto \
216 #  -lpthread -lz -ldl
217 #
218 ## `krb5-config --cflags`
219 ## `krb5-config --libs`
220 #
221 #./openssl-thread-test --threads %{thread_test_threads}
222
223 #----------------------------------------------------------------------
224 %endif
225
226 # Patch33 must be patched after tests otherwise they will fail
227 patch -p1 -b -z .ca-dir < %{PATCH33}
228
229 if ! iconv -f UTF-8 -t ASCII//TRANSLIT CHANGES >/dev/null 2>&1 ; then
230   iconv -f ISO-8859-1 -t UTF-8 -o CHANGES.utf8 CHANGES && \
231     mv -f CHANGES.utf8 CHANGES
232 fi
233
234
235 %install
236 rm -rf $RPM_BUILD_ROOT
237 mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}
238 mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}/openssl
239 mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir}
240 mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir}
241 mkdir -p $RPM_BUILD_ROOT%{_mingw32_mandir}
242 make INSTALL_PREFIX=$RPM_BUILD_ROOT install build-shared
243
244 # Install the actual DLLs.
245 install libcrypto-7.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
246 install libssl-7.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
247
248 # Remove static libraries but DON'T remove *.dll.a files.
249 rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libcrypto.a
250 rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libssl.a
251
252 # I have no idea why it installs the manpages in /etc, but
253 # we remove them anyway.
254 rm -r $RPM_BUILD_ROOT%{_mingw32_sysconfdir}/pki/tls/man
255
256 # Set permissions on lib*.dll.a so that strip works.
257 chmod 0755 $RPM_BUILD_ROOT%{_mingw32_libdir}/libcrypto.dll.a
258 chmod 0755 $RPM_BUILD_ROOT%{_mingw32_libdir}/libssl.dll.a
259
260
261 %clean
262 rm -rf $RPM_BUILD_ROOT
263
264
265 %files
266 %defattr(-,root,root)
267 %{_mingw32_bindir}/openssl.exe
268 %{_mingw32_bindir}/c_rehash
269 %{_mingw32_bindir}/libcrypto-7.dll
270 %{_mingw32_bindir}/libssl-7.dll
271 %{_mingw32_libdir}/libcrypto.dll.a
272 %{_mingw32_libdir}/libssl.dll.a
273 %{_mingw32_libdir}/engines
274 %{_mingw32_libdir}/pkgconfig/*.pc
275 %{_mingw32_includedir}/openssl
276 %config(noreplace) %{_mingw32_sysconfdir}/pki
277
278
279 %changelog
280 * Tue Sep 30 2008 Richard W.M. Jones <rjones@redhat.com> - 0.9.8g-1
281 - Initial RPM release.