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