%{!?python3_sitearch: %define python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name: pygobject3
Summary: Python bindings for GObject Introspection
Summary(ja): GObject Introspection の Python バインディング
Version: 3.18.2
Release: 2%{?_dist_release}

Group: Development/Languages
License: LGPL
URL: http://www.pygtk.org/

Source: http://ftp.gnome.org/pub/GNOME/sources/pygobject/3.18/pygobject-%{version}.tar.xz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: glib2-devel >= 2.26.0
BuildRequires: python-devel >= 2.6
BuildRequires: libffi-devel
BuildRequires: libtool, automake
BuildRequires: gobject-introspection-devel >= 0.9.8
BuildRequires: pycairo-devel >= 1.8.10

Obsoletes:	%{name}-doc < 3.10.0

Vendor: Project Vine
Distribution: Vine Linux
Packager: Takemikaduchi

%description
pygobject provides a convenient wrapper for the GObject library
for use in Python programs.

%package devel
Summary: Development files for building add-on libraries
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: glib2-devel
Requires: libffi-devel
Requires: pkgconfig

%description devel
This package contains files required to build wrappers for
pygobject-based libraries such as pygtk2.

%package -n python3-pygobject
Summary: Python3 bindings for GObject Introspection
Summary(ja): GObject Introspection の Python3 バインディング
BuildRequires: python3-pycairo-devel >= 1.10.0
Requires: python3 >= 3.3
Obsoletes: python3-pygobject < 3.16.1

%description -n python3-pygobject
python3-pygobject provides a convenient wrapper for the GObject library
for use in Python3 programs.

%prep
%setup -q -n pygobject-%{version}

# python3
rm -rf ../python3
cp -a . ../python3

%build
# --disable-docs doesn't work; it builds the docs anyway.
%configure \
	--with-python=python2 \
    --enable-silent-rules \
    --disable-static \
    --enable-thread
export tagname=CC
make LIBTOOL=/usr/bin/libtool

#  python3
pushd ../python3
%configure \
	--with-python=python3 \
    --enable-silent-rules \
    --disable-static \
    --enable-thread
export tagname=CC
make LIBTOOL=/usr/bin/libtool
popd

%install
rm -rf $RPM_BUILD_ROOT
export tagname=CC

# python3
pushd ../python3
make LIBTOOL=/usr/bin/libtool DESTDIR=$RPM_BUILD_ROOT install

find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f
rm -f examples/Makefile*
popd
rm -rf ../python3

# python2
make LIBTOOL=/usr/bin/libtool DESTDIR=$RPM_BUILD_ROOT install

find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f
rm -f examples/Makefile*

# conflict with pygobject
rm -rf $RPM_BUILD_ROOT%{python_sitearch}/gtk-2.0
rm -rf $RPM_BUILD_ROOT%{_datadir}/pygobject


%clean
rm -fr $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc AUTHORS NEWS README ChangeLog
%doc examples
%{_libdir}/python2.7/site-packages/pygtkcompat
%{python_sitearch}/*.egg-info
%{python_sitearch}/gi

%files devel
%defattr(-,root,root,-)
%{_includedir}/pygobject-3.0/pygobject.h
%{_libdir}/pkgconfig/pygobject-3.0.pc

%files -n python3-pygobject
%defattr(-,root,root,-)
%doc AUTHORS NEWS README ChangeLog
%{python3_sitearch}/pygtkcompat
%{python3_sitearch}/*.egg-info
%{python3_sitearch}/gi


%changelog
* Thu Nov 12 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.18.2-2
- fix spec file

* Sat Oct 31 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.18.2-1
- new upstream release

* Sun Jun 28 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.16.2-1
- new upstream release

* Sun Apr 19 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.16.1-1
- new upstream release
- create python3-pygobject subpackage

* Mon Mar 30 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.16.0-1
- new upstream release

* Sun Oct 26 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.14.0-1
- new upstream release

* Fri Jun 06 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.12.2-1
- new upstream release

* Sat Apr 19 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.12.1-1
- new upstream release

* Sat Mar 29 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.12.0-1
- new upstream release

* Sun Nov 24 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.10.2-1
- new upstream release

* Sat Oct 26 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.10.1-1
- new upstream release
- remove doc subpackage

* Mon Jul 15 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.8.3-1
- new upstream release

* Sat May 18 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.8.2-1
- new upstream release

* Wed Apr 17 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.8.1-1
- new upstream release

* Wed Apr 17 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.8.1-1
- new upstream release

* Wed Nov 14 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.4.2-1
- new upstream release

* Thu Oct 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.4.1.1-1
- new upstream release

* Thu Sep 27 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.4.0-1
- new upstream release

* Sun May 20 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.2.2-1
- new upstream release

* Sat Mar 31 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.2.0-1
- new upstream release

* Wed Feb 15 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.4-2
- rebuild with python-2.7.2

* Wed Feb 15 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.4-1
- new upstream release

* Thu Nov 03 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.2-1
- new upstream release

* Thu Oct 06 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.1-1
- new upstream release

* Fri Sep 23 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.0-1
- new upstream release

* Sat Sep 03 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.90.3-1
- initial build for Vine Linux

