You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
141 lines
4.8 KiB
141 lines
4.8 KiB
## |
|
## mysqlproxy.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/> |
|
## |
|
## Permission to use, copy, modify, and distribute this software for |
|
## any purpose with or without fee is hereby granted, provided that |
|
## the above copyright notice and this permission notice appear in all |
|
## copies. |
|
## |
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
## SUCH DAMAGE. |
|
## |
|
|
|
# package information |
|
Name: mysqlproxy |
|
Summary: MySQL Proxy Server |
|
URL: http://www.mysql.com/products/mysql/ |
|
Vendor: MySQL AB |
|
Packager: OpenPKG Project |
|
Distribution: OpenPKG Community |
|
Class: EVAL |
|
Group: Database |
|
License: GPL |
|
Version: 0.8.2 |
|
Release: 20120713 |
|
|
|
# list of sources |
|
Source0: http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-Proxy/mysql-proxy-%{version}.tar.gz |
|
Source1: rc.mysqlproxy |
|
Source2: mysqlproxy.ini |
|
Source3: mysqlproxy.lua |
|
Patch0: mysqlproxy.patch |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20160101, make, gcc, gcc::with_cxx = yes, flex |
|
PreReq: OpenPKG, openpkg >= 20160101 |
|
BuildPreReq: mysql, lua, glib, gettext, pcre, libevent, gettext |
|
PreReq: mysql, lua, glib, gettext, pcre, libevent, gettext |
|
|
|
%description |
|
MySQL Proxy is a proxy server for the MySQL RDBMS. |
|
|
|
%track |
|
prog mysqlproxy = { |
|
version = %{version} |
|
url = http://dev.mysql.com/downloads/mysql-proxy/ |
|
regex = mysql-proxy-(__VER__)\.tar\.gz |
|
} |
|
|
|
%prep |
|
%setup -q -n mysql-proxy-%{version} |
|
%patch -p0 |
|
|
|
%build |
|
# configure source tree |
|
CC="%{l_cc}" \ |
|
CXX="%{l_cxx}" \ |
|
CFLAGS="%{l_cflags -O}" \ |
|
CXXFLAGS="%{l_cxxflags -O}" \ |
|
CPPFLAGS="%{l_cppflags}" \ |
|
LDFLAGS="%{l_ldflags}" \ |
|
LIBS="-levent -lintl -lm" \ |
|
./configure \ |
|
--prefix=%{l_prefix} \ |
|
--mandir=%{l_prefix}/man \ |
|
--libdir=%{l_prefix}/lib/mysql-proxy \ |
|
--with-mysql=%{l_prefix} \ |
|
--with-lua \ |
|
--enable-shared \ |
|
--enable-static |
|
|
|
# build source tree |
|
%{l_make} %{l_mflags -O} |
|
|
|
%install |
|
# perform standard installation procedure |
|
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
|
|
|
# strip down installation |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/include |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/mysql-proxy/libmysql*.a |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/mysql-proxy/lua/*.a |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/mysql-proxy/plugins/*.a |
|
mv $RPM_BUILD_ROOT%{l_prefix}/lib/mysql-proxy/mysql-proxy/* \ |
|
$RPM_BUILD_ROOT%{l_prefix}/lib/mysql-proxy/ |
|
rmdir $RPM_BUILD_ROOT%{l_prefix}/lib/mysql-proxy/mysql-proxy |
|
|
|
# install default configuration |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/mysqlproxy |
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
%{SOURCE mysqlproxy.ini} $RPM_BUILD_ROOT%{l_prefix}/etc/mysqlproxy/ |
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
%{SOURCE mysqlproxy.lua} $RPM_BUILD_ROOT%{l_prefix}/etc/mysqlproxy/ |
|
|
|
# install run-command script |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
%{SOURCE rc.mysqlproxy} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
|
|
# create run-time directory |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/mysqlproxy |
|
|
|
# determine the package files |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
%{l_files_std} \ |
|
'%config %attr(600,%{l_nusr},%{l_ngrp}) %{l_prefix}/etc/mysqlproxy/*' \ |
|
'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/mysqlproxy' |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
%post |
|
# after upgrade, restart service |
|
[ $1 -eq 2 ] || exit 0 |
|
eval `%{l_rc} mysqlproxy status 2>/dev/null` |
|
[ ".$mysqlproxy_active" = .yes ] && %{l_rc} mysqlproxy restart |
|
exit 0 |
|
|
|
%preun |
|
# before erase, stop service and remove log files |
|
[ $1 -eq 0 ] || exit 0 |
|
%{l_rc} mysqlproxy stop 2>/dev/null |
|
rm -f $RPM_INSTALL_PREFIX/var/mysqlproxy/* >/dev/null 2>&1 || true |
|
exit 0 |
|
|
|
|