Hi all,

Lately I've been working on getting static libraries operational and
usable in our toolchain. Attached to this mail are patches for pixman,
cairo, libxml2, gettext, libssh2, libidn, openssl and curl.

I've also been working on static libraries for GTK+, but there are still
some issues remaining with it (like a crash when loading external
gdk-pixbuf modules or the 'wimp' theme engine) so I'm holding those off
for now.

Developers/packagers which are going to use these static libraries need
to customize their CFLAGS for some of the packages. This is necessary
to prevent compile failures. A list of these customized CFLAGS is
published at our new 'Tips and Tricks' page at
https://fedoraproject.org/wiki/MinGW/Tips

Are these patches good to be applied? The packages libssh2, libidn,
openssl and curl aren't in Fedora yet, so somebody else has to commit
those to the temporary HG repository.

Regards,

Erik van Pienbroek

--- mingw32-curl.spec.orig	2009-04-14 00:01:05.205622087 +0200
+++ mingw32-curl.spec	2009-04-13 23:59:54.088650874 +0200
@@ -5,8 +5,8 @@
 %define __find_provides %{_mingw32_findprovides}
 
 Name:           mingw32-curl
-Version:        7.18.2
-Release:        6%{?dist}
+Version:        7.19.4
+Release:        1%{?dist}
 Summary:        MinGW Windows port of curl and libcurl
 
 License:        MIT
@@ -21,8 +21,8 @@
 Patch1:         curl-7.15.3-multilib.patch
 Patch2:         curl-7.16.0-privlibs.patch
 Patch3:         curl-7.17.1-badsocket.patch
-Patch4:         curl-7.18.2-nssproxy.patch
-Patch5:         curl-7.18.2-nss-thread-safety.patch
+Patch4:         curl-7.19.4-tool-leak.patch
+Patch5:         curl-7.19.4-enable-aes.patch
 
 # MinGW-specific patches.
 Patch1000:      mingw-curl-7.18.2-getaddrinfo.patch
@@ -62,14 +62,23 @@
 This is the MinGW cross-compiled Windows library.
 
 
+%package static
+Summary:        Static version of the MinGW Windows Curl library
+Requires:       %{name} = %{version}-%{release}
+Group:          Development/Libraries
+
+%description static
+Static version of the MinGW Windows Curl library.
+
+
 %prep
 %setup -q -n curl-%{version}
 
 %patch1 -p1 -b .multilib
 %patch2 -p1 -b .privlibs
 %patch3 -p1 -b .badsocket
-%patch4 -p1 -b .nssproxy
-%patch5 -p1 -b .nssthreadsafety
+%patch4 -p1 -b .toolleak
+%patch5 -p1 -b .enableaes
 
 %patch1000 -p1 -b .getaddrinfo
 
@@ -79,7 +88,7 @@
   --with-ssl --enable-ipv6 \
   --with-ca-bundle=%{_mingw32_sysconfdir}/pki/tls/certs/ca-bundle.crt \
   --with-libidn \
-  --disable-static --with-libssh2 \
+  --enable-static --with-libssh2 \
   --without-random
 
 # It's not clear where to set the --with-ca-bundle path.  This is the
@@ -116,7 +125,7 @@
 
 
 %files
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %doc COPYING
 %{_mingw32_bindir}/curl-config
 %{_mingw32_bindir}/curl.exe
@@ -127,7 +136,18 @@
 %{_mingw32_includedir}/curl/
 
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libcurl.a
+
 %changelog
+* Fri Apr  3 2009 Erik van Pienbroek <[email protected]> - 7.19.4-1
+- Update to version 7.19.4
+- Fixed %%defattr line
+- Added -static subpackage. Applications which want to use this
+  static library need to add -DCURL_STATICLIB to the CFLAGS
+- Merged the patches of the native .spec file (7.19.4-5)
+
 * Fri Feb 20 2009 Richard W.M. Jones <[email protected]> - 7.18.2-6
 - Rebuild for mingw32-gcc 4.4
 
