%global debug_package %{nil} %define _build_id_links none %if 0%{?rhel} && 0%{?rhel} < 10 %global gcc_toolset_enable source /opt/rh/gcc-toolset-15/enable %else %global gcc_toolset_enable source /usr/lib/gcc-toolset/15-env.source %endif %global cfgname json.conf %global libname json.so %global rapidjson_commit ebd87cb468fb4cb060b37e579718c4a4125416c1 Name: valkey-json Version: 1.0.2 Release: 1%{?dist} Summary: JSON as native data type License: BSD-3-Clause AND MIT URL: https://github.com/valkey-io/%{name}/ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Source1: https://github.com/Tencent/rapidjson/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 # see https://github.com/valkey-io/valkey-json/pull/73 Patch0: %{name}-offline.patch # see https://github.com/valkey-io/valkey-json/issues/83 Patch1: %{name}-format.patch BuildRequires: valkey-devel >= 9.0 BuildRequires: cmake >= 3.17 BuildRequires: gcc-toolset-15-gcc BuildRequires: gcc-toolset-15-gcc-c++ BuildRequires: gcc-toolset-15-gcc-plugin-annobin Requires: valkey(modules_abi)%{?_isa} = %{valkey_modules_abi} Requires: valkey >= %{valkey_version} 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. %prep %setup -q -n %{name}-%{version} -a1 %patch -P0 -p1 -b .offline %patch -P1 -p1 -b .format sed -e 's/-Wno-format//' -i CMakeLists.txt sed -e 's/-Werror//' -i CMakeLists.txt : Configuration file cat << EOF | tee %{cfgname} loadmodule %{_libdir}/valkey/modules/json.so EOF %build %{gcc_toolset_enable} %cmake \ -DVALKEY_VERSION=9.0 \ -DVALKEY_INCLUDE_DIR=%{_includedir}/valkey \ -DRAPIDJSON_SOURCE_DIR=$PWD/rapidjson-%{rapidjson_commit} \ -DBUILD_RELEASE:BOOL=ON \ -DENABLE_UNIT_TESTS:BOOL=OFF \ -DENABLE_INTEGRATION_TESTS:BOOL=OFF %cmake_build %install install -Dpm755 *build/src/json.so %{buildroot}%{_libdir}/valkey/modules/%{libname} install -Dpm640 %{cfgname} %{buildroot}%{_libdir}/valkey/modules/%{cfgname} %files %attr(0640, valkey, root) %config(noreplace) %{_libdir}/valkey/modules/%{cfgname} %{_libdir}/valkey/modules/json.so %changelog %autochangelog