summaryrefslogtreecommitdiffstats
path: root/valkey-json.spec
blob: c8aa269fbe7e1896655f76ad7e15efc933124579 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# remirepo/fedora spec file for valkey-json
#
# SPDX-FileCopyrightText:  Copyright 2025 Remi Collet
# SPDX-License-Identifier: CECILL-2.1
# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
#
# Please, preserve the changelog entries
#

%global cfgname          json.conf
%global libname          json.so
# Github forge
%global gh_vend          valkey-io
%global gh_proj          valkey-json
%global forgeurl         https://github.com/%{gh_vend}/%{gh_proj}
#global commit           afe5de4ce52bb2b80af565a6f297bf330a65d0d8
%global tag              %{version}

# see CMakeLists.txt for commit ref
# change will also require patch update
%global rapidjson_url    https://github.com/Tencent/rapidjson
%global rapidjson_commit ebd87cb468fb4cb060b37e579718c4a4125416c1

Name:              valkey-json
Version:           1.0.1
%forgemeta
Release:           1%{?dist}
Summary:           JSON as native data type
# this module is BSD-3-Clause
# RapidJSON is MIT
License:           BSD-3-Clause AND MIT
URL:               %{forgeurl}
Source0:           %{forgesource}
Source1:           %{rapidjson_url}/archive/%{rapidjson_commit}/rapidjson-%{rapidjson_commit}.tar.gz

# use header from valkey-devel to avoid downloading valkey sources
# use rapidjson git snapshot to avoid download
Patch0:            %{name}-offline.patch

BuildRequires:     valkey-devel >= 8.0
BuildRequires:     cmake >= 3.17
BuildRequires:     gcc-c++

Requires:          valkey(modules_abi)%{?_isa} = %{valkey_modules_abi}
Requires:          valkey >= 8.0
Supplements:       valkey

Provides:          bundled(RapidJSON)


%description
Valkey-json is a Valkey module written in C++ that provides native JSON
(JavaScript Object Notation) support for Valkey.

The implementation complies with RFC7159 and ECMA-404 JSON data interchange
standards. Users can natively store, query, and modify JSON data structures
using the JSONPath query language. The query expressions support advanced
capabilities including wildcard selections, filter expressions, array slices,
union operations, and recursive searches.

Valkey-json leverages RapidJSON, a high-performance JSON parser and generator
for C++, chosen for its small footprint and exceptional performance and memory
efficiency. As a header-only library with no external dependencies, RapidJSON
provides robust Unicode support while maintaining a compact memory profile of
just 16 bytes per JSON value on most 32/64-bit machines.

See https://rapidjson.org/


%prep
%setup -q -n %{gh_proj}-%{version} -a1
%patch -P0 -p1

: Configuration file
cat << EOF | tee %{cfgname}
# %{gh_proj}
loadmodule %{valkey_modules_dir}/%{libname}
EOF

cp -p src/rapidjson/license.txt LICENSE.rapidjson


%build
%cmake \
  -DVALKEY_VERSION=8.1 \
  -DBUILD_RELEASE:BOOL=ON \
  -DENABLE_UNIT_TESTS:BOOL=OFF \
  -DENABLE_INTEGRATION_TESTS:BOOL=OFF

%cmake_build


%install
%if 0%{?rhel} == 8
install -Dpm755        src/*%{libname} %{buildroot}%{valkey_modules_dir}/%{libname}
%else
install -Dpm755 *build/src/*%{libname} %{buildroot}%{valkey_modules_dir}/%{libname}
%endif
install -Dpm640 %{cfgname}             %{buildroot}%{valkey_modules_cfg}/%{cfgname}


%files
%license LICENSE*
%doc *.md
%attr(0640, valkey, root) %config(noreplace) %{valkey_modules_cfg}/%{cfgname}
%{valkey_modules_dir}/%{libname}


%changelog
* Wed Aug  6 2025 Remi Collet <remi@remirepo.net> - 1.0.1-1
- initial package