Name:           glib2
Version:        2.58.1
Release:        3
Summary:        The core library that forms the basis for projects such as GTK+ and GNOME
License:        LGPLv2+
URL:            http://www.gtk.org
Source0:        http://download.gnome.org/sources/glib/2.58/glib-%{version}.tar.xz

Patch6000:      gnetworkmonitornm-Set-a-GError-properly-on-an-error-.patch
Patch6001:      glib-gcharset-fix-leaking-g_get_language_names_with_.patch
Patch6002:      gtask-Check-an-error-hasn-t-been-returned-when-calli.patch
Patch6003:      gmacros-Fix-G_-UN-LIKELY-to-not-mask-Wparentheses.patch
Patch6004:      grefcount-add-missing-gatomic.h.patch
Patch6005:      glocalfile-Fix-access-can-trash-if-parent-is-symlink.patch
Patch6006:      gvariant-Fix-checking-arithmetic-for-tuple-element-e.patch
Patch6007:      gmarkup-Fix-validation-of-element-names.patch
Patch6008:      gdatetime-Fix-formatting-of-time-zones-offsets-in-ra.patch
Patch6009:      gobject-genums.c-fix-flags-validation.patch
Patch6010:      bookmarkfile-Don-t-move-an-item-if-the-uri-has-not-c.patch
Patch6011:      gvariant-Realign-data-on-construction-if-it-s-not-pr.patch
Patch6012:      glib-compile-resources-Fix-size-allocation-for-compr.patch
Patch6013:      gdbusproxy-make-g-name-owner-property-useful-with-un.patch
Patch6014:      gmessages-don-t-memoize-in-g_log_writer_is_journald.patch
Patch6015:      gdate-Use-longest-matching-month-name-in-g_date_set_.patch
Patch6016:      gmain-Make-GChildWatchSource-child_exited-field-atom.patch
Patch6017:      gmain-Make-GUnixSignalWatchSource-pending-field-atom.patch
Patch6018:      gspawn-Fix-g_spawn-deadlock-in-a-multi-threaded-prog.patch
Patch6019:      gunixmounts-Don-t-treat-ZFS-as-a-system-internal-fs.patch
Patch6020:      g_timeout_-_seconds-don-t-overflow-for-large-interva.patch
Patch6021:      gdatetime-Store-intermediate-result-of-g_date_time_f.patch
Patch6022:      gvariant-Fix-error-handling-for-parsing-Unicode-esca.patch
Patch6023:      gdbus-codegen-make-interface-info-header-body-not-cr.patch
Patch6024:      gtlscertificate-Fix-bug-in-PEM-private-key-parser.patch
Patch6025:      gtask-Ensure-to-return-1-or-0-from-getters-rather-th.patch
Patch6026:      list-store-Fix-overflow-issues.patch
Patch6027:      gio-don-t-use-O_PATH-file-descriptors-with-OpenURI-p.patch
Patch6028:      gdbusmessage-Fix-check-on-upper-limit-of-message-siz.patch
Patch6029:      gfile-Fix-leak-in-g_file_query_default_handler.patch
Patch6030:      gdbus-Avoid-printing-null-strings.patch
Patch6031:      gsettingsbackend-Fix-a-minor-memory-leak.patch
Patch6032:      Fixing-missing-initializer-in-g_static_rec_mutex_ini.patch
Patch6033:      gobject-Change-assertions-to-read-values-via-atomics.patch
Patch6034:      gvariant-parser-Add-explicit-unsigned-to-signed-cast.patch
Patch6035:      gvariant-parser-Fix-parsing-of-G_MININT-values-in-GV.patch
Patch6036:      gvariant-parser-Fix-error-handling-when-type-coalesc.patch
Patch6037:      gsocketlistener-Fix-multiple-returns-of-GTask-when-a.patch
Patch6038:      gdbus-Fix-a-potential-use-after-free-on-connection-c.patch
Patch6039:      glib-compile-resources-Fixes-1675.patch
Patch6040:      glib-compile-resources-Fix-a-minor-leak.patch
Patch6041:      glocalfilemonitor-Fix-data-race-in-local-file-monito.patch
Patch6042:      gbase64-Allow-g_base64_encode-NULL-0-and-g_base64_de.patch
Patch6043:      gbase64-Fix-an-impossible-condition.patch
Patch6044:      CVE-2019-12450.patch
Patch6045:      CVE-2019-13012.patch

BuildRequires:  automake chrpath autoconf gtk-doc libtool gettext perl-interpreter gamin-devel
BUildRequires:  glibc-devel python3-devel libattr-devel libselinux-devel systemtap-sdt-devel
BuildRequires:  pkgconfig(libelf) pkgconfig(libffi) pkgconfig(libpcre) pkgconfig(mount) pkgconfig(zlib)
provides:       glib2-fam
Obsoletes:      glib2-fam

