This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
/
mysql-router.spec.in
219 lines (194 loc) · 7.08 KB
/
mysql-router.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
#
# MySQL MySQL Router is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptions to the terms and
# conditions of the GPLv2 as it is applied to this software, see the
# FOSS License Exception
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
%{!?src_base: %global src_base mysql-router}
%global src_dir %{src_base}-%{version}
%if 0%{?suse_version} == 1315
%global dist .sles12
%endif
%if 0%{?commercial}
%global license_type Commercial
%global product_suffix -commercial
%global project_edition "-DPROJECT_EDITION=\"Commercial\""
%else
%global license_type GPLv2
%endif
%{!?with_systemd: %global systemd 1}
%{?el6: %global systemd 0}
Summary: MySQL Router
Name: mysql-router%{?product_suffix}
Version: @PROJECT_VERSION_TEXT@
Release: 1%{?commercial:.1}%{?dist}
License: @ORACLE_COPYRIGHT@ Under %{?license_type} license as shown in the Description field.
Group: Applications/Databases
URL: https://dev.mysql.com/downloads/router/
Source0: https://cdn.mysql.com/Downloads/router/mysql-router-%{?commercial:commercial-}%{version}.tar.gz
Source1: mysqlrouter.service
Source2: mysqlrouter.tmpfiles.d
Source3: mysqlrouter.init
Source4: mysqlrouter.ini
BuildRequires: cmake
%{?el6:BuildRequires: devtoolset-3-gcc}
%{?el6:BuildRequires: devtoolset-3-gcc-c++}
%if 0%{?commercial}
Provides: mysql-router = %{version}-%{release}
Obsoletes: mysql-router < %{version}-%{release}
%endif
%if 0%{?suse_version} >= 1210
BuildRequires: systemd-rpm-macros
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if 0%{?systemd}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
%endif
%description
The MySQL(TM) Router software delivers a fast, multi-threaded way of
routing connections from MySQL Clients to MySQL Servers. MySQL is a
trademark of Oracle.
The MySQL software has Dual Licensing, which means you can use the
MySQL software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from Oracle and/or its affiliates if you do not wish to be
bound by the terms of the GPL. See the chapter "Licensing and Support"
in the manual for further info.
The MySQL web site (http://www.mysql.com/) provides the latest news
and information about the MySQL software. Also please see the
documentation and the manual for more information.
%package -n mysql-router%{?product_suffix}-devel
Summary: Development header files and libraries for MySQL Router
Group: Applications/Databases
%if 0%{?commercial}
Provides: mysql-router-devel = %{version}-%{release}
Obsoletes: mysql-router-devel < %{version}-%{release}
%endif
%description -n mysql-router%{?product_suffix}-devel
This package contains the development header files and libraries
necessary to develop MySQL Router applications.
%prep
%setup -q
%build
mkdir release && pushd release
%{?el6:export CC=/opt/rh/devtoolset-3/root/usr/bin/gcc}
%{?el6:export CXX=/opt/rh/devtoolset-3/root/usr/bin/g++}
cmake .. -DINSTALL_LAYOUT=RPM \
-DWITH_STATIC=yes -DWITH_MYSQL="%{with_mysql}" %{?project_edition}
make %{?_smp_mflags} VERBOSE=1
popd
%install
rm -rf %{buildroot}
pushd release
%{?el6:export CC=/opt/rh/devtoolset-3/root/usr/bin/gcc}
%{?el6:export CXX=/opt/rh/devtoolset-3/root/usr/bin/g++}
make DESTDIR=%{buildroot} install
install -d -m 0755 %{buildroot}/%{_localstatedir}/log/mysqlrouter
install -d -m 0755 %{buildroot}/%{_localstatedir}/run/mysqlrouter
%if 0%{?systemd}
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/mysqlrouter.service
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/mysqlrouter.conf
%else
install -D -p -m 0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/mysqlrouter
%endif
install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/mysqlrouter/mysqlrouter.ini
# remove some unwanted files
rm -rf %{buildroot}%{_includedir}
rm -rf %{buildroot}/%{_libdir}/libmysqlharness.a
%clean
rm -rf %{buildroot}
%pre
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/false \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%if 0%{?suse_version}
%service_add_pre mysqlrouter.service
%endif
%post
/sbin/ldconfig
%if 0%{?systemd}
%if 0%{?suse_version}
%service_add_post mysqlrouter.service
/usr/bin/systemd-tmpfiles --create %{_tmpfilesdir}/mysqlrouter.conf >/dev/null 2>&1 || :
%else
%systemd_post mysqlrouter.service
%endif # suse_version
%else
/sbin/chkconfig --add mysqlrouter
%endif # systemd
%preun
%if 0%{?systemd}
%if 0%{?suse_version}
%service_del_preun mysqlrouter.service
%else
%systemd_preun mysqlrouter.service
%endif # suse_version
%else
if [ "$1" = 0 ]; then
/sbin/service mysqlrouter stop >/dev/null 2>&1 || :
/sbin/chkconfig --del mysqlrouter
fi
%endif # systemd
%postun
/sbin/ldconfig
%if 0%{?systemd}
%if 0%{?suse_version}
%service_del_postun mysqlrouter.service
%else
%systemd_postun_with_restart mysqlrouter.service
%endif # suse_version
%else
if [ $1 -ge 1 ]; then
/sbin/service mysqlrouter condrestart >/dev/null 2>&1 || :
fi
%endif # systemd
%files
%defattr(-, root, root, -)
%doc License.txt README.txt
%dir %{_sysconfdir}/mysqlrouter
%config(noreplace) %{_sysconfdir}/mysqlrouter/mysqlrouter.ini
%{_sbindir}/mysqlrouter
%if 0%{?systemd}
%{_unitdir}/mysqlrouter.service
%{_tmpfilesdir}/mysqlrouter.conf
%else
%{_sysconfdir}/init.d/mysqlrouter
%endif
%{_libdir}/libmysql*.so.*
%{_libdir}/libmysqlharness.so
%{_libdir}/libmysqlrouter.so
%dir %{_libdir}/mysqlrouter
%{_libdir}/mysqlrouter/*.so
%dir %attr(755, mysql, mysql) %{_localstatedir}/log/mysqlrouter
%dir %attr(755, mysql, mysql) %{_localstatedir}/run/mysqlrouter
%changelog
* Thu Nov 26 2015 Balasubramanian Kandasamy <balasubramanian.kandasamy@oracle.com> - 2.0.3-1
- Add support for el6
- Fix group and buildreq
* Thu Oct 15 2015 Geert Vanderkelen <geert.vanderkelen@oracle.com> - 2.0.2-1
- Added pre and postun scripts for sles
- Making version a variable and using _libdir
- Adding -DWITH_MYSQL and building libmysqlclient statically in
* Wed Aug 19 2015 Geert Vanderkelen <geert.vanderkelen@oracle.com> - 2.0.1-1
- Initial version