? .build-0.17-11.fc11.log
? mingw32-gettext-0.17-11.fc11.src.rpm
? mingw32-gettext-enable-static-subpackage.patch
? noarch
Index: mingw32-gettext.spec
===================================================================
RCS file: /cvs/pkgs/rpms/mingw32-gettext/devel/mingw32-gettext.spec,v
retrieving revision 1.4
diff -u -r1.4 mingw32-gettext.spec
--- mingw32-gettext.spec	26 Feb 2009 01:07:19 -0000	1.4
+++ mingw32-gettext.spec	13 Apr 2009 21:53:17 -0000
@@ -6,7 +6,7 @@
 
 Name:      mingw32-gettext
 Version:   0.17
-Release:   10%{?dist}
+Release:   11%{?dist}
 Summary:   GNU libraries and utilities for producing multi-lingual messages
 
 License:   GPLv2+ and LGPLv2+
@@ -39,6 +39,15 @@
 MinGW Windows Gettext library
 
 
+%package static
+Summary:        Static version of the MinGW Windows Gettext library
+Requires:       %{name} = %{version}-%{release}
+Group:          Development/Libraries
+
+%description static
+Static version of the MinGW Windows Gettext library.
+
+
 %prep
 %setup -q -n gettext-%{version}
 
@@ -50,7 +59,7 @@
   --disable-java \
   --disable-native-java \
   --disable-csharp \
-  --disable-static \
+  --enable-static \
   --enable-threads=win32 \
   --without-emacs
 make %{?_smp_mflags}
@@ -123,8 +132,17 @@
 %{_mingw32_datadir}/info/autosprintf.info
 %{_mingw32_datadir}/info/gettext.info
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libasprintf.a
+%{_mingw32_libdir}/libgettextpo.a
+%{_mingw32_libdir}/libintl.a
+
 
 %changelog
+* Fri Apr  3 2009 Erik van Pienbroek <[email protected]> - 0.17-11
+- Added -static subpackage
+
 * Wed Feb 25 2009 Fedora Release Engineering <[email protected]> - 0.17-10
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 
? .build-2.7.2-9.fc11.log
? mingw32-libxml2-2.7.2-9.fc11.src.rpm
? mingw32-libxml2-enable-static-subpackage.patch
? mingw32-libxml2-static-build-compile-fix.patch
? noarch
Index: mingw32-libxml2.spec
===================================================================
RCS file: /cvs/pkgs/rpms/mingw32-libxml2/devel/mingw32-libxml2.spec,v
retrieving revision 1.3
diff -u -r1.3 mingw32-libxml2.spec
--- mingw32-libxml2.spec	26 Feb 2009 01:17:29 -0000	1.3
+++ mingw32-libxml2.spec	13 Apr 2009 21:57:01 -0000
@@ -6,7 +6,7 @@
 
 Name:           mingw32-libxml2
 Version:        2.7.2
-Release:        8%{?dist}
+Release:        9%{?dist}
 Summary:        MinGW Windows libxml2 XML processing library
 
 License:        MIT
@@ -20,6 +20,7 @@
 
 # MinGW-specific patches.
 Patch1000:      mingw32-libxml2-2.7.2-with-modules.patch
+Patch1001:      mingw32-libxml2-static-build-compile-fix.patch
 
 BuildArch:      noarch
 
@@ -41,10 +42,20 @@
 MinGW Windows libxml2 XML processing library.
 
 
+%package static
+Summary:        Static version of the MinGW Windows XML processing library
+Requires:       %{name} = %{version}-%{release}
+Group:          Development/Libraries
+
+%description static
+Static version of the MinGW Windows XML processing library.
+
+
 %prep
 %setup -q -n libxml2-%{version}
 
 %patch1000 -p1
+%patch1001 -p0
 
 # Patched configure.in, so rebuild configure.
 libtoolize --force --copy
@@ -52,15 +63,39 @@
 
 
 %build
-LDFLAGS="-no-undefined" \
-%{_mingw32_configure} --without-python --with-modules --disable-static
-make %{?_smp_mflags}
+# LibXML2 can't build static and shared libraries in one go, so we
+# build LibXML2 twice here
+mkdir build_static
+pushd build_static
+    LDFLAGS="-no-undefined" \
+    %{_mingw32_configure} --without-python --with-modules --enable-static --disable-shared CFLAGS="$CFLAGS -DLIBXML_STATIC_FOR_DLL"
+    make %{?_smp_mflags}
+popd
+
+mkdir build_shared
+pushd build_shared
+    LDFLAGS="-no-undefined" \
+    %{_mingw32_configure} --without-python --with-modules --disable-static --enable-shared
+    make %{?_smp_mflags}
+popd
 
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
-make DESTDIR=$RPM_BUILD_ROOT install
+# First install all the files belonging to the shared build
+make -C build_shared DESTDIR=$RPM_BUILD_ROOT install
+
+# Install all the files from the static build in a seperate folder
+# and move the static libraries to the right location
+make -C build_static DESTDIR=$RPM_BUILD_ROOT/build_static install
+mv $RPM_BUILD_ROOT/build_static%{_mingw32_libdir}/*.a $RPM_BUILD_ROOT%{_mingw32_libdir}
+
+# Manually merge the libtool files
+sed -i s/"old_library=''"/"old_library='libxml2.a'"/ $RPM_BUILD_ROOT%{_mingw32_libdir}/libxml2.la
+
+# Drop the folder which was temporary used for installing the static bits
+rm -rf $RPM_BUILD_ROOT/build_static
 
 # Remove manpages which duplicate Fedora native.
 rm -rf $RPM_BUILD_ROOT%{_mingw32_mandir}
@@ -71,14 +106,13 @@
 
 
 %files
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %{_mingw32_bindir}/libxml2-2.dll
 %{_mingw32_bindir}/xml2-config
 %{_mingw32_bindir}/xmlcatalog.exe
 %{_mingw32_bindir}/xmllint.exe
 %{_mingw32_libdir}/libxml2.dll.a
 %{_mingw32_libdir}/libxml2.la
-%{_mingw32_libdir}/pkgconfig
 %{_mingw32_libdir}/pkgconfig/libxml-2.0.pc
 %{_mingw32_libdir}/xml2Conf.sh
 %{_mingw32_includedir}/libxml2
@@ -87,7 +121,17 @@
 %{_mingw32_datadir}/gtk-doc/html/libxml2/
 
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libxml2.a
+
 %changelog
+* Fri Apr  3 2009 Erik van Pienbroek <[email protected]> - 2.7.2-9
+- Fixed %%defattr line
+- Added -static subpackage. Applications which want to link
+  against this static library needs to add -DLIBXML_STATIC to the CFLAGS
+- This package shouldn't own %%{_mingw32_libdir}/pkgconfig
+
 * Wed Feb 25 2009 Fedora Release Engineering <[email protected]> - 2.7.2-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 
--- threads.c.orig	2009-04-03 19:12:55.382657819 +0200
+++ threads.c	2009-04-03 19:13:10.362407937 +0200
@@ -975,8 +975,8 @@
  */
 #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
 #if defined(LIBXML_STATIC_FOR_DLL)
-BOOL XMLCALL
-xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+int XMLCALL
+xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved)
 #else
 BOOL WINAPI
 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
? .build-0.13.2-4.fc11.log
? .build-0.13.2-5.fc11.log
? mingw32-pixman-0.13.2-4.fc11.src.rpm
? mingw32-pixman-0.13.2-5.fc11.src.rpm
? mingw32-pixman-enable-static-subpackage.patch
? noarch
Index: mingw32-pixman.spec
===================================================================
RCS file: /cvs/pkgs/rpms/mingw32-pixman/devel/mingw32-pixman.spec,v
retrieving revision 1.3
diff -u -r1.3 mingw32-pixman.spec
--- mingw32-pixman.spec	26 Feb 2009 01:20:54 -0000	1.3
+++ mingw32-pixman.spec	13 Apr 2009 21:57:49 -0000
@@ -6,7 +6,7 @@
 
 Name:           mingw32-pixman
 Version:        0.13.2
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        MinGW Windows Pixman library
 
 License:        MIT
@@ -32,6 +32,15 @@
 MinGW Windows Pixman library.
 
 
+%package static
+Summary:        Static version of the MinGW Windows Pixman library
+Requires:       %{name} = %{version}-%{release}
+Group:          Development/Libraries
+
+%description static
+Static version of the MinGW Windows Pixman library.
+
+
 %prep
 %setup -q -n pixman-%{version}
 %patch0 -p1
@@ -40,7 +49,7 @@
 %build
 # Uses GTK for its testsuite, so disable this otherwise
 # we have a chicken & egg problem on mingw
