%global glib2_version 2.58.0

%global __python %{__python3}

Name:           gobject-introspection
Version:        1.58.0
Release:        6
Summary:        Introspection system for GObject-based libraries

License:        GPLv2+, LGPLv2+, MIT
URL:            https://wiki.gnome.org/Projects/GObjectIntrospection
Source0:        https://download.gnome.org/sources/gobject-introspection/1.58/%{name}-%{version}.tar.xz

BuildRequires:  gcc bison cairo-gobject-devel chrpath flex fontconfig-devel freetype-devel gettext glib2-devel >= %{glib2_version} libxslt gdb
BuildRequires:  gtk-doc libffi-devel libX11-devel libXfixes-devel libXft-devel libxml2-devel mesa-libGL-devel python3-devel python3-mako python3-markdown

Requires:       glib2%{?_isa} >= %{glib2_version}

%description
GObject Introspection can scan C header and source files in order to
generate introspection "typelib" files.  It also provides an API to examine
typelib files, useful for creating language bindings among other
things.

%package devel
Summary:        Libraries and headers for gobject-introspection
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       libtool
Requires:       python3-mako

%description devel
Libraries and headers for gobject-introspection

%package_help

%prep
%autosetup -p1

%build
%configure --enable-gtk-doc --enable-doctool --with-python=%{__python3}
%make_build

%install
%make_install

%chrpath_delete

%delete_la_and_a

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

%post
/sbin/ldconfig

%postun
if [ "$1" = "0" ]; then
/sbin/ldconfig
fi

%files
%license COPYING
%{_libdir}/lib*.so.*
%dir %{_libdir}/girepository-1.0
%{_libdir}/girepository-1.0/*.typelib

%files devel
%{_bindir}/g-ir-*
%{_libdir}/lib*.so
%{_libdir}/gobject-introspection/
%{_libdir}/pkgconfig/*
%{_datadir}/gir-1.0
%{_datadir}/gobject-introspection-1.0/
%{_datadir}/aclocal/introspection.m4
%{_datadir}/gtk-doc/html/gi/
%{_includedir}/*

%files help
%{_mandir}/man1/*.gz

%changelog
* Sat Mar 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.58.0-6
- fixbug in self-building

* Wed Nov 20 2019 fangyufa<fangyufa1@huawei.com> - 1.58.0-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix build problem for x86_64

* Tue Oct 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.58.0-4
- fix provides for main package and devel

* Mon Oct 14 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.58.0-3
- Package init
