File reflective-rapidjson.spec of Package reflective-rapidjson

#
# spec file for package reflective-rapidjson
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 Martchus
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

Name:           reflective-rapidjson
Version:        0.0.15
Release:        0
Summary:        Code generator C++
License:        GPL-2.0+
Group:          Development/Libraries/C and C++
Url:            https://github.com/Martchus/%{name}
Source:         %{name}-%{version}.tar.xz
BuildRequires:  cmake >= 3.9
%if 0%{?fedora}
%else
BuildRequires:  ninja
%endif
BuildRequires:  cppunit-devel >= 1.14.0
%if 0%{?sle_version} && 0%{?sle_version} < 160000
BuildRequires:  gcc9-c++
%else
BuildRequires:  gcc-c++
%endif
BuildRequires:  boost-devel
BuildRequires:  c++utilities-devel
BuildRequires:  pkgconfig
BuildRequires:  rapidjson-devel
BuildRequires:  clang-devel
%if 0%{?fedora_version}
BuildRequires:  llvm-devel
%else
%if 0%{?suse_version} > 1320
BuildRequires:  libboost_headers-devel
%endif
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Code generator for serializing/deserializing C++ objects to/from JSON using Clang and RapidJSON

%package devel
Summary:        Devel files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       c++utilities-devel
Requires:       rapidjson-devel
Requires:       clang-devel
%if 0%{?fedora_version}
BuildRequires:  llvm-devel
%else
%if 0%{?suse_version} > 1320
BuildRequires:  libboost_headers-devel
%endif
%endif

%description devel
Development files for %{reponame}

%prep
%setup -q -n %{name}-%{version}

%build
%if 0%{?sle_version} && 0%{?sle_version} < 160000
export CC=gcc-9
export CXX=g++-9
%endif
%if 0%{?fedora}
%else
%define __builder ninja
%endif
%cmake \
    -DBUILD_SHARED_LIBS:BOOL=ON
%if 0%{?fedora} && 0%{?fedora_version} < 33
make %{?_smp_mflags}
%else
%cmake_build
%endif

%check
%if 0%{?fedora}
%if 0%{?fedora_version} < 33
make %{?_smp_mflags} check
%else
export LD_LIBRARY_PATH="$PWD/%{__cmake_builddir}:$LD_LIBRARY_PATH"
%cmake_build --target check
%endif
%else
%if (0%{?sle_version} == 150200 || 0%{?sle_version} == 150300) && 0%{?is_opensuse}
# FIXME: fix tests under Leap 15.2 which fail at some point with "1/1 Test #1: ...........***Exception: SegFault  0.02 sec"
%else
cd "%{__builddir}"
export LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH"
%cmake_build check
%endif
%endif

%install
%if 0%{?fedora} && 0%{?fedora_version} < 33
DESTDIR=%{buildroot} make %{?_smp_mflags} install
%else
%cmake_install
%endif

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license LICENSE
%{_bindir}/reflective_rapidjson_generator
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/reflective_rapidjson_generator

%files devel
%doc README.md
%{_includedir}/reflective_rapidjson
%{_libdir}/pkgconfig/reflective_rapidjson.pc
%dir %{_datadir}/reflective_rapidjson
%{_datadir}/reflective_rapidjson/cmake

%changelog
openSUSE Build Service is sponsored by