qjson/qjson.spec
2020-07-23 11:25:28 +08:00

151 lines
3.2 KiB
RPMSpec
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#global snap0 20150318
#global commit0 d0f62e65f0b79fb7724d8d551dc9ff11d085127b
#global gittag0 GIT-TAG
#global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
# define to support qjson-qt5(-devel)
%if 0%{?fedora} || 0%{?rhel} > 6
%global qt5 1
%endif
Name: qjson
Version: 0.9.0
Release: 7%{?dist}
Summary: A qt-based library that maps JSON data to QVariant objects
License: GPLv2+
URL: https://github.com/flavio/qjson
%if 0%{?commit0:1}
Source0: https://github.com/flavio/qjson/archive/%{commit0}.tar.gz#/%{name}-%{shortcommit0}.tar.gz
%else
Source0: https://github.com/flavio/qjson/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
%endif
## upstream patches
## upstreamable patches
Patch100: qjson-0.9.0-static.patch
BuildRequires: cmake >= 2.8.8
BuildRequires: doxygen
BuildRequires: pkgconfig(QtCore)
%if 0%{?qt5}
BuildRequires: pkgconfig(Qt5Core)
%endif
# %%check
BuildRequires: xorg-x11-server-Xvfb
%description
JSON is a lightweight data-interchange format. It can represents integer, real
number, string, an ordered sequence of value, and a collection of
name/value pairs.QJson is a qt-based library that maps JSON data to
QVariant objects.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
%{summary}.
%package qt5
Summary: A Qt5-based barcode abstraction library
%description qt5
%{summary}.
%package qt5-devel
Summary: Development files for %{name}-qt5
Requires: %{name}-qt5%{?_isa} = %{version}-%{release}
%description qt5-devel
%{summary}.
%prep
%setup -q %{?commit0:-n %{name}-%{commit0}}
%patch100 -p1 -b .static
%build
mkdir %{_target_platform}
pushd %{_target_platform}
%{cmake} .. \
-DQJSON_BUILD_TESTS:BOOL=ON \
-DQT4_BUILD:BOOL=ON
make %{?_smp_mflags}
popd
%if 0%{?qt5}
mkdir %{_target_platform}-qt5
pushd %{_target_platform}-qt5
%{cmake} .. \
-DQJSON_BUILD_TESTS:BOOL=ON \
-DQT4_BUILD:BOOL=OFF
make %{?_smp_mflags}
popd
%endif
# build docs
pushd doc
doxygen
popd
%install
%if 0%{?qt5}
make install/fast DESTDIR=%{buildroot} -C %{_target_platform}-qt5
%endif
make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
%check
export PKG_CONFIG_PATH=%{buildroot}%{_datadir}/pkgconfig:%{buildroot}%{_libdir}/pkgconfig
test "$(pkg-config --modversion QJson)" = "%{version}"
export CTEST_OUTPUT_ON_FAILURE=1
xvfb-run -a make test -C %{_target_platform} ||:
%if 0%{?qt5}
test "$(pkg-config --modversion QJson-qt5)" = "%{version}"
xvfb-run -a make test -C %{_target_platform}-qt5 ||:
%endif
%ldconfig_scriptlets
%files
%license COPYING.lib
%doc README.md README.license
%{_libdir}/libqjson.so.%{version}
%{_libdir}/libqjson.so.0*
%files devel
%doc doc/html
%{_includedir}/qjson/
%{_libdir}/libqjson.so
%{_libdir}/pkgconfig/QJson.pc
%dir %{_libdir}/cmake
%{_libdir}/cmake/qjson/
%if 0%{?qt5}
%files qt5
%license COPYING.lib
%doc README.md README.license
%{_libdir}/libqjson-qt5.so.%{version}
%{_libdir}/libqjson-qt5.so.0*
%files qt5-devel
%doc doc/html
%{_includedir}/qjson-qt5/
%{_libdir}/libqjson-qt5.so
%{_libdir}/pkgconfig/QJson-qt5.pc
%dir %{_libdir}/cmake
%{_libdir}/cmake/qjson-qt5/
%endif
%changelog
* Thu Jul 23 2020 Zhao Yang <yangzhao1@kylinos.cn> - 0.9.0-7
- Initial release for OpenEuler