|
| 1 | +# |
| 2 | +# Copyright (c) 2018, 2019, 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 | +# Arguments that can be fiven to "rpmbuild" |
| 31 | +# |
| 32 | +# mysql_dir Path to the MySQL installation, where to find the client lib |
| 33 | +# commercial If set, is a commercial build |
| 34 | + |
| 35 | +%{?mysql_dir: %global mysql_opt -DMYSQL_DIR=%{mysql_dir}} |
| 36 | +%{!?commercial: %global license_type GPLv2} |
| 37 | +%{?commercial: %global license_type Commercial} |
| 38 | +%{?commercial: %global product_suffix -commercial} |
| 39 | +%{!?commercial: %global product_suffix %{nil}} |
| 40 | + |
| 41 | +%{?el6:%global __strip /opt/rh/devtoolset-7/root/usr/bin/strip} |
| 42 | + |
| 43 | +%if 0%{?suse_version} == 1315 |
| 44 | +%global dist .sles12 |
| 45 | +%endif |
| 46 | + |
| 47 | +%if 0%{?suse_version} == 1500 |
| 48 | +%global dist .sl15 |
| 49 | +%endif |
| 50 | + |
| 51 | +Summary: MySQL database connector for C++ |
| 52 | +Name: mysql-connector-c++%{?product_suffix} |
| 53 | +Version: 1.0 |
| 54 | +Release: 1%{?commercial:.1}%{?dist} |
| 55 | +License: %{license_type} |
| 56 | +URL: https://dev.mysql.com/doc/connector-cpp/en/ |
| 57 | +Source0: https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++%{?product_suffix}-%{version}.tar.gz |
| 58 | +#BuildRequires: boost-devel |
| 59 | +%if 0%{?rhel} |
| 60 | +BuildRequires: cmake3 |
| 61 | +%else |
| 62 | +BuildRequires: cmake |
| 63 | +%endif |
| 64 | +%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8 |
| 65 | +BuildRequires: gcc |
| 66 | +BuildRequires: gcc-c++ |
| 67 | +%else |
| 68 | +BuildRequires: gcc |
| 69 | +BuildRequires: gcc-c++ |
| 70 | +%endif |
| 71 | +%{!?mysql_dir:BuildRequires: mysql-devel} |
| 72 | +BuildRequires: openssl-devel |
| 73 | +%{?commercial:Obsoletes: mysql-connector-c++ < %{version}-%{release}} |
| 74 | +%description |
| 75 | +A C++ interface for communicating with MySQL servers. |
| 76 | + |
| 77 | +%package devel |
| 78 | +Summary: Development header files and libraries for MySQL C++ client applications |
| 79 | +%if 0%{?commercial} |
| 80 | +Requires: mysql-connector-c++-commercial = %{version}-%{release} |
| 81 | +Obsoletes: mysql-connector-c++-devel < %{version}-%{release} |
| 82 | +%else |
| 83 | +Requires: mysql-connector-c++ = %{version}-%{release} |
| 84 | +%endif |
| 85 | +%description devel |
| 86 | +This package contains the development header files and libraries necessary |
| 87 | +to develop MySQL client applications in C++. |
| 88 | + |
| 89 | +%if 0%{?with_tests:1} && 0%{?with_gtest:1} |
| 90 | +%package test |
| 91 | +Summary: Regression tests for MySQL Connector/C++ |
| 92 | +%if 0%{?commercial} |
| 93 | +Requires: mysql-connector-c++-commercial = %{version}-%{release} |
| 94 | +Obsoletes: mysql-connector-c++-test < %{version}-%{release} |
| 95 | +%else |
| 96 | +Requires: mysql-connector-c++ = %{version}-%{release} |
| 97 | +%endif |
| 98 | +%description test |
| 99 | +This package contains the test files necessary to run regression |
| 100 | +test suite for MySQL Connector/C++ |
| 101 | +%endif |
| 102 | + |
| 103 | +%prep |
| 104 | +%setup -q -n mysql-connector-c++%{product_suffix}-%{version} |
| 105 | + |
| 106 | +%build |
| 107 | +%if 0%{?rhel} < 8 |
| 108 | +%{?rhel:export CC=gcc} |
| 109 | +%{?rhel:export CXX=g++} |
| 110 | +%endif |
| 111 | + |
| 112 | +%if 0%{?with_tests:1} && 0%{?with_gtest:1} |
| 113 | +%global __cmake_test_opts -DWITH_TESTS=1 -DWITH_GTEST=%{with_gtest} |
| 114 | +%else |
| 115 | +%global __cmake_test_opts %{nil} |
| 116 | +%endif |
| 117 | + |
| 118 | +%global __cmake_explicit_opts -DCMAKE_INSTALL_PREFIX="%_prefix" -DCMAKE_C_FLAGS:STRING="%optflags" -DCMAKE_CXX_FLAGS:STRING="%optflags" |
| 119 | +%global __cmake_common_opts -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}/mysql-cppconn-8 -DWITH_JDBC=OFF -DWITH_SSL=system %{__cmake_test_opts} %{?mysql_opt} -DDEBUG_PREFIX_MAP=OFF |
| 120 | + |
| 121 | +%if 0%{?rhel} |
| 122 | +%global __cmake_cmd cmake3 %{__cmake_common_opts} %{__cmake_explicit_opts} .. |
| 123 | +%else |
| 124 | +%global __cmake_cmd cmake %{__cmake_common_opts} %{__cmake_explicit_opts} .. |
| 125 | +%endif |
| 126 | + |
| 127 | +mkdir build-dynamic && pushd build-dynamic |
| 128 | +pwd |
| 129 | +%__cmake_cmd |
| 130 | +make %{?_smp_mflags} VERBOSE=1 |
| 131 | +popd |
| 132 | + |
| 133 | +mkdir build-static && pushd build-static |
| 134 | +%__cmake_cmd -DBUILD_STATIC=ON |
| 135 | +make %{?_smp_mflags} VERBOSE=1 |
| 136 | +popd |
| 137 | + |
| 138 | +%install |
| 139 | +pushd build-dynamic |
| 140 | +make DESTDIR=%{buildroot} install |
| 141 | + |
| 142 | +%if 0%{?with_tests:1} && 0%{?with_gtest:1} |
| 143 | +# Generating the test groups and run CMake again |
| 144 | +# to process the generated TestGroups.cmake file |
| 145 | +LD_LIBRARY_PATH=. ./run_unit_tests --generate_test_groups=TestGroups.cmake |
| 146 | +%__cmake_cmd |
| 147 | +# Move the test executable and test definition to private libdir |
| 148 | +install -d -m0755 %{buildroot}%{_libdir}/mysql-cppconn-8/dynamic |
| 149 | +mv CTestTestfile.cmake %{buildroot}%{_libdir}/mysql-cppconn-8/dynamic/ |
| 150 | +mv run_unit_tests %{buildroot}%{_libdir}/mysql-cppconn-8/dynamic/ |
| 151 | +%endif |
| 152 | +popd |
| 153 | + |
| 154 | +pushd build-static |
| 155 | +make DESTDIR=%{buildroot} install |
| 156 | + |
| 157 | +%if 0%{?with_tests:1} && 0%{?with_gtest:1} |
| 158 | +# Generating the test groups and run CMake again |
| 159 | +# to process the generated TestGroups.cmake file |
| 160 | +./run_unit_tests --generate_test_groups=TestGroups.cmake |
| 161 | +%__cmake_cmd -DBUILD_STATIC=ON |
| 162 | +# Move the test executable and test definition to private libdir |
| 163 | +install -d -m0755 %{buildroot}%{_libdir}/mysql-cppconn-8/static |
| 164 | +mv CTestTestfile.cmake %{buildroot}%{_libdir}/mysql-cppconn-8/static/ |
| 165 | +mv run_unit_tests %{buildroot}%{_libdir}/mysql-cppconn-8/static/ |
| 166 | +%endif |
| 167 | +popd |
| 168 | + |
| 169 | +# Add compat dir and remove unwanted file |
| 170 | +ln -s mysql-cppconn-8 %{buildroot}%{_includedir}/mysql-cppconn |
| 171 | +rm %{buildroot}/usr/{INFO_SRC,INFO_BIN} |
| 172 | + |
| 173 | +%post -p /sbin/ldconfig |
| 174 | +%postun -p /sbin/ldconfig |
| 175 | + |
| 176 | +%files |
| 177 | +%doc README.txt LICENSE.txt INFO_SRC build-dynamic/INFO_BIN |
| 178 | +%{_libdir}/libmysqlcppconn8.so.* |
| 179 | + |
| 180 | +%files devel |
| 181 | +%doc README.txt LICENSE.txt INFO_SRC build-dynamic/INFO_BIN |
| 182 | +%{_libdir}/libmysqlcppconn8.so |
| 183 | +%{_libdir}/libmysqlcppconn8-static.a |
| 184 | +%{_includedir}/mysql-cppconn |
| 185 | +%dir %{_includedir}/mysql-cppconn-8 |
| 186 | +%{_includedir}/mysql-cppconn-8/mysqlx |
| 187 | +%{_includedir}/mysql-cppconn-8/mysql |
| 188 | + |
| 189 | +%if 0%{?with_tests:1} && 0%{?with_gtest:1} |
| 190 | +%files test |
| 191 | +%dir %{_libdir}/mysql-cppconn-8 |
| 192 | +%dir %{_libdir}/mysql-cppconn-8/dynamic |
| 193 | +%dir %{_libdir}/mysql-cppconn-8/static |
| 194 | +%{_libdir}/mysql-cppconn-8/dynamic/run_unit_tests |
| 195 | +%{_libdir}/mysql-cppconn-8/dynamic/CTestTestfile.cmake |
| 196 | +%{_libdir}/mysql-cppconn-8/static/run_unit_tests |
| 197 | +%{_libdir}/mysql-cppconn-8/static/CTestTestfile.cmake |
| 198 | +%endif |
| 199 | + |
| 200 | +%changelog |
| 201 | +* Fri Feb 15 2019 Bjorn Munch <[email protected]> - 8.0.16-1 |
| 202 | +- CMake 3 should not be used on Fedora, only on Oracle Linux or Red Hat |
| 203 | +- Removed use of cmake_path as it is no longer needed |
| 204 | + |
| 205 | +* Thu Feb 14 2019 Rafal Somla <[email protected]> |
| 206 | +- Use ABI version number taken from version.cmake in %files patterns |
| 207 | + |
| 208 | +* Fri Dec 14 2018 Kent Boortz <[email protected]> - 8.0.15-1 |
| 209 | +- Use CMake 3 on Fedora and Oracle Linux |
| 210 | +- Added option to specify what CMake to use, "--define 'cmake_path <path>'" |
| 211 | + |
| 212 | +* Tue Nov 27 2018 Balasubramanian Kandasamy <[email protected]> - 8.0.14-1 |
| 213 | +- Added INFO_BIN and INFO_SRC files |
| 214 | + |
| 215 | +* Fri Aug 24 2018 Kent Boortz <[email protected]> - 8.0.13-1 |
| 216 | +- Added "test" package |
| 217 | + |
| 218 | +* Wed May 16 2018 Balasubramanian Kandasamy <[email protected]> - 8.0.11-1 |
| 219 | +- Adapt to MySQL Connector C++ 8.0 |
| 220 | + |
| 221 | +* Tue Apr 05 2016 Kent Boortz <[email protected]> - 2.0.1-1 |
| 222 | +- initial package |
0 commit comments