%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
# overwrite configure macro (remove --target option)
%define configure CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; ./configure --host=%{_host} --build=%{_build} --program-prefix=%{?_program_prefix} --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir}

# Note that this is NOT a relocatable package
%define debug    on

Summary:	A library of handy utility functions.
Summary(ja):	便利なユーティリティ関数ライブラリ
Name:		glib
Version:	1.2.10
Release:	3%{?_dist_release}
License:	LGPL
Group:		System Environment/Libraries
URL:		http://www.gtk.org
Source:		ftp://ftp.gimp.org/pub/gtk/v1.2/%{name}-%{version}.tar.gz
Patch1:		glib-1.2.10-isowarning.patch
Patch2:		glib-1.2.10-gcc34.patch
Patch3:		glib-1.2.10-config.sub-x86_64.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

%description
Glib is a handy library of utility functions. This C
library is designed to solve some portability problems
and provide other useful functionality which most
programs require.

Glib is used by GDK, GTK+ and many applications.
You should install Glib because many of your applications
will depend on this library.

This package rebuilds binaries with debug option.

%description -l ja
Glib は便利なユーティリティ関数ライブラリです。この C
ライブラリはいくつかのよく遭遇する問題を解決し、多くの
プログラムで必要な有用な機能を提供するために作られました。

このパッケージでは debug option 付きで binary を 作成します。


%package devel
Summary: Libraries and header files for glib development
Group: Development/Libraries
Requires(post,preun): /sbin/install-info

%description devel
Static libraries and header files for the support library for the GIMP's X
libraries, which are available as public libraries.  GLIB includes generally
useful data structures.

%description devel -l ja
GIMP の X ライブラリをサポートする静的関数およびヘッダファイルです。
GLIB には使いやすいデータストラクチャーも含まれています。

## to build compat32 for x86_64 architecture support
%package -n compat32-%{name}
Summary:	A library of handy utility functions.
Group:		System Environment/Libraries
Requires:	%{name} = %{version}
%description -n compat32-%{name}
Glib is a handy library of utility functions. This C
library is designed to solve some portability problems
and provide other useful functionality which most
programs require.

%package -n compat32-%{name}-devel
Summary: Libraries and header files for glib development
Group: Development/Libraries
Requires:	compat32-%{name} = %{version}
%description -n compat32-%{name}-devel
Static libraries and header files for the support library for the GIMP's X
libraries, which are available as public libraries.  GLIB includes generally
useful data structures.


%prep
%setup -q
%patch1 -p1 -b .isowarning
%patch2 -p1 -b .gcc34
%patch3 -p1 -b .config.sub


%build
if [ %{debug} = "on" ] ; then
  export CFLAGS="$RPM_OPT_FLAGS -g"
else
  export CFLAGS="$RPM_OPT_FLAGS"
fi

%configure
%__make


%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%makeinstall

rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.la
rm -f $RPM_BUILD_ROOT%{_infodir}/dir

#%find_lang %{name}

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%post devel
/sbin/install-info %{_infodir}/glib.info* %{_infodir}/dir

%preun devel
if [ "$1" = 0 ]; then
  /sbin/install-info --delete %{_infodir}/glib.info* %{_infodir}/dir
fi

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig


%files
%defattr(-, root, root)
%doc AUTHORS COPYING ChangeLog NEWS README
%{_libdir}/libglib-1.2.so.*
%{_libdir}/libgthread-1.2.so.*
%{_libdir}/libgmodule-1.2.so.*

