86117b
%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
86117b
86117b
%global so_ver      4
86117b
%global reldate     20180305
86117b
86117b
# Uncomment when building a bootstrap for a bumped so-name.
86117b
# You also need to adjust the parameters below.
86117b
%global bootstrap   0
86117b
86117b
%if 0%{?bootstrap}
86117b
%global reldate_old 20171207
86117b
%global version_old 0.13
86117b
%global so_ver_old  3
86117b
%endif
86117b
86117b
86117b
Name:           json-c
86117b
Version:        0.13.1
b59827
Release:        3%{?dist}
86117b
Summary:        JSON implementation in C
86117b
86117b
License:        MIT
86117b
URL:            https://github.com/%{name}/%{name}
86117b
Source0:        %{url}/archive/%{name}-%{version}-%{reldate}.tar.gz
86117b
%if 0%{?bootstrap}
86117b
Source1:        %{url}/archive/%{name}-%{version_old}-%{reldate_old}.tar.gz
86117b
%endif
bf81f7
# CVE-2020-12762 json-c: integer overflow and out-of-bounds write via a large JSON file
bf81f7
# rhbz#1835626
bf81f7
Patch0:		json-c-int-overflow.patch
b59827
# patch for support of versioned symbols
b59827
# rhbz#2001063
b59827
Patch1:		json-c-versioned-symbols.patch
86117b
86117b
BuildRequires:  libtool
86117b
86117b
%description
86117b
JSON-C implements a reference counting object model that allows you
86117b
to easily construct JSON objects in C, output them as JSON formatted
86117b
strings and parse JSON formatted strings back into the C representation
86117b
of JSON objects.  It aims to conform to RFC 7159.
86117b
86117b
86117b
%package        devel
86117b
Summary:        Development files for %{name}
86117b
86117b
Requires:       %{name}%{?_isa} == %{version}-%{release}
86117b
86117b
%description    devel
86117b
This package contains libraries and header files for
86117b
developing applications that use %{name}.
86117b
86117b
86117b
%package        doc
86117b
Summary:        Reference manual for json-c
86117b
86117b
BuildArch:      noarch
86117b
86117b
BuildRequires:  doxygen
86117b
BuildRequires:  hardlink
86117b
86117b
%description    doc
86117b
This package contains the reference manual for %{name}.
86117b
86117b
86117b
%prep
86117b
%autosetup -Tb 0 -n %{name}-%{name}-%{version}-%{reldate} -p 1
86117b
86117b
for doc in ChangeLog; do
86117b
  %{_bindir}/iconv -f iso-8859-1 -t utf8 ${doc} > ${doc}.new
86117b
  /bin/touch -r ${doc} ${doc}.new
86117b
  %{__mv} -f ${doc}.new ${doc}
86117b
done
86117b
86117b
%{__sed} -i -e 's!#ACLOCAL_AMFLAGS!ACLOCAL_AMFLAGS!g' Makefile.am
86117b
%{_bindir}/autoreconf -fiv
86117b
86117b
%if 0%{?bootstrap}
86117b
%{__mkdir} -p bootstrap_ver
86117b
pushd bootstrap_ver
86117b
%{__tar} --strip-components=1 -xf %{SOURCE1}
86117b
86117b
%{__sed} -i -e 's!#ACLOCAL_AMFLAGS!ACLOCAL_AMFLAGS!g' Makefile.am
86117b
%{_bindir}/autoreconf -fiv
86117b
popd
86117b
%endif
86117b
86117b
86117b
%build
b59827
# it is easier and more efficient to add version script flag
b59827
# here instead of having to rebuild the configure script
b59827
LDFLAGS="%{build_ldflags} -Wl,--version-script,${PWD}/json-c.sym"
86117b
%configure               \
86117b
  --disable-silent-rules \
86117b
  --disable-static       \
86117b
  --enable-shared        \
86117b
  --enable-threading
86117b
86117b
%make_build
86117b
86117b
%{_bindir}/doxygen Doxyfile
86117b
86117b
%if 0%{?bootstrap}
86117b
pushd bootstrap_ver
86117b
%configure               \
86117b
  --disable-silent-rules \
86117b
  --disable-static       \
86117b
  --enable-shared        \
86117b
  --enable-threading
