summaryrefslogtreecommitdiffstats
path: root/redis-json.spec
blob: d922c91c7c8177e4449f943161326b3f53827e04 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# remirepo/fedora spec file for redis-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          librejson.so
# Github forge
%global gh_vend          RedisJSON
%global gh_proj          RedisJSON
%global forgeurl         https://github.com/%{gh_vend}/%{gh_proj}
#global commit           afe5de4ce52bb2b80af565a6f297bf330a65d0d8
%global tag              v%{version}
# for EL-8 to avoid TAG usage
%global archivename      %{gh_proj}-%{version}

Name:              redis-json
Version:           8.0.1
%forgemeta
Release:           1%{?dist}
Summary:           JSON as native data type
# Starting with Redis 8, RedisJSON is licensed under your choice of:
# (i) Redis Source Available License 2.0 (RSALv2);
# (ii) the Server Side Public License v1 (SSPLv1); or
# (iii) the GNU Affero General Public License version 3 (AGPLv3). 
License:           AGPL-3.0-only
URL:               %{forgeurl}
Source0:           %{forgesource}
Source1:           makedeps.sh
Source2:           %{gh_proj}-deps-%{version}.tgz

BuildRequires:     redis-devel
%if 0%{?fedora} || 0%{?rhel} >= 9
BuildRequires:     cargo-rpm-macros >= 24
%endif
BuildRequires:     cargo >= 1.73
BuildRequires:     rust >= 1.73
BuildRequires:     clang-devel

Requires:          redis(modules_abi)%{?_isa} = %{redis_modules_abi}
Requires:         (redis >= 8.0 with redis < 8.1)
Supplements:       redis


%description
RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange
Standard as a native data type. It allows storing, updating, and fetching JSON
values from Redis keys (documents).

%prep
%setup -q -a2 -n %{gh_proj}-%{version}

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

: Create cargo configuration to use vendor directory
cat << EOF | tee .cargo/config.toml
[build]
jobs = %(echo %{?_smp_mflags} | sed 's/\-j//')
rustc = "%{_bindir}/rustc"

[profile.rpm]
inherits = "release"
opt-level = 3
codegen-units = 1
debug = 2
strip = "none"

[env]
CFLAGS = "%{build_cflags}"
CXXFLAGS = "%{build_cxxflags}"
LDFLAGS = "%{build_ldflags}"

[term]
verbose = true

[source.crates-io]
replace-with = "vendored-sources"

[source."git+https://github.com/RedisJSON/ijson?rev=881b96e7941b8dc335863746ac108f6d9ed0b98a"]
git = "https://github.com/RedisJSON/ijson"
rev = "881b96e7941b8dc335863746ac108f6d9ed0b98a"
replace-with = "vendored-sources"

[source."git+https://github.com/RedisLabsModules/redismodule-rs?tag=v2.1.2"]
git = "https://github.com/RedisLabsModules/redismodule-rs"
tag = "v2.1.2"
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "$PWD/mycargo"
EOF

: Required rust version
grep -h rust-version mycargo/*/Cargo.toml Cargo.toml | sort -u | tail -n 8


%build
%if 0%{?fedora} || 0%{?rhel} >= 9
%cargo_build
%else
cargo build %{?_smp_mflags} --profile rpm
%endif


%install
install -Dpm755 target/rpm/%{libname} %{buildroot}%{redis_modules_dir}/%{libname}
install -Dpm640 %{cfgname}            %{buildroot}%{redis_modules_cfg}/%{cfgname}


%files
%license LICENSE.txt
%license licenses/AGPLv3.txt
%doc *.md
%attr(0640, redis, root) %config(noreplace) %{redis_modules_cfg}/%{cfgname}
%{redis_modules_dir}/%{libname}


%changelog
* Wed Jul 23 2025 Remi Collet <remi@remirepo.net> - 8.0.1-1
- initial package