Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release-src > by-pkgid > ed7fa7c0859552ed86bc18a6e6ef8bdd > files > 7

maxscale-0.7.0-4.mga5.src.rpm

%define build_sysv 0
%define build_systemd 1

%if %{build_sysv}
%define build_sysv 1
%define build_systemd 0
%endif

%if %{build_systemd}
%define build_sysv 0
%define build_systemd 1
%endif

Summary:	A database-centric proxy that works with MariaDB and MySQL
Name:		maxscale
Version:	0.7.0
Release:	%mkrel 4
License:	GPL
Group:		System/Servers
URL:		http://www.skysql.com/downloads/maxscale-mariadb-mysql-query-tool-downloads
Source0:	https://downloads.skysql.com/files/SkySQL/MaxScale/maxscale.src.%{version}.tar.gz
Source1:	maxscale.init
Source2:	maxscale.logrotate
Source3:	maxscale.service
Source4:	maxscale.logrotate.systemd
Source5:	maxscale.profile.d
Source6:	maxscale.sysconfig
# attempt to make it somewhat libtool aware
Patch0:		maxscale-0.7.0-libtool.diff
BuildRequires:	bison
BuildRequires:	chrpath
BuildRequires:	libaio-devel
BuildRequires:	libtool
BuildRequires:	mysql-embedded-devel
BuildRequires:	ncurses-devel
BuildRequires:	openssl-devel
BuildRequires:	systemtap
Requires(post):  rpm-helper >= 0.24.8-1
Requires(preun): rpm-helper >= 0.24.8-1
Requires(pre): rpm-helper >= 0.24.8-1

%if %{build_systemd}
BuildRequires:	systemd-units
%endif

%description
MaxScale is an open-source, database-centric proxy that works with MariaDB and
MySQL

It has a pluggable architecture designed to increase flexibility and aid
customisation as well as a lightweight, high-speed networking core designed to
facilitate throughput.

MaxScale runs between the client application and the database cluster and
currently offers connection and statement-based load balancing.

%prep

%setup -q
%patch0 -p1

%build
export LC_ALL=C
export CFLAGS="%{optflags}"
export LDFLAGS="%{ldflags}"

make ROOT_PATH=`pwd` MYSQL_ROOT=%{_includedir}/mysql DYNLIB=Y EMBEDDED_LIB=%{_libdir} ERRMSG=%{_datadir}/mysql depend
make ROOT_PATH=`pwd` MYSQL_ROOT=%{_includedir}/mysql DYNLIB=Y EMBEDDED_LIB=%{_libdir} ERRMSG=%{_datadir}/mysql libdir=%{_libdir}

%install

install -d %{buildroot}%{_sysconfdir}/{logrotate.d,profile.d,sysconfig}
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_sbindir}
install -d %{buildroot}%{_libdir}/%{name}/modules
install -d %{buildroot}%{_localstatedir}/lib/%{name}/{mysql,etc}
install -d %{buildroot}%{_localstatedir}/log/%{name}

%if %{build_sysv}
install -d %{buildroot}%{_initrddir}
install -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%endif

%if %{build_systemd}
install -d %{buildroot}%{_unitdir}
install -m0644 %{SOURCE3} %{buildroot}%{_unitdir}/
install -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%endif

install -m0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/profile.d/99%{name}.sh
install -m0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysconfig/%{name}

install -m0755 server/core/maxkeys %{buildroot}%{_bindir}/
install -m0755 server/core/maxpasswd %{buildroot}%{_bindir}/
install -m0755 server/core/%{name} %{buildroot}%{_sbindir}/

