Op vrijdag 20-02-2009 om 19:55 uur [tijdzone +0000], schreef Richard
W.M. Jones:
> (4) *-static subpackages don't happen by magic.  You have to find
> someone to do this work for you, or do it yourself.
> 
> (5) Post your patches to this list, for the usual review / submission
> process.

Here are patches for GLib, ATK and Pango.

For ATK, it is a pretty straightforward --enable-static flag.

For Pango a patch needs to be applied as the static build of Pango is
intentionally disabled in the configure script. However, according to
the SVN logs of Pango, this change was done almost 5 years ago [1] and I
haven't found any strange behaviour with the static build so I think it
is safe to apply.

For GLib there's also a small difference in the header file
glibconfig.h. See the patch for full details.

Regards,

Erik van Pienbroek

[1]: http://svn.gnome.org/viewvc/pango?view=revision&revision=1117

--- mingw32-atk.spec.orig	2009-02-20 21:19:20.555682663 +0100
+++ mingw32-atk.spec	2009-02-20 22:31:47.909956339 +0100
@@ -6,7 +6,7 @@
 
 Name:           mingw32-atk
 Version:        1.25.2
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        MinGW Windows Atk library
 
 License:        LGPLv2+
@@ -36,12 +36,20 @@
 MinGW Windows Atk library.
 
 
+%package static
+Summary:        Static version of the MinGW Windows Atk library
+Requires:       %{name} = %{version}-%{release}
+
+%description static
+Static version of the MinGW Windows Atk library.
+
+
 %prep
 %setup -q -n atk-%{version}
 
 
 %build
-%{_mingw32_configure} --disable-static
+%{_mingw32_configure} --enable-static --enable-shared
 make %{?_smp_mflags}
 
 
@@ -76,8 +84,14 @@
 %{_mingw32_libdir}/libatk-1.0.la
 %{_mingw32_libdir}/pkgconfig/atk.pc
 
+%files static
+%{_mingw32_libdir}/libatk-1.0.a
+
 
 %changelog
+* Fri Feb 20 2009 Erik van Pienbroek <[email protected]> - 1.25.2-6
+- Added -static subpackage
+
 * Fri Feb  6 2009 Richard W.M. Jones <[email protected]> - 1.25.2-5
 - Include license file.
 
--- mingw32-glib2.spec.orig	2009-02-20 17:23:15.875672929 +0100
+++ mingw32-glib2.spec	2009-02-20 21:51:08.919675233 +0100
@@ -6,7 +6,7 @@
 
 Name:           mingw32-glib2
 Version:        2.19.5
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        MinGW Windows GLib2 library
 
 License:        LGPLv2+
@@ -41,6 +41,12 @@
 %description
 MinGW Windows Glib2 library.
 
+%package static
+Summary:        Static version of the MinGW Windows GLib2 library
+Requires:       %{name} = %{version}-%{release}
+
+%description static
+Static version of the MinGW Windows GLib2 library.
 
 %prep
 %setup -q -n glib-%{version}
@@ -52,14 +58,61 @@
 
 
 %build
-%{_mingw32_configure} --disable-static
-make %{?_smp_mflags}
-
+# GLib can't build static and shared libraries in one go, so we
+# build GLib twice here
+mkdir build_static
+pushd build_static
+        %{_mingw32_configure} --disable-shared --enable-static
+        make %{?_smp_mflags}
+popd
+
+mkdir build_shared
+pushd build_shared
+        %{_mingw32_configure} --disable-static
+        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='libgio-2.0.a'"/ $RPM_BUILD_ROOT%{_mingw32_libdir}/libgio-2.0.la
+sed -i s/"old_library=''"/"old_library='libglib-2.0.a'"/ $RPM_BUILD_ROOT%{_mingw32_libdir}/libglib-2.0.la
+sed -i s/"old_library=''"/"old_library='libgobject-2.0.a'"/ $RPM_BUILD_ROOT%{_mingw32_libdir}/libgobject-2.0.la
+sed -i s/"old_library=''"/"old_library='libgmodule-2.0.a'"/ $RPM_BUILD_ROOT%{_mingw32_libdir}/libgmodule-2.0.la
+sed -i s/"old_library=''"/"old_library='libgthread-2.0.a'"/ $RPM_BUILD_ROOT%{_mingw32_libdir}/libgthread-2.0.la
+
+# There's also a small difference in the file glibconfig.h between the
+# shared and the static build:
+#
+#diff -ur shared/usr/i686-pc-mingw32/sys-root/mingw/lib/glib-2.0/include/glibconfig.h static/usr/i686-pc-mingw32/sys-root/mingw/lib/glib-2.0/include/glibconfig.h
+#--- shared/usr/i686-pc-mingw32/sys-root/mingw/lib/glib-2.0/include/glibconfig.h	2009-02-20 17:34:35.735677022 +0100
+#+++ static/usr/i686-pc-mingw32/sys-root/mingw/lib/glib-2.0/include/glibconfig.h	2009-02-20 17:33:35.498932269 +0100
+#@@ -92,7 +92,8 @@
+# 
+# #define G_OS_WIN32
+# #define G_PLATFORM_WIN32
+#-
+#+#define GLIB_STATIC_COMPILATION 1
+#+#define GOBJECT_STATIC_COMPILATION 1
+# 
+# #define G_VA_COPY	va_copy
+#
+# However, we can't merge this change as it is situation-dependent...
+#
+# Developers using the static build of GLib need to add -DGLIB_STATIC_COMPILATION
+# and -DGOBJECT_STATIC_COMPILATION to their CFLAGS to avoid compile failures
+
+# Drop the folder which was temporary used for installing the static bits
+rm -rf $RPM_BUILD_ROOT/build_static
 
 rm -f $RPM_BUILD_ROOT/%{_mingw32_libdir}/charset.alias
 
