[mingw-glib2: 4/68] - Added -static subpackage - Developers using the static build of GLib need to add -DGLIB_STATIC_COM
epienbro
epienbro at fedoraproject.org
Tue Mar 6 19:52:11 UTC 2012
commit 8d24dc234ca75a24f5a9ec2a980e0faf81ef0405
Author: Richard W.M. Jones <rjones at fedoraproject.org>
Date: Fri Feb 20 22:22:33 2009 +0000
- 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
- Rebuild for mingw32-gcc 4.4 (RWMJ)
mingw32-glib2.spec | 83 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 76 insertions(+), 7 deletions(-)
---
diff --git a/mingw32-glib2.spec b/mingw32-glib2.spec
index 18568de..f1ac0b3 100644
--- a/mingw32-glib2.spec
+++ b/mingw32-glib2.spec
@@ -6,7 +6,7 @@
Name: mingw32-glib2
Version: 2.19.5
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: MinGW Windows GLib2 library
License: LGPLv2+
@@ -19,7 +19,7 @@ BuildArch: noarch
Patch0: glib-i386-atomic.patch
-BuildRequires: mingw32-filesystem >= 43-6
+BuildRequires: mingw32-filesystem >= 49
BuildRequires: mingw32-gcc
BuildRequires: mingw32-binutils
BuildRequires: mingw32-dlfcn
@@ -41,6 +41,13 @@ Requires: pkgconfig
%description
MinGW Windows Glib2 library.
+%package static
+Summary: Static version of the MinGW Windows GLib2 library
+Requires: %{name} = %{version}-%{release}
+Group: Development/Libraries
+
+%description static
+Static version of the MinGW Windows GLib2 library.
%prep
%setup -q -n glib-%{version}
@@ -52,14 +59,61 @@ autoreconf
%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 +128,7 @@ rm -rf $RPM_BUILD_ROOT
%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 +172,23 @@ rm -rf $RPM_BUILD_ROOT
%{_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 <info at nntpgrab.nl> - 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
+- Rebuild for mingw32-gcc 4.4 (RWMJ)
+
* Fri Jan 30 2009 Richard W.M. Jones <rjones at redhat.com> - 2.19.5-3
- Requires pkgconfig.
More information about the scm-commits
mailing list