86117b
86117b
%make_build
86117b
popd
86117b
%endif
86117b
86117b
86117b
%install
86117b
%if 0%{?bootstrap}
86117b
%make_install -C bootstrap_ver
86117b
%{__rm} -fr %{buildroot}%{_includedir}/%{name}   \
86117b
            %{buildroot}%{_libdir}/lib%{name}.so \
86117b
            %{buildroot}%{_libdir}/pkgconfig
86117b
%endif
86117b
86117b
%make_install
86117b
86117b
%{_bindir}/find %{buildroot} -name '*.a' -delete -print
86117b
%{_bindir}/find %{buildroot} -name '*.la' -delete -print
86117b
86117b
%{__mkdir} -p %{buildroot}%{_pkgdocdir}
86117b
%{__cp} -pr doc/html ChangeLog README README.* %{buildroot}%{_pkgdocdir}
86117b
%{_sbindir}/hardlink -cvf %{buildroot}%{_pkgdocdir}
86117b
86117b
86117b
%check
86117b
%make_build check
86117b
86117b
%if 0%{?bootstrap}
86117b
%make_build -C bootstrap_ver check
86117b
%endif
86117b
86117b
86117b
%pretrans devel -p <lua>
86117b
path = "%{_includedir}/%{name}"
86117b
st = posix.stat(path)
86117b
if st and st.type == "link" then
86117b
  os.remove(path)
