Remove the cmake.patch; fix SPECfile to compile correctly without it

SPECfile tweaks
This commit is contained in:
Michal Schorm 2018-06-29 12:13:15 +02:00
parent aaedab5033
commit 018ad163a2
2 changed files with 21 additions and 59 deletions

View File

@ -1,27 +0,0 @@
The binary 'mariadb_config' produces its output as some concatenation on a prefix, path and suffix.
The upstream tries to use one binary for all distros, but that does not work as it should for Fedora.
Often producing double prefixes and suffixes to some options.
For example:
# --cflags [-I/usr//usr/include/mysql -I/usr//usr/include/mysql/mysql]
--- mariadb-connector-c-3.0.4-src/mariadb_config/mariadb_config.c.in 2018-04-24 12:22:12.000000000 +0200
+++ mariadb-connector-c-3.0.4-src/mariadb_config/mariadb_config.c.in_patched 2018-04-26 13:05:49.737644735 +0200
@@ -5,13 +5,13 @@
static char *mariadb_progname;
-#define INCLUDE "-I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@ -I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@/mysql"
-#define LIBS "-L@CMAKE_INSTALL_PREFIX@/@INSTALL_LIBDIR@/ -lmariadb @extra_dynamic_LDFLAGS@"
+#define INCLUDE "-I@INSTALL_INCLUDEDIR@ -I@INSTALL_INCLUDEDIR@"
+#define LIBS "-L@INSTALL_LIBDIR@/ -lmariadb @extra_dynamic_LDFLAGS@"
#define LIBS_SYS "@extra_dynamic_LDFLAGS@"
#define CFLAGS INCLUDE
#define VERSION "@MARIADB_CLIENT_VERSION@"
#define CC_VERSION "@CPACK_PACKAGE_VERSION@"
-#define PLUGIN_DIR "@CMAKE_INSTALL_PREFIX@/@INSTALL_PLUGINDIR@"
+#define PLUGIN_DIR "@INSTALL_PLUGINDIR@"
#define SOCKET "@MARIADB_UNIX_ADDR@"
#define PORT "@MARIADB_PORT@"
#define TLS_LIBRARY_VERSION "@TLS_LIBRARY_VERSION@"

View File

@ -7,22 +7,10 @@ Source: https://downloads.mariadb.org/interstitial/connector-c-%{version
Url: http://mariadb.org/
# More information: https://mariadb.com/kb/en/mariadb/building-connectorc-from-source/
%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
# RPM does not expand "less" correctly
%else
# mariadb-connector-c is a part of mariadb. *Every* file is meant to conflict.
# From F28 the client library part was removed from mariadb and tis package is required instead.
# On F<28 is the package present from both historical and compatibility reasons.
Conflicts: mariadb-libs mariadb-devel
%endif
BuildRequires: zlib-devel cmake openssl-devel gcc-c++
# Remote-IO plugin
BuildRequires: libcurl-devel
# Patch for mariadb_config
Patch1: cmake.patch
%description
The MariaDB Native Client library (C driver) is used to connect applications
developed in C/C++ to MariaDB and MySQL databases.
@ -31,7 +19,7 @@ developed in C/C++ to MariaDB and MySQL databases.
%package devel
Summary: Development files for mariadb-connector-c
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
# avoid issues with openssl1.0 / openssl1.1 / compat
Requires: pkgconfig(openssl)
@ -42,7 +30,6 @@ Contains everything needed to build against libmariadb.so >=3 client library.
%prep
%setup -q -n mariadb-connector-c-%{version}-src
%patch1 -p1
# Remove unsused parts
rm -r win zlib win-iconv examples
@ -50,11 +37,21 @@ rm -r win zlib win-iconv examples
%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_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX
# so we can't use %%{_datadir} and so forth here.
%cmake . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_SYSTEM_PROCESSOR="%{_arch}" \
\
-DMARIADB_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMARIADB_UNIX_ADDR=%{_sharedstatedir}/mysql/mysql.sock \
-DMARIADB_PORT=3306 \
\
-DWITH_EXTERNAL_ZLIB=YES \
@ -62,26 +59,18 @@ rm -r win zlib win-iconv examples
-DWITH_MYSQLCOMPAT=ON \
\
-DINSTALL_LAYOUT=RPM \
-DINSTALL_BINDIR="%{_bindir}" \
-DINSTALL_LIBDIR="%{_libdir}" \
-DINSTALL_INCLUDEDIR="%{_includedir}/mysql" \
-DINSTALL_PLUGINDIR="%{_libdir}/mariadb/plugin" \
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
-DINSTALL_BINDIR="bin" \
-DINSTALL_LIBDIR="%{_lib}" \
-DINSTALL_INCLUDEDIR="include/mysql" \
-DINSTALL_PLUGINDIR="%{_lib}/mariadb/plugin" \
\
-DWITH_UNITTEST=ON
#cmake -LAH
# Causes build errors:
# -DAUTH_NATIVE=DYNAMIC
# -DCMAKE_INSTALL_PREFIX="/usr"
# 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.
make %{?_smp_mflags}
@ -90,9 +79,7 @@ make %{?_smp_mflags}
make install DESTDIR=%{buildroot}
# Remove static linked libraries and symlinks to them
rm %{buildroot}%{_libdir}/libmariadbclient.a
rm %{buildroot}%{_libdir}/libmysqlclient.a
rm %{buildroot}%{_libdir}/libmysqlclient_r.a
rm %{buildroot}%{_libdir}/lib*.a
# Add a compatibility symlinks
ln -s mariadb_config %{buildroot}%{_bindir}/mysql_config
@ -101,6 +88,8 @@ ln -s mariadb_version.h %{buildroot}%{_includedir}/mysql/mysql_version.h
%check
# Check the generated configuration on the actual machine
%{buildroot}%{_bindir}/mariadb_config
# Run the unit tests
# - don't run mytap tests