%global _hardened_build 1 %global errmsg_dir %{_datadir}/mariadb/english #%global __requires_exclude ^lib(inih|utils)\\.so.*$ Summary: A database-centric proxy that works with MariaDB and MySQL Name: maxscale Version: 1.2.0 Release: 0.3%{?dist} License: GPLv2+ Group: Applications/Databases URL: https://mariadb.com/products/mariadb-maxscale Source0: https://github.com/mariadb-corporation/MaxScale/archive/%{version}/MaxScale-%{version}.tar.gz Source1: maxscale.service Source2: maxscale.logrotate.systemd Source3: maxscale.profile.d Source4: maxscale.sysconfig Source5: maxscale.tmpfiles.d Patch0: maxscale-sysconfdir.patch BuildRequires: bison BuildRequires: cmake BuildRequires: libaio-devel BuildRequires: libcurl-devel BuildRequires: libedit-devel BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: systemtap-sdt-devel BuildRequires: zlib-devel # redhat-rpm-config is not pulled in automatically BuildRequires: redhat-rpm-config Requires: sh-utils # for useradd Requires(pre): shadow-utils Requires: mariadb-libs BuildRequires: mariadb-embedded-devel BuildRequires: mariadb-devel Requires: mariadb-errmsg BuildRequires: systemd Requires(post): systemd Requires(preun): systemd Requires(postun): systemd # We require this to be present for %%{_tmpfilesdir} Requires: systemd # does not build on arm yet ExcludeArch: %{arm} %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 -n MaxScale-1.2.0 %patch0 -p1 perl -pi -e "s|-Wall -fPIC|%{optflags} -fPIC|g" CMakeLists.txt %build %cmake \ -DSTATIC_EMBEDDED=false \ -DEMBEDDED_LIB=%{_libdir}/mysql \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DWITH_SCRIPTS=N \ -DBUILD_SHARED_LIBS=N \ -DERRMSG=%{errmsg_dir} # the package now uses rpath in order to link with modules located at /usr/lib64/maxscale/ # -DCMAKE_SKIP_RPATH=1 \ make %{?_smp_mflags} VERBOSE=1 # %check # tests TestModutil and TestService fail now # export LD_LIBRARY_PATH=$(pwd)/server/modules/protocol # make testcore || : %install make install DESTDIR=%{buildroot} rm -rf %{buildroot}%{_sysconfdir}/init.d rm -rf %{buildroot}%{_localstatedir}/lib/maxscale/errmsg.sys install -d %{buildroot}%{_localstatedir}/lib/maxscale ln -s %{errmsg_dir}/errmsg.sys %{buildroot}%{_localstatedir}/lib/maxscale/errmsg.sys install -d %{buildroot}%{_sysconfdir}/logrotate.d install -d %{buildroot}%{_localstatedir}/lib/%{name}/{mysql,etc} install -d %{buildroot}%{_tmpfilesdir} install -d %{buildroot}%{_localstatedir}/log/%{name} install -d %{buildroot}%{_localstatedir}/run/%{name} install -d %{buildroot}%{_libdir}/%{name}/modules install -d %{buildroot}%{_unitdir} install -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/ install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} install -p -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf ln -s %{_localstatedir}/run/maxscale %{buildroot}%{_localstatedir}/lib/%{name}/run #install -m0644 server/inih/libinih.so %{buildroot}%{_libdir}/%{name}/ #install -m0644 utils/libutils.so %{buildroot}%{_libdir}/%{name}/ # in order to teach rpm not to mess with it. touch %{buildroot}%{_localstatedir}/lib/%{name}/etc/.secrets %pre getent group %{name} >/dev/null || groupadd -r %{name} getent passwd %{name} >/dev/null || \ useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin \ -c "MaxScale Server" %{name} %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/ # chown %{name}:%{name} %{_localstatedir}/lib/%{name}/etc/.secrets #fi %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %doc %{_datadir}/%{name}/COPYRIGHT %doc %{_datadir}/%{name}/README %license %{_datadir}/%{name}/LICENSE %{_bindir}/* %{_libdir}/%{name}/*.so %dir %{_libdir}/%{name} %dir %{_libdir}/%{name}/modules %{_datadir}/%{name} %{_unitdir}/%{name}.service %attr(0400,%{name},%{name}) %config(noreplace) %{_localstatedir}/lib/maxscale/etc/.secrets %attr(0750,%{name},%{name}) %dir %{_localstatedir}/log/%{name} %attr(0750,%{name},%{name}) %dir %{_localstatedir}/lib/%{name} %dir %{_localstatedir}/lib/%{name}/mysql %{_localstatedir}/lib/%{name}/errmsg.sys %attr(0755,maxscale,maxscale) %dir %{_localstatedir}/run/maxscale %{_localstatedir}/lib/%{name}/run %{_sysconfdir}/%{name}* %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %{_tmpfilesdir}/%{name}.conf %{_mandir}/man1/maxscale.1.* %changelog * Fri Sep 18 2015 Honza Horak 1.2.0-0.3 - rework packaging * Wed Nov 12 2014 Oden Eriksson 1.0.1-0.0.beta.1 - 1.0.1-beta - drop the libtool patch - use cmake - adjust deps a bit - put pid where it should be * Fri Apr 25 2014 Oden Eriksson 0.5.0-1 - 0.5.0 (fedora version) * Fri Apr 04 2014 Oden Eriksson 0.5.0-1 - 0.5.0 (rhel6/fedora version) - run the server as the maxscale user (#1083962) * Mon Mar 31 2014 Oden Eriksson 0.5.0-1 - 0.5.0 (final) * Sat Mar 29 2014 Oden Eriksson 0.5.0-0.1 - generate the .secrets file at install - added systemd support - fix conditionals depending on if the target is rhel6 or later * Fri Mar 28 2014 Oden Eriksson 0.5.0-0.0 - initial RHEL6 package