Skip to content

Commit 94322a5

Browse files
committed
WL#16462: Add definitions for RPM -compat package
1 parent 17029c0 commit 94322a5

File tree

2 files changed

+107
-4
lines changed

2 files changed

+107
-4
lines changed

packaging/compat.patch

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 8b960402..37fac11d 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -326,12 +326,6 @@ add_subdirectory(testing)
6+
# CDK
7+
#
8+
9+
-add_subdirectory(cdk)
10+
-
11+
-foreach(T cdk cdk_foundation cdk_mysqlx cdk_proto_mysqlx cdk_parser)
12+
- set_target_properties(${T} PROPERTIES FOLDER "CDK")
13+
-endforeach()
14+
-
15+
#
16+
# Project's public headers
17+
#
18+
@@ -344,7 +338,7 @@ INCLUDE_DIRECTORIES(include)
19+
# Note: it is included before setting higher warning levels.
20+
#
21+
22+
-add_config_option(WITH_JDBC BOOL DEFAULT OFF
23+
+add_config_option(WITH_JDBC BOOL DEFAULT ON
24+
"Whether to build a variant of connector library which implements legacy JDBC API"
25+
)
26+
27+
@@ -363,6 +357,7 @@ if(WITH_JDBC)
28+
29+
endif()
30+
31+
+return()
32+
33+
#
34+
# Set higher warning level for the main connector code.
35+
diff --git a/version.cmake b/version.cmake
36+
index 53f8f540..4d32f5ee 100644
37+
--- a/version.cmake
38+
+++ b/version.cmake
39+
@@ -34,8 +34,8 @@ set(COPYRIGHT_YEAR "2024" CACHE INTERNAL "version info")
40+
# Connector/C++ version
41+
#
42+
43+
-set(CONCPP_VERSION_MAJOR 8 CACHE INTERNAL "version info")
44+
-set(CONCPP_VERSION_MINOR 4 CACHE INTERNAL "version info")
45+
+set(CONCPP_VERSION_MAJOR 9 CACHE INTERNAL "version info")
46+
+set(CONCPP_VERSION_MINOR 1 CACHE INTERNAL "version info")
47+
set(CONCPP_VERSION_MICRO 0 CACHE INTERNAL "version info")
48+
# Level is "-alpha", "-beta", empty if GA
49+
set(CONCPP_VERSION_LEVEL "" CACHE INTERNAL "version info")

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

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
# along with this program; if not, write to the Free Software Foundation, Inc.,
2727
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2828

29+
###############################################
2930
# Arguments that can be given to rpmbuild:
3031
#
3132
# mysql_dir Path to the MySQL installation, where to find the client lib
3233
# commercial If set, is a commercial build
33-
34+
# with_compat If set the -compat package is built
35+
###############################################
3436

3537
%{?mysql_dir: %global mysql_opt -DMYSQL_DIR=%{mysql_dir}}
3638
%{!?commercial: %global license_type GPLv2}
@@ -82,11 +84,16 @@ Version: @CONCPP_VERSION@
8284
Release: 1%{?commercial:.1}%{?dist}
8385
License: %{license_type}
8486
URL: https://dev.mysql.com/doc/connector-cpp/en/
85-
Source0: https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++%{?product_suffix}-%{version}-src.tar.gz
8687
# Note: This connector is compatible with the 8.x series.
87-
Provides: libmysqlcppconn8.so.2()(%{?__isa_bits}bit) = %{version}-%{release}
88+
Provides: libmysqlcppconn8.so.2()(%{?__isa_bits}bit) = %{version}-%{release}
8889
Obsoletes: mysql-connector-c++%{?product_suffix} < %{version}-%{release}
8990
Obsoletes: mysql-connector-c++ < %{version}-%{release}
91+
92+
Source0: https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++%{?product_suffix}-%{version}-src.tar.gz
93+
%if 0%{?with_compat}
94+
Source1: https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++%{?product_suffix}-8.4.0-src.tar.gz
95+
%endif
96+
9097
BuildRequires: %{cmake_cmd} >= 3.15.0
9198
%if 0%{?fedora} || 0%{?suse_version}
9299
BuildRequires: gcc
@@ -113,6 +120,20 @@ Obsoletes: mysql-connector-c++-jdbc < %{version}-%{release}
113120
%description jdbc
114121
This MySQL Driver for C++ mimics the JDBC 4.0 API.
115122

123+
124+
%if 0%{?with_compat}
125+
%package compat
126+
Summary: MySQL Connector/C++ -- backward compatibility libraries
127+
Provides: libmysqlcppconn9 = %{version}-%{release}
128+
Obsoletes: libmysqlcppconn9 < %{version}-%{release}
129+
Obsoletes: mysql-connector-c++%{?product_suffix}-compat < %{version}-%{release}
130+
Obsoletes: mysql-connector-c++-compat < %{version}-%{release}
131+
Obsoletes: mysql-connector-c++%{?product_suffix}-jdbc < 9.0.0
132+
Obsoletes: mysql-connector-c++-jdbc < 9.0.0
133+
%description compat
134+
MySQL Connector/C++ -- backward compatibility libraries
135+
%endif
136+
116137
%package devel
117138
Summary: Development header files and libraries for MySQL C++ client applications
118139
Requires: mysql-connector-c++%{?product_suffix} = %{version}-%{release}
@@ -129,12 +150,26 @@ to develop MySQL client applications in C++.
129150
###############################################
130151

131152
%prep
132-
%setup -q -n %{name}-%{version}-src
153+
%setup -q %{?with_compat:-b1} -n %{name}-%{version}-src
154+
155+
SRC=`pwd`
156+
SRC1=%{name}-8.4.0-src
157+
158+
cd ${RPM_BUILD_DIR}
159+
160+
%if 0%{?with_compat}
161+
162+
# Patch compatiblity sources:
163+
git apply --directory ${SRC1} ${SRC}/packaging/compat.patch
164+
165+
%endif
133166

134167

135168
%build
136169

137170
SRC=`pwd`
171+
SRC1=%{name}-8.4.0-src
172+
138173
cd ${RPM_BUILD_DIR}
139174

140175
%global plugin_dir %{_libdir}/mysql/%{lib_base_name_jdbc}/plugin
@@ -153,6 +188,12 @@ cd ${RPM_BUILD_DIR}
153188
%global __cmake_common_opts -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_LIBDIR=.%{_libdir} -DCMAKE_INSTALL_INCLUDEDIR=.%{_includedir}/mysql-cppconn -DWITH_SSL=system -DDEFAULT_PLUGIN_DIR=%{plugin_dir} -DWITH_JDBC=1 -DMYSQLCLIENT_STATIC_LINKING=1 -DBUNDLE_DEPENDENCIES=1 %{?mysql_opt} %{__cmake_test_opts} -DDEBUG_PREFIX_MAP=OFF
154189
%global __cmake_config %{cmake_cmd} %{__cmake_common_opts} %{__cmake_explicit_opts}
155190

191+
%if 0%{?with_compat}
192+
rm -rf build-compat && mkdir build-compat
193+
%{__cmake_config} -S ${SRC1} -B build-compat
194+
%{cmake_cmd} --build build-compat --verbose
195+
%endif
196+
156197
rm -rf build-static && mkdir build-static
157198
%{__cmake_config} -S ${SRC} -B build-static -DBUILD_STATIC=1
158199
%{cmake_cmd} --build build-static --verbose
@@ -168,6 +209,9 @@ cd ${RPM_BUILD_DIR}
168209

169210
# Note: order of installations is important!
170211

212+
%if 0%{?with_compat}
213+
%{cmake_cmd} --install build-compat --prefix %{buildroot}
214+
%endif
171215
%{cmake_cmd} --install build-static --prefix %{buildroot}
172216
%{cmake_cmd} --install build-dynamic --prefix %{buildroot}
173217

@@ -217,6 +261,13 @@ rm -rf %{buildroot}%{_libdir}/{plugin,private}
217261
%{_libdir}/libmysqlcppconn.so.@JDBC_ABI_VERSION_MAJOR@*
218262
%{plugin_dir}
219263

264+
%if 0%{?with_compat}
265+
%files compat
266+
%doc LICENSE.txt
267+
%doc README.txt
268+
%{_libdir}/libmysqlcppconn.so.9*
269+
%endif
270+
220271
%files devel
221272
%doc LICENSE.txt
222273
%doc README.txt ../build-dynamic/INFO_SRC ../build-dynamic/INFO_BIN
@@ -236,6 +287,9 @@ rm -rf %{buildroot}%{_libdir}/{plugin,private}
236287

237288
%changelog
238289

290+
* Thu Sep 12 2024 Rafal Somla <[email protected]> - 9.1.0-1
291+
- Add definitions for -compat package (WL#16462)
292+
239293
* Fri Aug 09 2024 Rafal Somla <[email protected]> - 9.1.0-1
240294
- Bundle authentication plugins in the -jdbc package (WL#16458)
241295

0 commit comments

Comments
 (0)