Skip to content

Commit 96bd934

Browse files
committed
Adapt to MySQL Connector C++ 8.0
1 parent aedb327 commit 96bd934

File tree

3 files changed

+173
-0
lines changed

3 files changed

+173
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,10 @@ ADD_SUBDIRECTORY(common)
449449
ADD_SUBDIRECTORY(xapi)
450450
ADD_SUBDIRECTORY(devapi)
451451

452+
#
453+
# Packaging
454+
#
455+
ADD_SUBDIRECTORY(packaging)
452456

453457
#
454458
# Target which builds the final connector library

packaging/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License, version 2.0, as
6+
# published by the Free Software Foundation.
7+
#
8+
# This program is also distributed with certain software (including
9+
# but not limited to OpenSSL) that is licensed under separate terms,
10+
# as designated in a particular file or component or in included license
11+
# documentation. The authors of MySQL hereby grant you an
12+
# additional permission to link the program and your derivative works
13+
# with the separately licensed software that they have included with
14+
# MySQL.
15+
#
16+
# Without limiting anything contained in the foregoing, this file,
17+
# which is part of MySQL Connector/C++, is also subject to the
18+
# Universal FOSS Exception, version 1.0, a copy of which can be found at
19+
# http://oss.oracle.com/licenses/universal-foss-exception.
20+
#
21+
# This program is distributed in the hope that it will be useful, but
22+
# WITHOUT ANY WARRANTY; without even the implied warranty of
23+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24+
# See the GNU General Public License, version 2.0, for more details.
25+
#
26+
# You should have received a copy of the GNU General Public License
27+
# along with this program; if not, write to the Free Software Foundation, Inc.,
28+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29+
30+
CONFIGURE_FILE(mysql-connector-c++.spec.in ${CMAKE_CURRENT_BINARY_DIR}/mysql-connector-c++.spec @ONLY)