Recommends:     shared-mime-info

%description
GLib is a bundle of three (formerly five) low-level system libraries
written in C and developed mainly by GNOME. GLib's code was separated
from GTK, so it can be used by software other than GNOME and has been
developed in parallel ever since.

%package devel
Summary:   Development and test files for the GLib library
Requires:  %{name} = %{version}-%{release}
provides:  glib2-static glib2-tests
Obsoletes: glib2-static glib2-tests

%description devel
Development and test files for the GLib library.

%package help
Summary:   help document for the glib2 package
Buildarch: noarch
provides:  glib2-doc
Obsoletes: glib2-doc

%description help
help document for the glib2 package.

%prep
%autosetup -n glib-%{version} -p1

%build
rm glib/pcre/*.[ch]
(if ! test -x configure; then NOCONFIGURE=1 ./autogen.sh; CONFIGFLAGS=--enable-gtk-doc; fi;
 %configure $CONFIGFLAGS --disable-silent-rules --with-python=%{__python3} --with-pcre=system --enable-systemtap --enable-static --enable-installed-tests
)

%make_build

%install
%make_install
touch -r gio/gdbus-2.0/codegen/config.py.in $RPM_BUILD_ROOT/%{_datadir}/glib-2.0/codegen/config.py
touch -r gio/gdbus-2.0/codegen/config.py.in $RPM_BUILD_ROOT/%{_datadir}/glib-2.0/codegen/codegen_main.py
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so

mv  $RPM_BUILD_ROOT%{_bindir}/gio-querymodules $RPM_BUILD_ROOT%{_bindir}/gio-querymodules-%{__isa_bits}
touch $RPM_BUILD_ROOT%{_libdir}/gio/modules/giomodule.cache
chmod 644 $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions/*
%find_lang glib20

%transfiletriggerin -- %{_libdir}/gio/modules
gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules &> /dev/null || :

%transfiletriggerpostun -- %{_libdir}/gio/modules
gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules &> /dev/null || :

%transfiletriggerin -- %{_datadir}/glib-2.0/schemas
glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :

%transfiletriggerpostun -- %{_datadir}/glib-2.0/schemas
glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :

%files -f glib20.lang
%doc AUTHORS NEWS README COPYING
%{_libdir}/*.so.*
%{_datadir}/bash-completion/completions/gapplication
%{_datadir}/bash-completion/completions/gdbus
%{_datadir}/bash-completion/completions/gio
%{_datadir}/bash-completion/completions/gsettings
%dir %{_datadir}/glib-2.0/schemas
%dir %{_libdir}/gio/modules
%ghost %{_libdir}/gio/modules/giomodule.cache
%{_bindir}/gio
%{_bindir}/gio-launch-desktop
%{_bindir}/gio-querymodules*
%{_bindir}/glib-compile-schemas
%{_bindir}/gsettings
%{_bindir}/gdbus
%{_bindir}/gapplication
%{_libdir}/gio/modules/libgiofam.so

%files devel
%{_libdir}/lib*.so
%{_libdir}/glib-2.0
%{_includedir}/*
%{_datadir}/aclocal/*
%{_libdir}/pkgconfig/*
%{_datadir}/glib-2.0/*
%{_datadir}/bash-completion/completions/gresource
%{_bindir}/glib-genmarshal
%{_bindir}/glib-gettextize
%{_bindir}/glib-mkenums
%{_bindir}/gobject-query
%{_bindir}/gtester
%{_bindir}/gdbus-codegen
%{_bindir}/glib-compile-resources
%{_bindir}/gresource
%{_datadir}/glib-2.0/codegen
%attr (0755, root, root) %{_bindir}/gtester-report
%{_datadir}/gdb/
%{_datadir}/gettext/
%{_datadir}/systemtap/
%{_libdir}/*.a
%{_libexecdir}/installed-tests
%{_datadir}/installed-tests
%exclude %{_libdir}/*.la
%exclude %{_libdir}/gio/modules/*.{a,la}
%exclude %{_datadir}/glib-2.0/gdb/*.{pyc,pyo}
%exclude %{_datadir}/glib-2.0/codegen/*.{pyc,pyo}

%files help
%{_mandir}/man1/*
%doc %{_datadir}/gtk-doc/html/*

%changelog
* Wed Sep 25 2019 huzunhao<huzunhao2@huawei.com> - 2.58.1-3
- Type:cves
- ID:CVE-2019-12450 CVE-2019-13012
- SUG:restart
- DESC:fix CVE-2019-12450 CVE-2019-13012

* Thu Sep 19 2019 Lijin Yang <yanglijin@huawei.com> - 2.58.1-2
- Package init