-%{_mingw32_configure} --disable-gtk --disable-static
+%{_mingw32_configure} --disable-gtk --enable-static --enable-shared
 make %{?_smp_mflags}
 
 
@@ -55,7 +64,7 @@
 
 
 %files
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %doc LICENSE
 %{_mingw32_bindir}/libpixman-1-0.dll
 %{_mingw32_includedir}/pixman-1
@@ -64,7 +73,16 @@
 %{_mingw32_libdir}/pkgconfig/pixman-1.pc
 
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libpixman-1.a
+
+
 %changelog
+* Fri Apr  3 2009 Erik van Pienbroek <[email protected]> - 0.13.2-5
+- Fixed %%defattr line
+- Added -static subpackage
+
 * Wed Feb 25 2009 Fedora Release Engineering <[email protected]> - 0.13.2-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 
? .build-1.8.6-2.fc11.log
? mingw32-cairo-1.8.6-2.fc11.src.rpm
? mingw32-cairo-enable-static-subpackage.patch
? noarch
Index: mingw32-cairo.spec
===================================================================
RCS file: /cvs/pkgs/rpms/mingw32-cairo/devel/mingw32-cairo.spec,v
retrieving revision 1.5
diff -u -r1.5 mingw32-cairo.spec
--- mingw32-cairo.spec	10 Mar 2009 13:47:38 -0000	1.5
+++ mingw32-cairo.spec	13 Apr 2009 21:52:05 -0000
@@ -6,7 +6,7 @@
 
 Name:           mingw32-cairo
 Version:        1.8.6
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        MinGW Windows Cairo library
 
 License:        LGPLv2 or MPLv1.1
@@ -41,6 +41,15 @@
 MinGW Windows Cairo library.
 
 
+%package static
+Summary:        Static version of the MinGW Windows Cairo library
+Requires:       %{name} = %{version}-%{release}
+Group:          Development/Libraries
+
+%description static
+Static version of the MinGW Windows Cairo library.
+
+
 %prep
 %setup -q -n cairo-%{version}
 
@@ -51,7 +60,8 @@
   --disable-xcb \
   --enable-win32 \
   --enable-png \
-  --disable-static \
+  --enable-static \
+  --disable-pthread \
   --disable-ft
 make %{?_smp_mflags}
 
@@ -69,7 +79,7 @@
 
 
 %files
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %doc COPYING COPYING-LGPL-2.1 COPYING-MPL-1.1
 %{_mingw32_bindir}/libcairo-2.dll
 %{_mingw32_includedir}/cairo/
@@ -84,7 +94,17 @@
 %{_mingw32_libdir}/pkgconfig/cairo.pc
 
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libcairo.a
+
+
 %changelog
+* Fri Apr  3 2009 Erik van Pienbroek <[email protected]> - 1.8.6-2
+- Fixed %%defattr line
+- Added -static subpackage
+- Use ./configure --disable-pthread to avoid conflict with native pthread library
+
 * Tue Mar 10 2009 Richard W.M. Jones <[email protected]> - 1.8.6-1
 - Rebase to 1.8.6, same as Fedora native version.
 - Source URL corrected.
diff -r 3a93f6f65967 libssh2/mingw32-libssh2.spec
--- a/libssh2/mingw32-libssh2.spec	Thu Mar 12 15:16:45 2009 +0000
+++ b/libssh2/mingw32-libssh2.spec	Tue Apr 14 00:13:34 2009 +0200
@@ -6,7 +6,7 @@
 
 Name:           mingw32-libssh2
 Version:        0.18
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        MinGW Windows library implementing the SSH2 protocol
 
 License:        BSD
@@ -41,6 +41,15 @@
 SECSH-DHGEX(04), and SECSH-NUMBERS(10).
 
 
+%package static
+Summary:        Static version of the MinGW Windows SSH2 library
+Requires:       %{name} = %{version}-%{release}
+Group:          Development/Libraries
+
+%description static
+Static version of the MinGW Windows SSH2 library.
+
+
 %prep
 %setup -q -n libssh2-%{version}
 
@@ -55,7 +64,7 @@
 
 
 %build
-%{_mingw32_configure} --disable-static --enable-shared
+%{_mingw32_configure} --enable-static --enable-shared
 make %{?_smp_mflags}
 
 