@@ -74,7 +127,7 @@
 
 
 %files -f glib20.lang
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %{_mingw32_bindir}/glib-genmarshal.exe
 %{_mingw32_bindir}/glib-gettextize
 %{_mingw32_bindir}/glib-mkenums
@@ -118,8 +171,22 @@
 %{_mingw32_datadir}/gtk-doc/html/glib/
 %{_mingw32_datadir}/gtk-doc/html/gobject/
 
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libgio-2.0.a
+%{_mingw32_libdir}/libglib-2.0.a
+%{_mingw32_libdir}/libgmodule-2.0.a
+%{_mingw32_libdir}/libgobject-2.0.a
+%{_mingw32_libdir}/libgthread-2.0.a
 
 %changelog
+* Fri Feb 20 2009 Erik van Pienbroek <[email protected]> - 2.19.5-4
+- Added -static subpackage
+- Developers using the static build of GLib need to add
+  -DGLIB_STATIC_COMPILATION and -DGOBJECT_STATIC_COMPILATION to
+  their CFLAGS to avoid compile failures
+- Fixed the %%defattr line
+
 * Fri Jan 30 2009 Richard W.M. Jones <[email protected]> - 2.19.5-3
 - Requires pkgconfig.
 
--- mingw32-pango.spec.orig	2009-02-20 21:36:52.005673092 +0100
+++ mingw32-pango.spec	2009-02-20 22:32:27.012949717 +0100
@@ -6,13 +6,14 @@
 
 Name:           mingw32-pango
 Version:        1.22.1
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        MinGW Windows Pango library
 
 License:        LGPLv2+
 Group:          Development/Libraries
 URL:            http://www.pango.org
 Source0:        http://download.gnome.org/sources/pango/1.21/pango-%{version}.tar.bz2
+Patch0:         pango_enable_static_build.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -39,6 +40,9 @@
 BuildRequires:  mingw32-glib2
 BuildRequires:  pkgconfig
 
+# These are required for the patch
+BuildRequires:  autoconf, automake, libtool
+
 Requires:       pkgconfig
 
 
@@ -46,13 +50,26 @@
 MinGW Windows Pango library.
 
 
+%package static
+Summary:        Static version of the MinGW Windows Pango library
+Requires:       %{name} = %{version}-%{release}
+
+%description static
+Static version of the MinGW Windows Pango library.
+
+
 %prep
 %setup -q -n pango-%{version}
+%patch0
+
+# Regenerate the configure script
+autoreconf --install --force
+libtoolize --install --force
 
 %build
 # Need to run the correct version of glib-mkenums.
 PATH=%{_mingw32_bindir}:$PATH \
-%{_mingw32_configure} --disable-static
+%{_mingw32_configure} --enable-static --enable-shared
 make %{?_smp_mflags}
 
 
@@ -91,7 +108,18 @@
 %{_mingw32_libdir}/pangocairo-1.0.def
 %{_mingw32_libdir}/pangoft2-1.0.def
 %{_mingw32_libdir}/pangowin32-1.0.def
-%{_mingw32_libdir}/pango/
+%dir %{_mingw32_libdir}/pango
+%dir %{_mingw32_libdir}/pango/1.6.0
+%dir %{_mingw32_libdir}/pango/1.6.0/modules
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-basic-win32.dll
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-basic-win32.dll.a
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-basic-win32.la
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-arabic-lang.dll
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-arabic-lang.dll.a
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-arabic-lang.la
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-indic-lang.dll
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-indic-lang.dll.a
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-indic-lang.la
 %{_mingw32_libdir}/pkgconfig/pango.pc
 %{_mingw32_libdir}/pkgconfig/pangocairo.pc
 %{_mingw32_libdir}/pkgconfig/pangoft2.pc
@@ -100,8 +128,20 @@
 %{_mingw32_mandir}/man1/pango-querymodules.1*
 %{_mingw32_sysconfdir}/pango/
 
+%files static
+%{_mingw32_libdir}/libpango-1.0.a
+%{_mingw32_libdir}/libpangocairo-1.0.a
+%{_mingw32_libdir}/libpangoft2-1.0.a
+%{_mingw32_libdir}/libpangowin32-1.0.a
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-basic-win32.a
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-arabic-lang.a
+%{_mingw32_libdir}/pango/1.6.0/modules/pango-indic-lang.a
+
 
 %changelog
+* Fri Feb 20 2009 Erik van Pienbroek <[email protected]> - 1.22.1-5
+- Added -static subpackage
+
 * Fri Jan 30 2009 Richard W.M. Jones <[email protected]> - 1.22.1-4
 - Requires pkgconfig.
 
--- configure.in.orig	2009-02-20 20:37:09.166924103 +0100
+++ configure.in	2009-02-20 20:37:20.893924816 +0100
@@ -123,16 +123,16 @@
 AC_LIBTOOL_WIN32_DLL
 AM_DISABLE_STATIC
 
-if test "$pango_os_win32" = "yes"; then
-  if test x$enable_static = xyes -o x$enable_static = x; then
-    AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
-    enable_static=no
-  fi
-  if test x$enable_shared = xno; then
-    AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
-  fi
-  enable_shared=yes
-fi
+#if test "$pango_os_win32" = "yes"; then
+#  if test x$enable_static = xyes -o x$enable_static = x; then
+#    AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
+#    enable_static=no
+#  fi
+#  if test x$enable_shared = xno; then
+#    AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
+#  fi
+#  enable_shared=yes
+#fi
 
 AM_PROG_LIBTOOL
 dnl when using libtool 2.x create libtool early, because it's used in configure
_______________________________________________
fedora-mingw mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/fedora-mingw

Reply via email to