- Revert the CMake change regarding the in-source builds for now

- %%cmake macro covers the %%{set_build_flags}, so they are not needed
  That also means, the debug buildchnages to the build flags must be done AFTER the
  %%cmake macro was used.
- %%cmake macro also covers the CMAKE_INSTALL_PREFIX="%%{_prefix}" option
- Default to %%cmake commands instead fo %%make commands
- Update the WITH_UNITTEST macro to the one upstream use now
- Introduce macro to enable / disable testusite (and building of the *-test subpackage)
This commit is contained in:
Michal Schorm 2020-08-05 12:27:17 +02:00
parent ccd1d1c064
commit b59d80d8fe

View File

@ -1,9 +1,26 @@
# For deep debugging we need to build binaries with extra debug info
%bcond_with debug
# Enable building and packing of the testsuite
%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
# Specifically, be aware that all subsequent call of CMake *MUST* be called with the specified builddir
# e.g. " cmake -B %%{__cmake_builddir} -LAH "
# Otherwise you will experience *really odd* behaviour. HOWEVER the "%%{__cmake_builddir}" is not suitable for use,
# read this mail discussion for details:
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/WJUNUJ7BJQYXQTONR5AGOKD3ZNKLSDDC/
Name: mariadb-connector-c
Version: 3.1.9
Release: 4%{?with_debug:.debug}%{?dist}
Release: 5%{?with_debug:.debug}%{?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
@ -12,10 +29,12 @@ Source3: client.cnf
Url: http://mariadb.org/
# More information: https://mariadb.com/kb/en/mariadb/building-connectorc-from-source/
%if %{with testsuite}
Patch1: testsuite.patch
%endif
Requires: %{_sysconfdir}/my.cnf
BuildRequires: zlib-devel cmake openssl-devel gcc-c++
BuildRequires: gcc-c++ cmake openssl-devel zlib-devel
# Remote-IO plugin
BuildRequires: libcurl-devel
# auth_gssapi_client plugin
@ -40,6 +59,7 @@ Contains everything needed to build against libmariadb.so >=3 client library.
%if %{with testsuite}
%package test
Summary: Testsuite files for mariadb-connector-c
Requires: %{name} = %{version}-%{release}
@ -50,7 +70,7 @@ Recommends: mariadb-server
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
@ -68,21 +88,16 @@ 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 zlib win-iconv examples
rm -r win win-iconv zlib examples
%build
%{set_build_flags}
# Override all optimization flags when making a debug build
%{?with_debug: CFLAGS="$CFLAGS -O0 -g"}
CXXFLAGS="$CFLAGS"
export CFLAGS CXXFLAGS
# 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.
@ -99,29 +114,38 @@ export CFLAGS CXXFLAGS
-DMARIADB_UNIX_ADDR=%{_sharedstatedir}/mysql/mysql.sock \
-DMARIADB_PORT=3306 \
\
-DWITH_EXTERNAL_ZLIB=YES \
-DWITH_EXTERNAL_ZLIB=ON \
-DWITH_SSL=OPENSSL \
-DWITH_MYSQLCOMPAT=ON \
-DPLUGIN_CLIENT_ED25519=DYNAMIC \
\
-DINSTALL_LAYOUT=RPM \
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
-DINSTALL_BINDIR="bin" \
-DINSTALL_LIBDIR="%{_lib}" \
-DINSTALL_INCLUDEDIR="include/mysql" \
-DINSTALL_PLUGINDIR="%{_lib}/mariadb/plugin" \
-DINSTALL_PCDIR="%{_lib}/pkgconfig" \
\
-DWITH_UNITTEST=ON
%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 ./ -LAH
%make_build
%cmake_build
%install
%make_install
%cmake_install
%multilib_fix_c_header --file %{_includedir}/mysql/mariadb_version.h
@ -146,10 +170,11 @@ install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/my.cnf.d/client.cnf
# - 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 || :
%ctest || :
popd
%endif
%files
@ -190,11 +215,12 @@ popd
%if %{with testsuite}
%files test
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_libdir}/libcctap.so
%endif
# Opened issues on the upstream tracker:
@ -213,6 +239,16 @@ popd
# Need to ensure, that the testsuite will also run properly on 'fedpkg local' buid, not damaging the host machine
%changelog
* Tue Aug 04 2020 Michal Schorm <mschorm@redhat.com> - 3.1.9-5
- Revert the CMake change regarding the in-source builds for now
- %%cmake macro covers the %%{set_build_flags}, so they are not needed
That also means, the debug buildchnages to the build flags must be done AFTER the
%%cmake macro was used.
- %%cmake macro also covers the CMAKE_INSTALL_PREFIX="%%{_prefix}" option
- Default to %%cmake commands instead fo %%make commands
- Update the WITH_UNITTEST macro to the one upstream use now
- Introduce macro to enable / disable testusite (and building of the *-test subpackage)
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.9-4
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild