Name:                predixy
Version:             1.0.5
Release:             1
Summary:             High performance and full featured proxy for redis sentinel and redis cluster
License:             BSD-3-Clause
URL:                 https://github.com/joyieldInc/predixy
Source:              https://github.com/joyieldInc/%{name}/archive/refs/tags/%{version}.tar.gz
BuildRequires:       make gcc-g++ libstdc++-static
Requires:            redis
%description
Predixy is a high performance and fully featured proxy for redis sentinel and redis cluster.

%prep
%setup -q

%build
make %{?_smp_mflags}

%install
install -d -m 0755 %{buildroot}/%{_bindir}
install -d -m 0755 %{buildroot}/usr/local/%{name}
install -d -m 0755 %{buildroot}/usr/local/%{name}/bin
install -d -m 0755 %{buildroot}/usr/local/%{name}/doc
install -d -m 0755 %{buildroot}/usr/local/%{name}/test
install -d -m 0755 %{buildroot}/%{_sysconfdir}/%{name}/

cp -arf src/predixy  %{buildroot}/usr/local/%{name}/bin
cp -arf doc/*        %{buildroot}/usr/local/%{name}/doc
cp -arf test/*       %{buildroot}/usr/local/%{name}/test
cp -arf conf/*       %{buildroot}/%{_sysconfdir}/%{name}/
cp  LICENSE README.md README_CN.md %{buildroot}/usr/local/%{name}

pushd %{buildroot}/usr/local/%{name}/bin
ls | awk '{print $1}'| for line in `xargs`;do
ln -s /usr/local/%{name}/bin/${line} %{buildroot}%{_bindir}/${line}
done
popd

pushd %{buildroot}/usr/local/%{name}
%{__ln_s} %{_sysconfdir}/%{name} conf
popd

%files
%doc README.md README_CN.md LICENSE
/usr/local/%{name}
%{_sysconfdir}/%{name}
%{_bindir}/*

%changelog
* Sat Jul 17 2021 liyanan <liyanan32@huawei.com> - 1.0.5-1
- package init
