Blob Blame History Raw
Summary:       A high-performance MySQL proxy
Name:          proxysql
Version:       1.3.7
Release:       4%{?dist}
URL:           http://www.proxysql.com/
# The entire source code is GPLv3+ except deps/re2 and deps/jemalloc which is BSD
# and deps/mariadb-connector-c which is LGPLv2+
License:       GPLv3+ and LGPLv2+ and BSD
Group:         Development/Tools

BuildRequires: openssl-devel
BuildRequires: cmake
BuildRequires: systemd
BuildRequires: libconfig-devel
BuildRequires: libdaemon-devel
BuildRequires: sqlite-devel

# Build in other architectures aside from x86 is not yet supported due to some
# use of assembly code, but is on the upstream roadmap to support them.
# https://github.com/sysown/proxysql/issues/977
ExcludeArch:   %{arm} %{power64} s390x aarch64

Provides:      bundled(jemalloc) = 4.3.1
Provides:      bundled(mariadb-connector-c) = 2.3.1
Provides:      bundled(re2) = 20140304

Source0:       https://github.com/sysown/proxysql/archive/v%{version}.tar.gz
Source1:       proxysql.service
Source2:       proxysql.1

# The upstream code bundles 6 libraries: libconfig, libdaemon, sqlite3, re2,
# mariadb-connector-c and jemalloc.
# This patch de-bundles 3 of these libraries: libconfig, libdaemon and sqlite3
# The remaining libraries are not de-bundled due to different reasons (mainly
# being patched, more info here: https://bugzilla.redhat.com/show_bug.cgi?id=1457929).
Patch0: proxysql_debundle_libconfig_libdaemon_sqlite3.patch

%description
ProxySQL is a high performance, high availability, protocol aware proxy for
MySQL and forks (like Percona Server and MariaDB).

%prep
%setup -q
%patch0 -p1
rm -rf deps/libconfig deps/libdaemon deps/sqlite3

%build
%global _configure :
%configure
export CPPFLAGS=$CXXFLAGS
make %{?_smp_mflags}

%install
install -p -D -m 0755 src/proxysql -t %{buildroot}%{_bindir}
install -p -D -m 0640 etc/proxysql.cnf -t %{buildroot}%{_sysconfdir}
install -p -D -m 0755 tools/proxysql_galera_checker.sh -t %{buildroot}%{_datadir}/%{name}/tools
install -p -D -m 0755 tools/proxysql_galera_writer.pl -t %{buildroot}%{_datadir}/%{name}/tools
install -p -D -m 0644 %{SOURCE1} -t %{buildroot}%{_unitdir}
install -p -D -m 0644 README.md -t %{buildroot}%{_docdir}/proxysql
install -p -D -m 0644 RUNNING.md -t %{buildroot}%{_docdir}/proxysql
install -p -D -m 0644 FAQ.md -t %{buildroot}%{_docdir}/proxysql
install -p -D -m 0644 doc/*.md -t %{buildroot}%{_docdir}/proxysql
install -p -D -m 0644 %{SOURCE2} -t %{buildroot}%{_mandir}/man1
install -d -D -m 0755 %{buildroot}%{_sharedstatedir}/proxysql

%pre
/usr/sbin/groupadd -r proxysql >/dev/null 2>&1 || :
/usr/sbin/useradd  -g proxysql -r -d /var/lib/proxysql -s /sbin/nologin \
    -c "ProxySQL" proxysql >/dev/null 2>&1 || :

%post
%systemd_post proxysql.service

%preun
%systemd_preun proxysql.service

%postun
%systemd_postun_with_restart proxysql.service

%files
%{_bindir}/*
%{_unitdir}/*
%{_datadir}/%{name}
%{_docdir}/%{name}
%{_mandir}/man1/*
%license LICENSE
%defattr(-,proxysql,proxysql,-)
%{_sharedstatedir}/%{name}
%defattr(-,proxysql,root,-)
%config(noreplace) %{_sysconfdir}/%{name}.cnf

%changelog
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Thu Jun 15 2017  Augusto Caringi <acaringi@redhat.com> 1.3.7-2
- Fixed build flags through exporting CPPFLAGS variable
- Remove unused bundled libraries
- Fixed configuration file ownership
- Replaced default login shell of proxysql user from /bin/false to /sbin/nologin

* Wed Jun 14 2017  Augusto Caringi <acaringi@redhat.com> 1.3.7-1
- Updated to ProxySQL 1.3.7
- De-bundled some libraries
- Added man page
- Updated license field
- Adopted proxysql user/group
- Improvements in spec file

* Tue May 16 2017  Augusto Caringi <acaringi@redhat.com> 1.3.6-1
- Initial build