1Name:           jsoncpp
2Version:        1.9.5
3Release:        5
4Summary:        JSON C++ library
5License:        Public Domain or MIT
6URL:            https://github.com/open-source-parsers/jsoncpp
7Source0:        https://github.com/open-source-parsers/jsoncpp/archive/%{version}/%{name}-%{version}.tar.gz
8BuildRequires:  gcc-c++ cmake >= 3.1 python3-devel
9
10Patch0001:      0001-Parse-large-floats-as-infinity-1349-1353.patch
11Patch0002:      0001-Use-default-rather-than-hard-coded-8-for-maximum-agg.patch
12
13%description
14JsonCpp is a C++ library that allows manipulating JSON values,
15including serialization and deserialization to and from strings.
16It can also preserve existing comment in unserialization/serialization steps,
17making it a convenient format to store user input files.
18
19%package        devel
20Summary:        Development files for jsoncpp
21Requires:       %{name} = %{version}-%{release}
22
23%description    devel
24Document files contain library and head files for jsoncpp.
25
26%package        help
27Summary:        Document for jsoncpp
28BuildRequires:  doxygen graphviz hardlink
29BuildArch:      noarch
30Provides:       jsoncpp-doc = %{version}-%{release}
31Obsoletes:      jsoncpp-doc < %{version}-%{release}
32
33%description    help
34Help document for jsoncpp.
35
36%prep
37%autosetup -p 1
38doxygen -s -u doc/doxyfile.in
39sed -i -e 's!^DOT_FONTNAME.*=.*!DOT_FONTNAME =!g' doc/doxyfile.in
40
41%build
42install -d %{_vpath_builddir}
43cd %{_vpath_builddir}
44%cmake -DBUILD_STATIC_LIBS=OFF -DJSONCPP_WITH_WARNING_AS_ERROR=OFF \
45       -DBUILD_OBJECT_LIBS:BOOL=OFF \
46       -DJSONCPP_WITH_PKGCONFIG_SUPPORT=ON -DJSONCPP_WITH_CMAKE_PACKAGE=ON \
47       -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF -DPYTHON_EXECUTABLE="%{__python3}" \
48       ..
49cd ..
50%make_build -C %{_vpath_builddir}
51cp -p %{_vpath_builddir}/version .
52%{__python3} doxybuild.py --with-dot --doxygen %{_bindir}/doxygen
53rm -f version
54
55%install
56%make_install -C %{_vpath_builddir}
57mkdir -p %{buildroot}%{_docdir}/%{name}
58cp README.md %{buildroot}%{_docdir}/%{name}
59chmod 644 %{buildroot}%{_docdir}/%{name}/README.md
60touch %{buildroot}%{_docdir}/%{name}//README.md
61mkdir -p %{buildroot}%{_docdir}/%{name}/html
62cp dist/doxygen/*/*.{html,png} %{buildroot}%{_docdir}/%{name}/html
63chmod 644 %{buildroot}%{_docdir}/%{name}/html/*.{html,png}
64touch %{buildroot}%{_docdir}/%{name}/html
65hardlink -cfv %{buildroot}%{_docdir}/%{name}
66
67# When the .so file name changes during version upgrade, you need to copy the lower version of .so file
68# cp -a %{_libdir}/libjsoncpp.so.* $RPM_BUILD_ROOT%{_libdir}
69
70%check
71%make_build -C %{_vpath_builddir} jsoncpp_check
72
73%post
74/sbin/ldconfig
75
76%postun
77/sbin/ldconfig
78
79%files
80%license AUTHORS LICENSE
81%doc %dir %{_docdir}/%{name}
82%exclude %{_docdir}/%{name}/html
83%{_libdir}/lib%{name}.so.*
84
85%files devel
86%{_libdir}/lib%{name}.so
87%{_includedir}/json
88%{_libdir}/cmake/*
89%{_libdir}/pkgconfig/%{name}.pc
90
91%files help
92%doc %{_docdir}/%{name}
93%doc %{_docdir}/%{name}/README.md
94
95
96%changelog
97* Thu Nov 16 2023 liubo <liubo1@xfusion.com> - 1.9.5-5
98- Use default rather than hard-coded 8 for maximum aggregate member alignment
99
100* Wed Oct 18 2023 liubo <liubo1@xfusion.com> - 1.9.5-4
101- Parse large floats as infinity
102
103* Mon Jan 10 2022 shixuantong <shixuantong@huawei.com> - 1.9.5-3
104- Delete so files of lower versions
105
106* Wed Jan 05 2022 shangyibin <shangyibin1@huawei.com> - 1.9.5-2
107- copy the .so file of the old version.
108
109* Wed Dec 22 2021 shangyibin <shangyibin1@huawei.com> - 1.9.5-1
110- upgrade version to 1.9.5
111
112* Wed Feb 3 2021 liudabo <liudabo1@huawei.com> - 1.9.4-1
113- upgrade version to 1.9.4
114
115* Sat Aug 08 2020 lingsheng<lingsheng@huawei.com> - 1.9.3-2
116- Remove old version so
117
118* Fri Jul 31 2020 wenzhanli<wenzhanli2@huawei.com> - 1.9.3-1
119- Type:NA
120- ID:NA
121- SUG:NA
122- DESC:update version 1.9.3
123
124* Mon Nov 25 2019 zhujunhao <zhujunhao5@huawei.com> - 1.8.4-6
125- Package init
126