packaging/mysql-connector-c++.spec.in

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#
2+
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License, version 2.0, as
6+
# published by the Free Software Foundation.
7+
#
8+
# This program is also distributed with certain software (including
9+
# but not limited to OpenSSL) that is licensed under separate terms,
10+
# as designated in a particular file or component or in included license
11+
# documentation. The authors of MySQL hereby grant you an
12+
# additional permission to link the program and your derivative works
13+
# with the separately licensed software that they have included with
14+
# MySQL.
15+
#
16+
# Without limiting anything contained in the foregoing, this file,
17+
# which is part of MySQL Connector/C++, is also subject to the
18+
# Universal FOSS Exception, version 1.0, a copy of which can be found at
19+
# http://oss.oracle.com/licenses/universal-foss-exception.
20+
#
21+
# This program is distributed in the hope that it will be useful, but
22+
# WITHOUT ANY WARRANTY; without even the implied warranty of
23+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24+
# See the GNU General Public License, version 2.0, for more details.
25+
#
26+
# You should have received a copy of the GNU General Public License
27+
# along with this program; if not, write to the Free Software Foundation, Inc.,
28+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29+
30+
%{?mysql_dir: %global mysql_opt -DMYSQL_DIR=%{mysql_dir}}
31+
%{!?commercial: %global license_type GPLv2}
32+
%{?commercial: %global license_type Commercial}
33+
%{?commercial: %global product_suffix -commercial}
34+
%{!?_licensedir: %global license %doc}
35+
36+
Summary: MySQL database connector for C++
37+
Name: mysql-connector-c++%{?product_suffix}
38+
Version: @CONCPP_VERSION@
39+
Release: 1%{?commercial:.1}%{?dist}
40+
License: %{license_type}
41+
URL: https://dev.mysql.com/doc/connector-cpp/en/
42+
Source0: https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++%{?product_suffix}-%{version}-src.tar.gz
43+
BuildRequires: boost-devel
44+
BuildRequires: cmake
45+
%if 0%{?fedora}
46+
BuildRequires: gcc
47+
BuildRequires: gcc-c++
48+
%else
49+
BuildRequires: devtoolset-7-gcc
50+
BuildRequires: devtoolset-7-gcc-c++
51+
%endif
52+
%{!?mysql_dir:BuildRequires: mysql-devel}
53+
BuildRequires: openssl-devel
54+
%{?commercial:Obsoletes: mysql-connector-c++ < %{version}-%{release}}
55+
%description
56+
A C++ interface for communicating with MySQL servers.
57+
58+
%package jdbc
59+
Summary: MySQL Driver for C++ which mimics the JDBC 4.0 API
60+
%{?commercial:Obsoletes: mysql-connector-c++-jdbc < %{version}-%{release}}
61+
%description jdbc
62+
This MySQL Driver for C++ mimics the JDBC 4.0 API.
63+
64+
%package devel
65+
Summary: Development header files and libraries for MySQL C++ client applications
66+
%if 0%{?commercial}
67+
Requires: mysql-connector-c++-commercial = %{version}-%{release}
68+
Requires: mysql-connector-c++-commercial-jdbc = %{version}-%{release}
69+
Obsoletes: mysql-connector-c++-devel < %{version}-%{release}
70+
%else
71+
Requires: mysql-connector-c++ = %{version}-%{release}
72+
Requires: mysql-connector-c++-jdbc = %{version}-%{release}
73+
%endif
74+
%description devel
75+
This package contains the development header files and libraries necessary
76+
to develop MySQL client applications in C++.
77+
78+
%prep
79+
%setup -q -n mysql-connector-c++%{product_suffix}-%{version}-src
80+
81+
%build
82+
%if 0%{?rhel}
83+
export CC=/opt/rh/devtoolset-7/root/usr/bin/gcc
84+
export CXX=/opt/rh/devtoolset-7/root/usr/bin/g++
85+
%endif
86+
mkdir build && pushd build
87+
%cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_JDBC=ON -DWITH_SSL=system %{?mysql_opt}
88+
make %{?_smp_mflags} VERBOSE=1
89+
popd
90+
mkdir static && pushd static
91+
%cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_JDBC=ON -DWITH_SSL=system %{?mysql_opt} \
92+
-DBUILD_STATIC=ON
93+
make %{?_smp_mflags} VERBOSE=1
94+
95+
%install
96+
pushd build
97+
make DESTDIR=%{buildroot} install
98+
popd
99+
pushd static
100+
make DESTDIR=%{buildroot} install
101+
install -d -m0755 %{buildroot}%{_includedir}/mysql-cppconn-8
102+
mv %{buildroot}%{_includedir}/{jdbc,mysqlx} %{buildroot}%{_includedir}/mysql-cppconn-8
103+
ln -s mysql-cppconn-8 %{buildroot}%{_includedir}/mysql-cppconn
104+
rm %{buildroot}/usr/BUILDINFO.txt
105+
106+
%post -p /sbin/ldconfig
107+
%postun -p /sbin/ldconfig
108+
109+
%post jdbc -p /sbin/ldconfig
110+
%postun jdbc -p /sbin/ldconfig
111+
112+
%files
113+
%license LICENSE.txt
114+
%doc README.txt
115+
%{_libdir}/libmysqlcppconn8.so.1*
116+
117+
%files jdbc
118+
%license LICENSE.txt
119+
%doc README.txt
120+
%{_libdir}/libmysqlcppconn.so.7*
121+
122+
%files devel
123+
%license LICENSE.txt
124+
%doc README.txt build/BUILDINFO.txt
125+
%{_libdir}/libmysqlcppconn.so
126+
%{_libdir}/libmysqlcppconn-static.a
127+
%{_libdir}/libmysqlcppconn8.so
128+
%{_libdir}/libmysqlcppconn8-static.a
129+
%{_includedir}/mysql-cppconn
130+
%dir %{_includedir}/mysql-cppconn-8
131+
%{_includedir}/mysql-cppconn-8/mysqlx
132+
%{_includedir}/mysql-cppconn-8/jdbc
133+
134+
%changelog
135+
* Wed May 16 2018 Balasubramanian Kandasamy <[email protected]> - 8.0.11-1
136+
- Adapt to MySQL Connector C++ 8.0
137+
138+
* Tue Apr 05 2016 Kent Boortz <[email protected]> - 2.0.1-1
139+
- initial package

0 commit comments

Comments
 (0)