From Fedora Project Wiki

What are Redis modules

Redis modules allow for the extension of Redis functionality using external modules, implementing new Redis commands at a speed and with features similar to that which can be achieved inside the Redis server core.

The "redis-doc" package contains documentation describing Redis module functionality extensively.

Runtime requirements

Module support was added into Redis since major version 4. As a result, all module packages should ensure this version or later is available.

It is important to note that the upstream design of Redis modules is such that each is completely standalone, both in terms of build and runtime. The Redis server runtime provides a supported modules ABI version, along with commands for loading modules into the core. However, communication between server and loaded modules is entirely via callbacks, and minimal runtime supporting APIs are provided by the server.

The ABI version of base "redis" packages is available to module packages and must be used to verify that an ABI of an appropriate instruction set architecture is present at runtime. This is achieved as follows:

Requires:	redis >= 4
Requires:       redis(modules_abi)%{?_isa} = %{redis_modules_abi}

BuildRequires

To build a Redis module package, you must make sure the RPM macros are available. These are sourced from the "redis-devel" package.

It is common for upstream Redis modules to contain tests, which may be appropriate to run in a %check section. It is also common for these tests to use the "rmtest" (Redis module test) package.

BuildRequires: redis-devel
BuildRequires: python-rmtest

Packagers should also ensure all Fedora compilation and linkage flags are passed into the module build. This can sometimes be a challenge, depending on the upstream module makefiles - a "make" invocation such as the following may be required to ensure linker flags in particular are propogated correctly.

%build
make %{?_smp_mflags} LD="cc" LDFLAGS="%{?__global_ldflags}"

Macros

The following macros are defined for you:

Macro Normal Definition Notes
redis_modules_abi e.g. 1 The ABI version currently supported
redis_modules_dir %{_prefix}/lib/node_modules Where Redis modules are installed


These macros are provided by the "redis-devel" package.

Installing Modules

All Redis modules must be installed in the %{redis_modules_dir} location, as provided by the "redis-devel" build dependency.

Any tests made available by upstream should also be run wherever possible. This commonly requires a "python-rmtest" build dependency.

%check
make test

%install
install -pDm755 %{name}.so %{buildroot}%{redis_modules_dir}/%{name}.so