install -m0755 server/modules/protocol/.libs/*.so %{buildroot}%{_libdir}/%{name}/modules/
install -m0755 server/modules/routing/.libs/*.so %{buildroot}%{_libdir}/%{name}/modules/
install -m0755 server/modules/routing/readwritesplit/.libs/*.so %{buildroot}%{_libdir}/%{name}/modules/
install -m0755 server/modules/monitor/.libs/*.so %{buildroot}%{_libdir}/%{name}/modules/
install -m0755 server/modules/monitor/.libs/*.so %{buildroot}%{_libdir}/%{name}/modules/

chrpath -d %{buildroot}%{_libdir}/%{name}/modules/*.so

install -m0755 query_classifier/.libs/libquery_classifier.so.0.* %{buildroot}%{_libdir}/
install -m0755 log_manager/.libs/liblog_manager.so.0.* %{buildroot}%{_libdir}/
ln -snf liblog_manager.so.0.0.0 %{buildroot}%{_libdir}/liblog_manager.so.0
ln -snf libquery_classifier.so.0.0.0 %{buildroot}%{_libdir}/libquery_classifier.so.0

install -m0644 server/MaxScale_template.cnf %{buildroot}%{_sysconfdir}/MaxScale.cnf

# hmm...
ln -s %{_localstatedir}/log/%{name} %{buildroot}%{_localstatedir}/lib/%{name}/log
ln -s %{_datadir}/mysql/default/errmsg.sys %{buildroot}%{_localstatedir}/lib/%{name}/mysql/errmsg.sys
ln -s %{_libdir}/%{name}/modules %{buildroot}%{_localstatedir}/lib/%{name}/modules
ln -s %{_sysconfdir}/MaxScale.cnf %{buildroot}%{_localstatedir}/lib/%{name}/etc/MaxScale.cnf
ln -s %{_localstatedir}/lib/%{name} %{buildroot}%{_sysconfdir}/MaxScale

# in order to teach rpm not to mess with it.
touch %{buildroot}%{_localstatedir}/lib/%{name}/etc/.secrets

%pre
%_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin

%post
# generate the unique .secrets file
if [ -e %{_localstatedir}/lib/%{name}/etc/.secrets ]; then
    MAXSCALE_HOME=%{_localstatedir}/lib/%{name} %{_bindir}/maxkeys %{_localstatedir}/lib/%{name}/etc/.secrets
    chmod 0400 %{_localstatedir}/lib/%{name}/etc/.secrets
    chown %{name}:%{name} %{_localstatedir}/lib/%{name}/etc/.secrets
fi
%_post_service %{name}

%preun
%_preun_service %{name}

%files
%doc Documentation/*.pdf Documentation/internal/*.pdf COPYRIGHT LICENSE README SETUP
%if %{build_sysv}
%{_initrddir}/%{name}
%endif
%if %{build_systemd}
%{_unitdir}/%{name}.service
%endif
%attr(0640,root,%{name}) %config(noreplace) %{_sysconfdir}/MaxScale.cnf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/profile.d/99%{name}.sh
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%attr(0400,%{name},%{name}) %config(noreplace) %{_localstatedir}/lib/maxscale/etc/.secrets
%attr(0750,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
%{_bindir}/*
%{_sbindir}/*
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/modules
%{_libdir}/%{name}/modules/*.so
%{_libdir}/libquery_classifier.so.*
%{_libdir}/liblog_manager.so.*
%attr(0750,%{name},%{name}) %dir %{_localstatedir}/lib/%{name}
%dir %{_localstatedir}/lib/%{name}/mysql
%{_localstatedir}/lib/%{name}/mysql/errmsg.sys
%{_localstatedir}/lib/%{name}/modules
%{_localstatedir}/lib/%{name}/log
%dir %{_localstatedir}/lib/%{name}/etc
%{_localstatedir}/lib/%{name}/etc/MaxScale.cnf
%{_sysconfdir}/MaxScale


%changelog
* Wed Oct 15 2014 umeabot <umeabot> 0.7.0-4.mga5
+ Revision: 741557
- Second Mageia 5 Mass Rebuild

* Tue Sep 16 2014 umeabot <umeabot> 0.7.0-3.mga5
+ Revision: 682305
- Mageia 5 Mass Rebuild

* Tue Aug 12 2014 oden <oden> 0.7.0-2.mga5
+ Revision: 662043
- rebuilt for mariadb-10.0.13

* Mon Jun 16 2014 oden <oden> 0.7.0-1.mga5
+ Revision: 637460
- 0.7.0

* Tue May 13 2014 oden <oden> 0.6.0-1.mga5
+ Revision: 622446
- 0.6.0

* Fri Apr 04 2014 oden <oden> 0.5.0-3.mga5
+ Revision: 611623
- run the server as the maxscale user
- various spec file cleanups

* Thu Apr 03 2014 oden <oden> 0.5.0-2.mga5
+ Revision: 611462
- better fix
- hmm...
- various spec file fixes
- added one important upstream patch (ignore /etc/my.cnf)

* Mon Mar 31 2014 oden <oden> 0.5.0-1.mga5
+ Revision: 610933
- 0.5.0 (final)

* Sat Mar 29 2014 oden <oden> 0.5.0-0.4.mga5
+ Revision: 609305
- added systemd support
- generate the .secrets file at install
- phew. getting sloppy

* Sat Mar 29 2014 oden <oden> 0.5.0-0.3.mga5
+ Revision: 609282
- no use making the maxscale user, yet
- make it work a little better
- oops, one faulty softlink

* Fri Mar 28 2014 oden <oden> 0.5.0-0.2.mga5
+ Revision: 609084
- use the 0.5 branch with format string fixes
- use %%{optflags} and %%{ldflags} with some undefined fixes in P0

* Fri Mar 28 2014 oden <oden> 0.5.0-0.1.mga5
+ Revision: 609070
- simplify a bit and use the /etc/sysconfig/maxscale to set options

* Thu Mar 27 2014 oden <oden> 0.5.0-0.0.mga5
+ Revision: 608997
- try to fix rpmlint errors
- fix deps
- imported package maxscale


* Thu Mar 27 2014 Oden Eriksson <oden@skysql.com> 0.5.0-0.0
- initial Mageia package (rhel6 compat)