Blob Blame History Raw
# debugsourcefiles.list is now empty
%bcond_without debug

# tests fail with multiple Error: symbol ... is already defined
%bcond_with check

%if %{without debug}
%global debug_package %{nil}
%endif

# mcrouter build process is very memory-hungry,
# it fails unpredictably if some of the jobs get terminated
# with no LTO and 1 build job memory usage peaks at ~ 44% with 16GB
%global _lto_cflags %nil

%global forgeurl https://github.com/facebook/mcrouter
%global tag 2022.03.14.00
%global date %(echo %{tag} | sed -e 's|.00$||' | sed -e 's|\\.||g')

Name:           mcrouter
Version:        0.41.0.%{date}
Release:        %autorelease
Summary:        Memcached protocol router for scaling memcached deployments

License:        MIT
URL:            %{forgeurl}
Source0:        %{url}/archive/v%{tag}/%{name}-%{tag}.tar.gz
# distutils deprecated in Python 3.10
Patch0:         %{name}-0.41.0-no_distutils.patch

# Folly is known not to work on big-endian CPUs
# https://bugzilla.redhat.com/show_bug.cgi?id=1892151
ExcludeArch:    s390x
# configure fails to find boost for some reason
# https://bugzilla.redhat.com/show_bug.cgi?id=1943729
ExcludeArch:    ppc64le
# multiple issues due to hardcoded pointer sizes
# https://bugzilla.redhat.com/show_bug.cgi?id=1943736
ExcludeArch:    %{ix86}
%if 0%{?el8}
ExcludeArch:    %{arm}
%else
ExcludeArch:    %{arm32}
%endif

BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  make
BuildRequires:  sed
BuildRequires:  gcc-c++
BuildRequires:  folly-devel
BuildRequires:  fizz-devel
BuildRequires:  wangle-devel
BuildRequires:  fbthrift-devel
BuildRequires:  fbthrift
# for free
BuildRequires:  procps-ng
BuildRequires:  python3-devel
BuildRequires:  python3-fbthrift-devel
BuildRequires:  ragel
# Test dependencies
BuildRequires:  gtest-devel

%description
Mcrouter (pronounced mc router) is a memcached protocol router for scaling
memcached deployments.

Because the routing and feature logic are abstracted from the client in
mcrouter deployments, the client may simply communicate with destination
hosts through mcrouter over a TCP connection using standard memcached
protocol. Typically, little or no client modification is needed to use
mcrouter, which was designed to be a drop-in proxy between the client and
memcached hosts.


%prep
%autosetup -p1 -n %{name}-%{tag}
pushd %{name}
echo "%{version}" > VERSION
autoreconf --install


%build
pushd %{name}
export FBTHRIFT_BIN="%{_bindir}"
export PYTHON_VERSION="%{python3_version}"
%configure --enable-shared --disable-static
# do not eat all memory
%make_build %{limit_build -m 4096}


%install
pushd %{name}
%make_install


%if %{with check}
%check
pushd %{name}
%make_build check
%endif


%files
%license LICENSE
%doc README.md
%{_bindir}/*


%changelog
%autochangelog