From eff48df55248d737c451f65f7372b55032b2626e Mon Sep 17 00:00:00 2001 From: Heng Qi Date: Sat, 15 Apr 2023 13:28:39 +0800 Subject: [PATCH] Refactor the spec file Signed-off-by: Heng Qi --- testsuite.patch => 0001-testsuite.patch | 0 mariadb-connector-c.spec | 135 +++++++++--------------- 2 files changed, 49 insertions(+), 86 deletions(-) rename testsuite.patch => 0001-testsuite.patch (100%) diff --git a/testsuite.patch b/0001-testsuite.patch similarity index 100% rename from testsuite.patch rename to 0001-testsuite.patch diff --git a/mariadb-connector-c.spec b/mariadb-connector-c.spec index 6cf1592..b6d67f9 100644 --- a/mariadb-connector-c.spec +++ b/mariadb-connector-c.spec @@ -1,4 +1,4 @@ -%define anolis_release 4 +%define anolis_release 5 %bcond_with debug %bcond_without testsuite @@ -6,48 +6,40 @@ %global __cmake_in_source_build 1 Name: mariadb-connector-c +Summary: The MariaDB Native Client library (C driver) Version: 3.2.7 Release: %{anolis_release}%{?dist} -Summary: The MariaDB Native Client library (C driver) License: LGPLv2+ +Url: http://mariadb.org/ Source: https://downloads.mariadb.org/interstitial/connector-c-%{version}/%{name}-%{version}-src.tar.gz Source2: my.cnf Source3: client.cnf -Url: http://mariadb.org/ %if %{with testsuite} -Patch1: testsuite.patch +Patch0001: 0001-testsuite.patch %endif +BuildRequires: libcurl-devel krb5-devel openssl-devel zlib-devel +BuildRequires: gcc-c++ cmake Requires: %{_sysconfdir}/my.cnf -BuildRequires: gcc-c++ cmake openssl-devel zlib-devel -# Remote-IO plugin -BuildRequires: libcurl-devel -# auth_gssapi_client plugin -BuildRequires: krb5-devel %description -The MariaDB Native Client library (C driver) is used to connect applications -developed in C/C++ to MariaDB and MySQL databases. +MariaDB Connector/C is a C client library for MariaDB and MySQL databases. +It allows applications written in C/C++ to access MariaDB and MySQL databases using +the standard SQL language. The library provides a simple and efficient API for +connecting to and interacting with the database server. It is open source software +and is released under the LGPLv2.1 license. MariaDB Connector/C is compatible with +both MariaDB and MySQL databases, and it supports all major operating systems. %package devel -Summary: Development files for mariadb-connector-c -Requires: %{name} = %{version}-%{release} -Recommends: %{name}-doc = %{version}-%{release} +Summary: Development files for %{name} +Requires: %{name} = %{EVR} +Recommends: %{name}-doc = %{EVR} Requires: openssl-devel zlib-devel Conflicts: mysql-devel %description devel -Development files for mariadb-connector-c. -Contains everything needed to build against libmariadb.so >=3 client library. - -%package doc -Summary: Manual pages documenting API of the libmariadb.so library -Requires: %{name} = %{version}-%{release} -BuildArch: noarch - -%description doc -Manual pages documenting API of the libmariadb.so library. +Development files for %{name}, containing everything needed to build against libmariadb.so >=3 client library. %if %{with testsuite} %package test @@ -57,8 +49,7 @@ Requires: cmake Recommends: mariadb-server %description test -Testsuite files for mariadb-connector-c. -Contains binaries and a prepared CMake ctest file. +Testsuite files for mariadb-connector-c. Contains binaries and a prepared CMake ctest file. Requires running MariaDB / MySQL server with create database "test". %endif @@ -73,49 +64,35 @@ from the /etc/my.cnf.d directory and ships this directory as well. Other packages should only put their files into /etc/my.cnf.d directory and require this package, so the /etc/my.cnf file is present. +%package doc +Summary: Manual pages documenting API of the libmariadb.so library +Requires: %{name} = %{EVR} +BuildArch: noarch + +%description doc +Manual pages documenting API of the libmariadb.so library for %{name}. + %prep -%setup -q -n %{name}-%{version}-src +%setup -n %{name}-%{version}-src -q %if %{with testsuite} %patch1 -p1 %endif -# Remove unsused parts rm -r win win-iconv zlib %build -# https://jira.mariadb.org/browse/MDEV-13836: -# The server has (used to have for ages) some magic around the port number. -# If it's 0, the default port value will use getservbyname("mysql", "tcp"), that is, whatever is written in /etc/services. -# If it's a positive number, say, 3306, it will be 3306, no matter what /etc/services say. -# I don't know if that behavior makes much sense, /etc/services wasn't supposed to be a system configuration file. - -# The INSTALL_* macros have to be specified relative to CMAKE_INSTALL_PREFIX -# so we can't use %%{_datadir} and so forth here. - -%cmake . \ - -DCMAKE_BUILD_TYPE="%{?with_debug:Debug}%{!?with_debug:RelWithDebInfo}" \ - -DCMAKE_SYSTEM_PROCESSOR="%{_arch}" \ -\ - -DMARIADB_UNIX_ADDR=%{_sharedstatedir}/mysql/mysql.sock \ - -DMARIADB_PORT=3306 \ -\ - -DWITH_EXTERNAL_ZLIB=ON \ - -DWITH_SSL=OPENSSL \ - -DWITH_MYSQLCOMPAT=ON \ - -DPLUGIN_CLIENT_ED25519=DYNAMIC \ -\ - -DINSTALL_LAYOUT=RPM \ - -DINSTALL_BINDIR="bin" \ - -DINSTALL_LIBDIR="%{_lib}" \ - -DINSTALL_INCLUDEDIR="include/mysql" \ - -DINSTALL_PLUGINDIR="%{_lib}/mariadb/plugin" \ +%cmake . -DCMAKE_BUILD_TYPE="%{?with_debug:Debug}%{!?with_debug:RelWithDebInfo}" \ + -DCMAKE_SYSTEM_PROCESSOR="%{_arch}" -DMARIADB_UNIX_ADDR=%{_sharedstatedir}/mysql/mysql.sock \ + -DMARIADB_PORT=3306 -DWITH_EXTERNAL_ZLIB=ON -DWITH_SSL=OPENSSL \ + -DWITH_MYSQLCOMPAT=ON -DPLUGIN_CLIENT_ED25519=DYNAMIC \ + -DINSTALL_LAYOUT=RPM -DINSTALL_BINDIR="bin" -DINSTALL_LIBDIR="%{_lib}" \ + -DINSTALL_INCLUDEDIR="include/mysql" -DINSTALL_PLUGINDIR="%{_lib}/mariadb/plugin" \ -DINSTALL_PCDIR="%{_lib}/pkgconfig" \ \ %if %{with testsuite} -DWITH_UNIT_TESTS=ON %endif -# Override all optimization flags when making a debug build %if %{with debug} CFLAGS="$CFLAGS -O0 -g"; export CFLAGS CXXFLAGS="$CXXFLAGS -O0 -g"; export CXXFLAGS @@ -127,88 +104,74 @@ cmake -B %__cmake_builddir -LAH %cmake_build - %install %cmake_install - -# Remove static linked libraries and symlinks to them rm %{buildroot}%{_libdir}/lib*.a - -# Add a compatibility symlinks ln -s mariadb_config %{buildroot}%{_bindir}/mysql_config ln -s mariadb_version.h %{buildroot}%{_includedir}/mysql/mysql_version.h - -# Install config files -install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/my.cnf -install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/my.cnf.d/client.cnf +install -D -pm0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/my.cnf +install -D -pm0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/my.cnf.d/client.cnf %generate_compatibility_deps %check -# Check the generated configuration on the actual machine %{buildroot}%{_bindir}/mariadb_config -# Run the unit tests -# - don't run mytap tests -# - ignore the testsuite result for now. Enable tests now, fix them later. -# Note: there must be a database called 'test' created for the testcases to be run %if %{with testsuite} pushd unittest/libmariadb/ %ctest || : popd %endif - %files %dir %{abidir} -%doc README %license COPYING.LIB %{_libdir}/libmariadb.so.3 %dir %{_libdir}/mariadb %dir %{_libdir}/mariadb/plugin %{_libdir}/mariadb/plugin/* +%{abidir}/mariadb_config-option.list +%{abidir}/sha256_password.dump %{abidir}/auth_gssapi_client.dump -%{abidir}/caching_sha2_password.dump %{abidir}/client_ed25519.dump %{abidir}/dialog.dump %{abidir}/libcctap.dump %{abidir}/libmariadb.dump -%{abidir}/mariadb_config-option.list %{abidir}/mysql_clear_password.dump %{abidir}/remote_io.dump -%{abidir}/sha256_password.dump - -%files doc -# Library manual pages +%{abidir}/caching_sha2_password.dump %{_mandir}/man3/{mariadb,mysql}_*.3* + %files devel -# Binary which provides compiler info for software compiling against this library -%{_bindir}/mariadb_config %{_bindir}/mysql_config -# Symlinks to the versioned library -%{_libdir}/libmariadb.so +%{_bindir}/mariadb_config +%{_libdir}/pkgconfig/libmariadb.pc %{_libdir}/libmysqlclient.so %{_libdir}/libmysqlclient_r.so -# Pkgconfig -%{_libdir}/pkgconfig/libmariadb.pc -# Header files +%{_libdir}/libmariadb.so %dir %{_includedir}/mysql %{_includedir}/mysql/* %files config %dir %{_sysconfdir}/my.cnf.d -%config(noreplace) %{_sysconfdir}/my.cnf %config(noreplace) %{_sysconfdir}/my.cnf.d/client.cnf +%config(noreplace) %{_sysconfdir}/my.cnf %if %{with testsuite} %files test +%{_libdir}/libcctap.so %dir %{_datadir}/%{name} %{_datadir}/%{name}/* -%{_libdir}/libcctap.so %endif +%files doc +%doc README + %changelog +* Sat Apr 15 2023 Heng Qi -3.2.7-5 +- Refator the spec file + * Mon Apr 03 2023 mgb01105731 - 3.2.7-4 - Del Specific Fields -- Gitee