diff --git a/mingw-openssl-drop-unneeded-reference-to-dlfcn-h.patch b/mingw-openssl-drop-unneeded-reference-to-dlfcn-h.patch new file mode 100644 index 0000000..255374a --- /dev/null +++ b/mingw-openssl-drop-unneeded-reference-to-dlfcn-h.patch @@ -0,0 +1,10 @@ +--- crypto/fips/fips.c.orig 2010-10-07 23:33:08.293664062 +0200 ++++ crypto/fips/fips.c 2010-10-07 23:33:20.723360688 +0200 +@@ -57,7 +57,6 @@ + #include + #include + #include +-#include + #include + #include + #include "fips_locl.h" diff --git a/mingw-openssl.spec b/mingw-openssl.spec index 12c16b6..db716c6 100644 --- a/mingw-openssl.spec +++ b/mingw-openssl.spec @@ -1,6 +1,7 @@ -%global __strip %{mingw32_strip} -%global __objdump %{mingw32_objdump} -%define __debug_install_post %{mingw32_debug_install_post} +%?mingw_package_header + +%global mingw_build_win32 1 +%global mingw_build_win64 1 # For the curious: # 0.9.5a soversion = 0 @@ -26,7 +27,7 @@ Name: mingw-openssl Version: 1.0.0d -Release: 5%{?dist} +Release: 6%{?dist} Summary: MinGW port of the OpenSSL toolkit License: OpenSSL @@ -90,19 +91,25 @@ Patch60: openssl-1.0.0d-apps-dgst.patch Patch101: mingw32-openssl-1.0.0-beta3-libversion.patch # Fix engines/ install target after lib rename Patch102: mingw32-openssl-1.0.0d-sfx.patch +# Some .c file contains in #include while it +# doesn't really use anything from that header +Patch103: mingw-openssl-drop-unneeded-reference-to-dlfcn-h.patch +# Mingw-w64 compatibility patch +Patch104: openssl_mingw64_install_fix.patch BuildArch: noarch -BuildRequires: mingw32-filesystem +BuildRequires: mingw32-filesystem >= 95 BuildRequires: mingw32-gcc BuildRequires: mingw32-binutils - BuildRequires: mingw32-zlib -BuildRequires: mingw32-pthreads -BuildRequires: mingw32-dlfcn + +BuildRequires: mingw64-filesystem >= 95 +BuildRequires: mingw64-gcc +BuildRequires: mingw64-binutils +BuildRequires: mingw64-zlib BuildRequires: mktemp -#BuildRequires: krb5-devel BuildRequires: perl BuildRequires: sed BuildRequires: /usr/bin/cmp @@ -132,6 +139,7 @@ protocols. This package contains Windows (MinGW) libraries and development tools. +# Win32 %package -n mingw32-openssl Summary: MinGW port of the OpenSSL toolkit #Requires: ca-certificates >= 2008-5 @@ -145,7 +153,6 @@ protocols. This package contains Windows (MinGW) libraries and development tools. - %package -n mingw32-openssl-static Summary: Static version of the MinGW port of the OpenSSL toolkit Requires: mingw32-openssl = %{version}-%{release} @@ -153,8 +160,29 @@ Requires: mingw32-openssl = %{version}-%{release} %description -n mingw32-openssl-static Static version of the MinGW port of the OpenSSL toolkit. +# Win64 +%package -n mingw64-openssl +Summary: MinGW port of the OpenSSL toolkit +#Requires: ca-certificates >= 2008-5 +Requires: pkgconfig -%{?mingw32_debug_package} +%description -n mingw64-openssl +The OpenSSL toolkit provides support for secure communications between +machines. OpenSSL includes a certificate management tool and shared +libraries which provide various cryptographic algorithms and +protocols. + +This package contains Windows (MinGW) libraries and development tools. + +%package -n mingw64-openssl-static +Summary: Static version of the MinGW port of the OpenSSL toolkit +Requires: mingw64-openssl = %{version}-%{release} + +%description -n mingw64-openssl-static +Static version of the MinGW port of the OpenSSL toolkit. + + +%?mingw_debug_package %prep @@ -200,9 +228,8 @@ Static version of the MinGW port of the OpenSSL toolkit. %patch101 -p1 -b .mingw-libversion %patch102 -p1 -b .mingw-sfx - -# Use _mingw32_cflags instead of hardcoded ones -sed -i -e '/^"mingw"/ s/-fomit-frame-pointer -O3 -march=i486 -Wall/%{mingw32_cflags}/' Configure +%patch103 -p0 -b .dlfcn +%patch104 -p0 -b .mingw64 # Modify the various perl scripts to reference perl in the right location. perl util/perlpath.pl `dirname %{__perl}` @@ -211,9 +238,24 @@ perl util/perlpath.pl `dirname %{__perl}` touch Makefile make TABLE PERL=%{__perl} +# Create two copies of the source folder as OpenSSL doesn't support out of source builds +mkdir ../build_win32 +mv * ../build_win32 +mv ../build_win32 . +mkdir build_win64 +cp -Rp build_win32/* build_win64 + +# Use mingw cflags instead of hardcoded ones +sed -i -e '/^"mingw"/ s/-fomit-frame-pointer -O3 -march=i486 -Wall/%{mingw32_cflags}/' build_win32/Configure +sed -i -e '/^"mingw"/ s/-fomit-frame-pointer -O3 -march=i486 -Wall/%{mingw64_cflags}/' build_win64/Configure + + %build -# NB: 'no-hw' is vital. MinGW cannot build the hardware drivers -# and if you don't have this you'll get an obscure link error. +############################################################################### +# Win32 +############################################################################### +pushd build_win32 + PERL=%{__perl} \ ./Configure \ --prefix=%{mingw32_prefix} \ @@ -224,8 +266,6 @@ PERL=%{__perl} \ no-hw --cross-compile-prefix=%{mingw32_target}- \ --enginesdir=%{mingw32_libdir}/openssl/engines \ shared mingw -# --with-krb5-flavor=MIT -# -I%{mingw32_prefix}/kerberos/include -L%{mingw32_prefix}/kerberos/%{_lib} # Regenerate def files as we disabled some algorithms above perl util/mkdef.pl crypto ssl update @@ -241,6 +281,40 @@ if ! iconv -f UTF-8 -t ASCII//TRANSLIT CHANGES >/dev/null 2>&1 ; then mv -f CHANGES.utf8 CHANGES fi +popd + +############################################################################### +# Win64 +############################################################################### +pushd build_win64 + +PERL=%{__perl} \ +./Configure \ + --prefix=%{mingw64_prefix} \ + --openssldir=%{mingw64_sysconfdir}/pki/tls \ + zlib enable-camellia enable-seed enable-tlsext enable-rfc3779 \ + enable-cms enable-md2 no-idea no-mdc2 no-rc5 no-ec no-ecdh no-ecdsa \ + no-capieng \ + no-hw --cross-compile-prefix=%{mingw64_target}- \ + --enginesdir=%{mingw64_libdir}/openssl/engines \ + shared mingw64 + +# Regenerate def files as we disabled some algorithms above +perl util/mkdef.pl crypto ssl update + +make depend +make all build-shared + +# Generate hashes for the included certs. +make rehash build-shared + +if ! iconv -f UTF-8 -t ASCII//TRANSLIT CHANGES >/dev/null 2>&1 ; then + iconv -f ISO-8859-1 -t UTF-8 -o CHANGES.utf8 CHANGES && \ + mv -f CHANGES.utf8 CHANGES +fi + +popd + %if %{run_tests} %check @@ -252,7 +326,7 @@ patch -p1 -R < %{PATCH33} # This is a bit of a hack, but the test scripts look for 'openssl' # by name. -pushd apps +pushd build_win32/apps ln -s openssl.exe openssl popd @@ -277,14 +351,14 @@ sleep 3 DISPLAY=$display export DISPLAY -make LDCMD=%{mingw32_cc} -C test apps tests +make LDCMD=%{mingw32_cc} -C build_win32/test apps tests # Disable this thread test, because we don't have pthread on Windows. %{mingw32_cc} -o openssl-thread-test \ - -I./include \ + -I./build_win32/include \ %-{_mingw32_cflags} \ %-{SOURCE8} \ - -L. \ + -L./build_win32 \ -lssl -lcrypto \ -lpthread -lz -ldl @@ -307,23 +381,32 @@ make LDCMD=%{mingw32_cc} -C test apps tests %install -mkdir -p $RPM_BUILD_ROOT%{mingw32_libdir} mkdir -p $RPM_BUILD_ROOT%{mingw32_libdir}/openssl mkdir -p $RPM_BUILD_ROOT%{mingw32_bindir} mkdir -p $RPM_BUILD_ROOT%{mingw32_includedir} mkdir -p $RPM_BUILD_ROOT%{mingw32_mandir} -make INSTALL_PREFIX=$RPM_BUILD_ROOT install build-shared + +mkdir -p $RPM_BUILD_ROOT%{mingw64_libdir}/openssl +mkdir -p $RPM_BUILD_ROOT%{mingw64_bindir} +mkdir -p $RPM_BUILD_ROOT%{mingw64_includedir} +mkdir -p $RPM_BUILD_ROOT%{mingw64_mandir} + +%mingw_make_install INSTALL_PREFIX=$RPM_BUILD_ROOT build-shared # Install the file applink.c (#499934) -install -m644 ms/applink.c $RPM_BUILD_ROOT%{mingw32_includedir}/openssl/applink.c +install -m644 build_win32/ms/applink.c $RPM_BUILD_ROOT%{mingw32_includedir}/openssl/applink.c +install -m644 build_win64/ms/applink.c $RPM_BUILD_ROOT%{mingw64_includedir}/openssl/applink.c # I have no idea why it installs the manpages in /etc, but # we remove them anyway. rm -r $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/tls/man +rm -r $RPM_BUILD_ROOT%{mingw64_sysconfdir}/pki/tls/man # Set permissions on lib*.dll.a so that strip works. chmod 0755 $RPM_BUILD_ROOT%{mingw32_libdir}/libcrypto.dll.a chmod 0755 $RPM_BUILD_ROOT%{mingw32_libdir}/libssl.dll.a +chmod 0755 $RPM_BUILD_ROOT%{mingw64_libdir}/libcrypto.dll.a +chmod 0755 $RPM_BUILD_ROOT%{mingw64_libdir}/libssl.dll.a # Install a makefile for generating keys and self-signed certs, and a script # for generating them on the fly. @@ -331,22 +414,33 @@ mkdir -p $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/tls/certs install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/tls/certs/Makefile install -m755 %{SOURCE6} $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/tls/certs/make-dummy-cert +mkdir -p $RPM_BUILD_ROOT%{mingw64_sysconfdir}/pki/tls/certs +install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{mingw64_sysconfdir}/pki/tls/certs/Makefile +install -m755 %{SOURCE6} $RPM_BUILD_ROOT%{mingw64_sysconfdir}/pki/tls/certs/make-dummy-cert + # Pick a CA script. -pushd $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/tls/misc +pushd $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/tls/misc +mv CA.sh CA +popd + +pushd $RPM_BUILD_ROOT%{mingw64_sysconfdir}/pki/tls/misc mv CA.sh CA popd mkdir -m700 $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/CA mkdir -m700 $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/CA/private +mkdir -m700 $RPM_BUILD_ROOT%{mingw64_sysconfdir}/pki/CA +mkdir -m700 $RPM_BUILD_ROOT%{mingw64_sysconfdir}/pki/CA/private + +# Win32 %files -n mingw32-openssl -%doc LICENSE +%doc build_win32/LICENSE %{mingw32_bindir}/openssl.exe %{mingw32_bindir}/c_rehash %{mingw32_bindir}/libcrypto-%{soversion}.dll %{mingw32_bindir}/libssl-%{soversion}.dll -#{_mingw32_bindir}/.libcrypto*.hmac %{mingw32_libdir}/libcrypto.dll.a %{mingw32_libdir}/libssl.dll.a %{mingw32_libdir}/engines @@ -354,13 +448,33 @@ mkdir -m700 $RPM_BUILD_ROOT%{mingw32_sysconfdir}/pki/CA/private %{mingw32_includedir}/openssl %config(noreplace) %{mingw32_sysconfdir}/pki - %files -n mingw32-openssl-static %{mingw32_libdir}/libcrypto.a %{mingw32_libdir}/libssl.a +# Win64 +%files -n mingw64-openssl +%doc build_win64/LICENSE +%{mingw64_bindir}/openssl.exe +%{mingw64_bindir}/c_rehash +%{mingw64_bindir}/libcrypto-%{soversion}.dll +%{mingw64_bindir}/libssl-%{soversion}.dll +%{mingw64_libdir}/libcrypto.dll.a +%{mingw64_libdir}/libssl.dll.a +%{mingw64_libdir}/engines +%{mingw64_libdir}/pkgconfig/*.pc +%{mingw64_includedir}/openssl +%config(noreplace) %{mingw64_sysconfdir}/pki + +%files -n mingw64-openssl-static +%{mingw64_libdir}/libcrypto.a +%{mingw64_libdir}/libssl.a + %changelog +* Sat Mar 10 2012 Erik van Pienbroek - 1.0.0d-6 +- Added win64 support + * Wed Mar 07 2012 Kalev Lember - 1.0.0d-5 - Pass the path to perl interpreter to Configure diff --git a/openssl_mingw64_install_fix.patch b/openssl_mingw64_install_fix.patch new file mode 100644 index 0000000..17b8607 --- /dev/null +++ b/openssl_mingw64_install_fix.patch @@ -0,0 +1,11 @@ +--- engines/Makefile.orig 2010-05-15 21:24:54.986089920 +0200 ++++ engines/Makefile 2010-05-15 21:26:51.409085467 +0200 +@@ -111,7 +111,7 @@ + for l in $(LIBNAMES); do \ + ( echo installing $$l; \ + pfx=lib; \ +- if [ "$(PLATFORM)" = "mingw" ]; then \ ++ if [ "$(PLATFORM)" = "mingw" -o "$(PLATFORM)" = "mingw64" ]; then \ + sfx=.dll; \ + cp $$pfx$$l$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/$$pfx$$l$$sfx.new; \ + elif [ "$(PLATFORM)" != "Cygwin" ]; then \