summaryrefslogtreecommitdiff
path: root/json.spec
blob: af614cc553cd53db7a856ab20efea96189c53754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
%global debug_package %{nil}
%global test_data_version 3.1.0
%global bundled_hedley_version 15

Name:           json
Version:        3.11.3
Release:        1

# The entire source is MIT except
# include/nlohmann/thirdparty/hedley/hedley.hpp, which is CC0-1.0
License:        MIT AND CC0-1.0
Summary:        JSON for Modern C++
URL:            https://github.com/nlohmann/%{name}
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1:        https://github.com/nlohmann/json_test_data/archive/v%{test_data_version}/json_test_data-%{test_data_version}.tar.gz

BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  ninja-build

# Build requirements for the tests.
BuildRequires:  doctest-devel
BuildRequires:  gawk

%description
This is a packages version of the nlohmann/json header-only C++
library available at Github.

%package devel
Summary:        Development files for %{name}
Provides:       %{name}-static = %{?epoch:%{epoch}:}%{version}-%{release}
# This package is also known as nlohmann-json, provide some alternate names
# to make it easier to find
Provides:       nlohmann-json-devel = %{?epoch:%{epoch}:}%{version}-%{release}
Provides:       nlohmann-json-static = %{?epoch:%{epoch}:}%{version}-%{release}
Provides:       nlohmann_json-devel = %{?epoch:%{epoch}:}%{version}-%{release}
Provides:       nlohmann_json-static = %{?epoch:%{epoch}:}%{version}-%{release}
Provides:       bundled(hedley) = %{bundled_hedley_version}
Requires:       libstdc++-devel%{?_isa}

%description devel
The %{name}-devel package contains C++ header files for developing
applications that use %{name}.

%prep
%autosetup -p1
%setup -q -D -T -a1

# Unbundle doctest. Used only in tests.
ln -svf %{_includedir}/doctest/doctest.h ./tests/thirdparty/doctest/doctest.h

%build
%cmake \
    -DJSON_BuildTests:BOOL=OFF \
    -DJSON_Install:BOOL=ON \
    -DJSON_TestDataDirectory:STRING=json_test_data-%{test_data_version} \
    -DJSON_MultipleHeaders:BOOL=ON
%make_build

%install
%make_install

%files devel
%doc README.md
%license LICENSE.MIT
%{_includedir}/nlohmann/
%{_datadir}/cmake/nlohmann_json/
%{_datadir}/pkgconfig/nlohmann_json.pc

%changelog