diff --git a/client.cnf b/client.cnf new file mode 100644 index 0000000000000000000000000000000000000000..9028505a98a0cab690ab55f72cca2b138ed036f5 --- /dev/null +++ b/client.cnf @@ -0,0 +1,13 @@ +# +# These two groups are read by the client library +# Use it for options that affect all clients, but not the server +# + + +[client] + +# This group is not read by mysql client library, +# If you use the same .cnf file for MySQL and MariaDB, +# use it for MariaDB-only client options +[client-mariadb] + diff --git a/mariadb-connector-c-3.2.7-src.tar.gz b/mariadb-connector-c-3.2.7-src.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..e496ffdde74a88aa7102973675582be06eeffffd Binary files /dev/null and b/mariadb-connector-c-3.2.7-src.tar.gz differ diff --git a/mariadb-connector-c.spec b/mariadb-connector-c.spec new file mode 100644 index 0000000000000000000000000000000000000000..89fd06abb00018cff4d5144b9bf63815596b31b7 --- /dev/null +++ b/mariadb-connector-c.spec @@ -0,0 +1,210 @@ +%define anolis_release 1 + +%bcond_with debug +%bcond_without testsuite + +# Enable CMake in-source builds +# This is is a workaround for the https://fedoraproject.org/wiki/Changes/CMake_to_do_out-of-source_builds +# which reverts the CMake behaviour to before F33 +# The Change owners offered themselves to help fix the affected packages via ProvenPackager rights. +# I'm generally in favor of this change, however when I tried to adapt it, I encountered a number of issues. +# That's why I disabled it for now. +%global __cmake_in_source_build 1 + +Name: mariadb-connector-c +Version: 3.2.7 +Release: %{anolis_release}%{?dist} +Summary: The MariaDB Native Client library (C driver) +License: LGPLv2+ +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 +%endif + +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. + +%package devel +Summary: Development files for mariadb-connector-c +Requires: %{name} = %{version}-%{release} +Recommends: %{name}-doc = %{version}-%{release} +Requires: openssl-devel zlib-devel +BuildRequires: multilib-rpm-config +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. + +%if %{with testsuite} +%package test +Summary: Testsuite files for mariadb-connector-c +Requires: %{name} = %{version}-%{release} +Requires: cmake +Recommends: mariadb-server + +%description test +Testsuite files for mariadb-connector-c. +Contains binaries and a prepared CMake ctest file. +Requires running MariaDB / MySQL server with create database "test". +%endif + +%package config +Summary: Configuration files for packages that use /etc/my.cnf as a configuration file +BuildArch: noarch +Obsoletes: mariadb-config <= 3:10.3.8-4 + +%description config +This package delivers /etc/my.cnf that includes other configuration files +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. + +%prep +%setup -q -n %{name}-%{version}-src +%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" \ + -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 +FFLAGS="$FFLAGS -O0 -g"; export FFLAGS +FCFLAGS="$FCFLAGS -O0 -g"; export FCFLAGS +%endif + +cmake -B %__cmake_builddir -LAH + +%cmake_build + + +%install +%cmake_install + +%multilib_fix_c_header --file %{_includedir}/mysql/mariadb_version.h + +# 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 + + +%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 +%doc README +%license COPYING.LIB +%{_libdir}/libmariadb.so.3 +%dir %{_libdir}/mariadb +%dir %{_libdir}/mariadb/plugin +%{_libdir}/mariadb/plugin/* + +%files doc +# Library manual pages +%{_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 +%{_libdir}/libmysqlclient.so +%{_libdir}/libmysqlclient_r.so +# Pkgconfig +%{_libdir}/pkgconfig/libmariadb.pc +# Header files +%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 + +%if %{with testsuite} +%files test +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/* +%{_libdir}/libcctap.so +%endif + +%changelog +* Thu Jun 30 2022 happy_orange - 3.2.7-1 +- Init package from upstream release diff --git a/my.cnf b/my.cnf new file mode 100644 index 0000000000000000000000000000000000000000..913b88f8328d0cc3b3134b40ff309bdbf0f67527 --- /dev/null +++ b/my.cnf @@ -0,0 +1,11 @@ +# +# This group is read both both by the client and the server +# use it for options that affect everything +# +[client-server] + +# +# include all files from the config directory +# +!includedir /etc/my.cnf.d + diff --git a/testsuite.patch b/testsuite.patch new file mode 100644 index 0000000000000000000000000000000000000000..6a2d2d3941c415bd265a471f891154ee6c6228b0 --- /dev/null +++ b/testsuite.patch @@ -0,0 +1,10 @@ +--- mariadb-connector-c-3.1.3-src/unittest/libmariadb/CMakeLists.txt 2019-07-25 10:03:48.000000000 -0400 ++++ mariadb-connector-c-3.1.3-src/unittest/libmariadb/CMakeLists.txt_patched 2019-08-19 17:02:26.317247605 -0400 +@@ -71,3 +71,7 @@ FOREACH(API_TEST ${MANUAL_TESTS}) + ADD_EXECUTABLE(${API_TEST} ${API_TEST}.c) + TARGET_LINK_LIBRARIES(${API_TEST} cctap ma_getopt mariadbclient) + ENDFOREACH() ++ ++INSTALL(TARGETS ${API_TESTS} DESTINATION ${SHAREDIR}/mariadb-connector-c/tests COMPONENT Tests) ++INSTALL(FILES ${CC_SOURCE_DIR}/unittest/mytap/libcctap.so PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION ${INSTALL_LIBDIR} COMPONENT Tests) ++INSTALL(FILES ${CC_SOURCE_DIR}/unittest/libmariadb/CTestTestfile.cmake DESTINATION ${SHAREDIR}/mariadb-connector-c/tests COMPONENT Tests)