%files devel
%defattr(-, root, root)
%{_bindir}/*
%{_libdir}/lib*.so
%{_libdir}/lib*.a
%{_libdir}/glib
%{_libdir}/pkgconfig/*
%{_includedir}/*
%{_datadir}/aclocal/*
%{_infodir}/*
%{_mandir}/man1/*

## to build compat32 for x86_64 architecture support
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-, root, root)
%{_libdir}/libglib-1.2.so.*
%{_libdir}/libgthread-1.2.so.*
%{_libdir}/libgmodule-1.2.so.*

%files -n compat32-%{name}-devel
%defattr(-, root, root)
%{_libdir}/lib*.so
%{_libdir}/lib*.a
%{_libdir}/glib
%{_libdir}/pkgconfig/*
%endif

%changelog
* Mon May 25 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.10-3
- spec in UTF-8

* Sat May 10 2008 NAKAMURA Kenta <kenta@vinelinux.org> 1.2.10-2
- updated %%if %%{build_compat32} case related statements

* Tue May  6 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.10-1
- applied new versioning policy
- moved Requires(post,preun): /sbin/install-info to devel package

* Fri Feb 10 2006 Shu KONNO <owa@bg.wakwak.com> 1.2.10-0vl7
- added compat32-* packages for x86_64 architecture support
- added glib-1.2.10-config.sub-x86_64.patch

* Tue Feb 07 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.2.10-0vl6
- rebuild
- disable %%find_lang macro
- refine %%configure macro
- add PreReq: ldconfig, install-info instead of /sbin/install-info

* Wed Jul 07 2004 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.2.10-0vl5
- rebuilt
- change from Copyright to License
- add patch2
- remove info/dir

* Wed Dec 25 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.2.10-0vl4
- rebuilt with new toolchain
- TODO: we better remove info files when glib2 be ready to ship...

* Thu Oct 11 2001 Akira TAGOH <tagoh@gnome.gr.jp> 1.2.10-0vl3
- Applied RH patch (glib-1.2.10-isowarning.patch)
  * Sat Jul 21 2001 Owen Taylor <otaylor@redhat.com>
  - Add #pragma GCC system_header to supress warnings when in -pedantic
    mode. (41271)
- Added %%{_libdir}/pkgconfig to devel file list.

* Sat Jul 14 2001 <sagami@vinelinux.org>
- 1.2.10-0vl2: put %%patch0 at %%setup, not %%build. But already applied:-)

* Tue Apr  3 2001 Akira TAGOH <tagoh@gnome.gr.jp> 1.2.10-0vl1
- New upstream release.

* Wed Mar  7 2001 Akira TAGOH <tagoh@gnome.gr.jp> 1.2.9-0vl1
- New upstream release.

* Mon Feb 05 2001 Lisa Sagami <czs14350@mb.infoweb.ne.jp>
- 1.2.8-0vl2
- fixed files section so as not to own mandir itself
- use better macros

* Mon May 29 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated to 1.2.8

* Thu Feb 17 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- [glib-1.2.7-0vl1]

* Mon Sep 27 1999 Jun Nishii <jun@flatout.org>
- [glib-1.2.6-1]

* Mon Sep 27 1999 Jun Nishii <jun@flatout.org>
- [glib-1.2.5-1]

* Fri Sep 7 1999 Yasuhide OOMORI <dasen@typhoon.co.jp>
  [glib-1.2.4-2.1]
- added debug option to CFLAG.

* Fri Sep 6 1999 Yasuhide OOMORI <dasen@typhoon.co.jp>
  [glib-1.2.4-2]
- gzip info.

* Fri Sep 3 1999 Yasuhide OOMORI <dasen@typhoon.co.jp>
  [glib-1.2.4-1]
- version 1.2.4.
- bzip2 source.
- info is installed in glib-devel.

* Sat Aug 21 1999 Jun Nishii <jun@flatout.org>
- added Japanese summary and description
- build for Vine-1.9

* Mon Jun 7 1999 Owen Taylor <otaylor@redhat.com>
- version 1.2.3

* Thu Mar 25 1999 Michael Fulbright <drmike@redhat.com>
- version 1.2.1

* Fri Feb 26 1999 Michael Fulbright <drmike@redhat.com>
- Version 1.2

* Thu Feb 25 1999 Michael Fulbright <drmike@redhat.com>
- version 1.2.0pre1

* Tue Feb 23 1999 Cristian Gafton <gafton@redhat.com>
- new description tags 

* Sun Feb 21 1999 Michael Fulbright <drmike@redhat.com>
- removed libtoolize from %build

* Thu Feb 11 1999 Michael Fulbright <drmike@redhat.com>
- added libgthread to file list

* Fri Feb 05 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.15

* Wed Feb 03 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.14

* Mon Jan 18 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.13

* Wed Jan 06 1999 Michael Fulbright <drmike@redhat.com>
- version 1.1.12

* Wed Dec 16 1998 Michael Fulbright <drmike@redhat.com>
- updated in preparation for the GNOME freeze

* Mon Apr 13 1998 Marc Ewing <marc@redhat.com>
- Split out glib package