86117b
end
86117b
86117b
86117b
%ldconfig_scriptlets
86117b
86117b
86117b
%files
86117b
%license AUTHORS
86117b
%license COPYING
86117b
%{_libdir}/lib%{name}.so.%{so_ver}*
86117b
%if 0%{?bootstrap}
86117b
%{_libdir}/lib%{name}.so.%{so_ver_old}*
86117b
%endif
86117b
86117b
86117b
%files devel
86117b
%doc %{_pkgdocdir}/ChangeLog
86117b
%doc %{_pkgdocdir}/README*
86117b
%{_includedir}/%{name}/
86117b
%{_libdir}/lib%{name}.so
86117b
%{_libdir}/pkgconfig/%{name}.pc
86117b
86117b
86117b
%files doc
86117b
%if 0%{?fedora} || 0%{?rhel} >= 7
86117b
%license %{_datadir}/licenses/%{name}*
86117b
%endif # 0%%{?fedora} || 0%%{?rhel} >= 7
86117b
%doc %{_pkgdocdir}
86117b
86117b
86117b
%changelog
b59827
* Tue Sep 14 2021 Tomas Korbar <tkorbar@redhat.com> - 0.13.1-3
b59827
- Start versioning symbols when building library
b59827
- Resolves: rhbz#2001063
b59827
bf81f7
* Thu May 20 2021 Joe Orton <jorton@redhat.com> - 0.13.1-2
bf81f7
- rebuild (#1954436)
bf81f7
bf81f7
* Thu Apr 15 2021 Tomas Korbar <tkorbar@redhat.com> - 0.13.1-1
bf81f7
- Fix CVE-2020-12762 out-of-bounds write via a large JSON file
bf81f7
- Resolves: rhbz#1835626
bf81f7
6ea120
* Wed Feb 03 2021 Petr Menšík <pemensik@redhat.com> - 0.13.1-0.4
6ea120
- Move json-c-devel to AppStream
6ea120
6ea120
* Fri Sep 18 2020 Anna Khaitovich <akhaitov@redhat.com> - 0.13.1-0.3
6ea120
- Don't package empty /usr/share/doc/json-c
6ea120
- Resolves: rhbz#1741076
6ea120
- Do not use --enable-rdrand
6ea120
- Resolves: rhbz#1806532
6ea120
86117b
* Fri Aug 03 2018 Radovan Sroka <rsroka@redhat.com> - 0.13.1-0.2
86117b
- disable bootstrap for RHEL8
86117b
86117b
* Tue Mar 06 2018 Björn Esser <besser82@fedoraproject.org> - 0.13.1-0.1
86117b
- Bootstrapping for so-name bump
86117b
86117b
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-7
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
86117b
86117b
* Fri Feb 02 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.13-6
86117b
- Switch to %%ldconfig_scriptlets
86117b
86117b
* Thu Dec 14 2017 Björn Esser <besser82@fedoraproject.org> - 0.13-5
86117b
- Update patch fixing a segfault caused by possible invalid frees
86117b
86117b
* Wed Dec 13 2017 Björn Esser <besser82@fedoraproject.org> - 0.13-4
86117b
- Add upstream patch fixing invalid free in some cases
86117b
86117b
* Wed Dec 13 2017 Björn Esser <besser82@fedoraproject.org> - 0.13-3
86117b
- Add upstream patch for adding size_t json_c_object_sizeof()
86117b
- Enable partial multi-threaded support
86117b
86117b
* Mon Dec 11 2017 Björn Esser <besser82@fedoraproject.org> - 0.13-2
86117b
- Drop json_object_private.h
86117b
86117b
* Mon Dec 11 2017 Björn Esser <besser82@fedoraproject.org> - 0.13-1
86117b
- New upstream release (rhbz#1524155)
86117b
86117b
* Sun Dec 10 2017 Björn Esser <besser82@fedoraproject.org> - 0.13-0.1
86117b
- Bootstrapping for so-name bump
86117b
- Keep json_object_private.h
86117b
86117b
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.1-4
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
86117b
86117b
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.1-3
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
86117b
86117b
* Mon Jul 03 2017 Björn Esser <besser82@fedoraproject.org> - 0.12.1-2
86117b
- Add patch to replace obsolete autotools macro
86117b
86117b
* Thu Apr 27 2017 Björn Esser <besser82@fedoraproject.org> - 0.12.1-1
86117b
- Update to new upstream release
86117b
- Introduces SONAME bump, that should have been in 0.12 already
86117b
- Unify %%doc
86117b
- General spec-file cleanup
86117b
86117b
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.12-8
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
86117b
86117b
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.12-7
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
86117b
86117b
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.12-6
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
86117b
86117b
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.12-5
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
86117b
86117b
* Tue Jul 29 2014 Christopher Meng <rpm@cicku.me> - 0.12-4
86117b
- SONAME bump postponed.
86117b
86117b
* Mon Jul 28 2014 Christopher Meng <rpm@cicku.me> - 0.12-3
86117b
- SONAME bump, see bug 1123785
86117b
86117b
* Fri Jul 25 2014 Christopher Meng <rpm@cicku.me> - 0.12-2
86117b
- NVR bump
86117b
86117b
* Thu Jul 24 2014 Christopher Meng <rpm@cicku.me> - 0.12-1
86117b
- Update to 0.12
86117b
86117b
* Sat Jul 12 2014 Tom Callaway <spot@fedoraproject.org> - 0.11-8
86117b
- fix license handling
86117b
86117b
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11-7
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
86117b
86117b
* Wed Apr 09 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 0.11-7
86117b
- Address CVE-2013-6371 and CVE-2013-6370 (BZ #1085676 and #1085677).
86117b
- Enabled rdrand support.
86117b
86117b
* Mon Feb 10 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 0.11-6
86117b
- Bump spec.
86117b
86117b
* Sat Dec 21 2013 Ville Skyttä <ville.skytta@iki.fi> - 0.11-5
86117b
- Run test suite during build.
86117b
- Drop empty NEWS from docs.
86117b
86117b
* Tue Sep 10 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 0.11-4
86117b
- Remove default warning flags so that package builds on EPEL as well.
86117b
86117b
* Sat Aug 24 2013 Remi Collet <remi@fedoraproject.org> - 0.11-3
86117b
- increase parser strictness for php
86117b
86117b
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11-2
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
86117b
86117b
* Mon Apr 29 2013 Remi Collet <remi@fedoraproject.org> - 0.11-1
86117b
- update to 0.11
86117b
- fix source0
86117b
- enable both json and json-c libraries
86117b
86117b
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10-3
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
86117b
86117b
* Sat Nov 24 2012 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.10-2
86117b
- Compile and install json_object_iterator using Remi Collet's fix (BZ #879771).
86117b
86117b
* Sat Nov 24 2012 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.10-1
86117b
- Update to 0.10 (BZ #879771).
86117b
86117b
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-5
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
86117b
86117b
* Mon Jan 23 2012 Jiri Pirko <jpirko@redhat.com> - 0.9-4
86117b
- add json_tokener_parse_verbose, and return NULL on parser errors
86117b
86117b
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-3
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
86117b
86117b
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-2
86117b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
86117b
86117b
* Tue Apr 06 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9-1
86117b
- First release.