@@ -72,7 +81,7 @@
 
 
 %files
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %doc COPYING
 %{_mingw32_bindir}/libssh2-1.dll
 %{_mingw32_libdir}/libssh2.dll.a
@@ -82,7 +91,15 @@
 %{_mingw32_includedir}/libssh2_sftp.h
 
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libssh2.a
+
 %changelog
+* Fri Apr  3 2009 Erik van Pienbroek <[email protected]> - 0.18-6
+- Added -static subpackage
+- Fixed %%defattr line
+
 * Fri Feb 20 2009 Richard W.M. Jones <[email protected]> - 0.18-5
 - Rebuild for mingw32-gcc 4.4
 
diff -r 3a93f6f65967 libidn/mingw32-libidn.spec
--- a/libidn/mingw32-libidn.spec	Thu Mar 12 15:16:45 2009 +0000
+++ b/libidn/mingw32-libidn.spec	Tue Apr 14 00:14:47 2009 +0200
@@ -10,7 +10,7 @@
 
 Name:           mingw32-libidn
 Version:        1.9
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        MinGW Windows Internationalized Domain Name support library
 
 License:        LGPLv2+
@@ -41,6 +41,15 @@
 names.
 
 
+%package static
+Summary:        Static version of the MinGW Windows IDN library
+Requires:       %{name} = %{version}-%{release}
+Group:          Development/Libraries
+
+%description static
+Static version of the MinGW Windows IDN library.
+
+
 %prep
 %setup -q -n libidn-%{version}
 #%patch0 -p1 -b .aconf262
@@ -48,7 +57,7 @@
 
 
 %build
-%{_mingw32_configure} --disable-csharp --disable-static
+%{_mingw32_configure} --disable-csharp --enable-static --enable-shared
 make %{?_smp_mflags}
 
 
@@ -67,7 +76,7 @@
 
 
 %files
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %doc COPYING COPYING.LIB
 %{_mingw32_bindir}/idn.exe
 %{_mingw32_bindir}/libidn-11.dll
@@ -78,7 +87,15 @@
 %{_mingw32_datadir}/locale/*/LC_MESSAGES/libidn.mo
 
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libidn.a
+
 %changelog
+* Fri Apr  3 2009 Erik van Pienbroek <[email protected]> - 1.9-5
+- Added -static subpackage
+- Fixed %%defattr line
+
 * Fri Feb 20 2009 Richard W.M. Jones <[email protected]> - 1.9-4
 - Rebuild for mingw32-gcc 4.4
 
--- mingw32-openssl.spec.orig	2009-04-02 23:10:47.626656260 +0200
+++ mingw32-openssl.spec	2009-04-14 00:20:11.617875730 +0200
@@ -27,7 +27,7 @@
 
 Name:           mingw32-openssl
 Version:        0.9.8j
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        MinGW port of the OpenSSL toolkit
 
 License:        OpenSSL
@@ -131,6 +131,14 @@
 This package contains Windows (MinGW) libraries and development tools.
 
 
+%package static
+Summary:        Static version of the MinGW port of the OpenSSL toolkit
+Requires:       %{name} = %{version}-%{release}
+
+%description static
+Static version of the MinGW port of the OpenSSL toolkit.
+
+
 %prep
 %setup -q -n openssl-%{version}
 
@@ -282,10 +290,6 @@
 install libcrypto-%{soversion}.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
 install libssl-%{soversion}.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
 
-# Remove static libraries but DON'T remove *.dll.a files.
-rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libcrypto.a
-rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libssl.a
-
 # 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
@@ -313,7 +317,7 @@
 
 
 %files
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %doc LICENSE
 %{_mingw32_bindir}/openssl.exe
 %{_mingw32_bindir}/c_rehash
@@ -328,7 +332,17 @@
 %config(noreplace) %{_mingw32_sysconfdir}/pki
 
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libcrypto.a
+%{_mingw32_libdir}/libssl.a
+
+
 %changelog
+* Tue Apr 14 2009 Erik van Pienbroek <[email protected]> - 0.9.8j-5
+- Fixed %%defattr line
+- Added -static subpackage
+
 * Wed Feb 25 2009 Fedora Release Engineering <[email protected]> - 0.9.8j-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 
_______________________________________________
fedora-mingw mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/fedora-mingw

Reply via email to