From 26b91bc6995f82ee4a4fe4ba5ffe7c206d226446 Mon Sep 17 00:00:00 2001 From: Michal Schorm Date: Thu, 13 Aug 2020 01:23:52 +0200 Subject: [PATCH] Do a proper out-of-source CMake builds Force the CMake change regarding the in-source builds also to F31 and F32 Use CMake macros instead of cmake & make direct commands %%cmake macro covers the %%{set_build_flags}, so they are not needed --- community-mysql.spec | 67 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/community-mysql.spec b/community-mysql.spec index 5d29f95..4c4f6aa 100644 --- a/community-mysql.spec +++ b/community-mysql.spec @@ -1,3 +1,7 @@ +# This is a fix for the https://fedoraproject.org/wiki/Changes/CMake_to_do_out-of-source_builds +# So the beaviour will be the same also in F31 nad F32 +%undefine __cmake_in_source_build + # Name of the package without any prefixes %global pkg_name %{name} %global pkgnamepatch community-mysql @@ -69,7 +73,7 @@ Name: community-mysql Version: 8.0.21 -Release: 5%{?with_debug:.debug}%{?dist} +Release: 6%{?with_debug:.debug}%{?dist} Summary: MySQL client programs and shared libraries URL: http://www.mysql.com @@ -444,8 +448,7 @@ add_test gis.spatial_operators_union %endif - - +# mysql-test popd cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ @@ -456,7 +459,6 @@ cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ # but fails miserably. Just disable for the whole package # until the package internals are fixed %define _lto_cflags %{nil} -%{set_build_flags} # fail quickly and obviously if user tries to build as root %if %runselftest @@ -468,12 +470,9 @@ cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ fi %endif -# build out of source -mkdir -p build && pushd build - # The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX # so we can't use %%{_datadir} and so forth here. -cmake .. \ +%cmake \ -DBUILD_CONFIG=mysql_release \ -DFEATURE_SET="community" \ -DINSTALL_LAYOUT=RPM \ @@ -513,7 +512,7 @@ cmake .. \ %endif -DWITH_ROUTER=OFF \ -DWITH_SYSTEM_LIBS=ON \ - -DWITH_BOOST=../boost \ + -DWITH_BOOST=boost \ -DREPRODUCIBLE_BUILD=OFF \ -DCMAKE_C_FLAGS="%{optflags}%{?with_debug: -fno-strict-overflow -Wno-unused-result -Wno-unused-function -Wno-unused-but-set-variable}" \ -DCMAKE_CXX_FLAGS="%{optflags}%{?with_debug: -fno-strict-overflow -Wno-unused-result -Wno-unused-function -Wno-unused-but-set-variable}" \ @@ -527,27 +526,24 @@ cmake .. \ # Note: linking with GOLD disabled on Armv7hl because of https://bugs.mysql.com/bug.php?id=96698 -cmake .. -LAH +cmake -B %{_vpath_builddir} -LAH -make %{?_smp_mflags} VERBOSE=1 - -popd +%cmake_build %install -pushd build -make DESTDIR=%{buildroot} install +%cmake_install # multilib support for shell scripts # we only apply this to known Red Hat multilib arches, per bug #181335 if %multilib_capable; then mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits} -install -p -m 0755 scripts/mysql_config_multilib %{buildroot}%{_bindir}/mysql_config +install -p -m 0755 %{_vpath_builddir}/scripts/mysql_config_multilib %{buildroot}%{_bindir}/mysql_config fi # install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files, # but that's pretty wacko --- see also %%{name}-file-contents.patch) -install -p -m 0644 Docs/INFO_SRC %{buildroot}%{_libdir}/mysql/ -install -p -m 0644 Docs/INFO_BIN %{buildroot}%{_libdir}/mysql/ +install -p -m 0644 %{_vpath_builddir}/Docs/INFO_SRC %{buildroot}%{_libdir}/mysql/ +install -p -m 0644 %{_vpath_builddir}/Docs/INFO_BIN %{buildroot}%{_libdir}/mysql/ mkdir -p %{buildroot}%{logfiledir} @@ -557,21 +553,21 @@ install -p -m 0750 -d %{buildroot}%{_localstatedir}/lib/mysql-files install -p -m 0700 -d %{buildroot}%{_localstatedir}/lib/mysql-keyring %if %{with config} -install -D -p -m 0644 scripts/my.cnf %{buildroot}%{_sysconfdir}/my.cnf +install -D -p -m 0644 %{_vpath_builddir}/scripts/my.cnf %{buildroot}%{_sysconfdir}/my.cnf %endif # install systemd unit files and scripts for handling server startup -install -D -p -m 644 scripts/mysql.service %{buildroot}%{_unitdir}/%{daemon_name}.service -install -D -p -m 644 scripts/mysql@.service %{buildroot}%{_unitdir}/%{daemon_name}@.service -install -D -p -m 0644 scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{daemon_name}.conf +install -D -p -m 644 %{_vpath_builddir}/scripts/mysql.service %{buildroot}%{_unitdir}/%{daemon_name}.service +install -D -p -m 644 %{_vpath_builddir}/scripts/mysql@.service %{buildroot}%{_unitdir}/%{daemon_name}@.service +install -D -p -m 0644 %{_vpath_builddir}/scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{daemon_name}.conf rm -r %{buildroot}%{_tmpfilesdir}/mysql.conf # helper scripts for service starting -install -D -p -m 755 scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir -install -p -m 755 scripts/mysql-wait-stop %{buildroot}%{_libexecdir}/mysql-wait-stop -install -p -m 755 scripts/mysql-check-socket %{buildroot}%{_libexecdir}/mysql-check-socket -install -p -m 644 scripts/mysql-scripts-common %{buildroot}%{_libexecdir}/mysql-scripts-common -install -D -p -m 0644 scripts/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf +install -D -p -m 755 %{_vpath_builddir}/scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir +install -p -m 755 %{_vpath_builddir}/scripts/mysql-wait-stop %{buildroot}%{_libexecdir}/mysql-wait-stop +install -p -m 755 %{_vpath_builddir}/scripts/mysql-check-socket %{buildroot}%{_libexecdir}/mysql-check-socket +install -p -m 644 %{_vpath_builddir}/scripts/mysql-scripts-common %{buildroot}%{_libexecdir}/mysql-scripts-common +install -D -p -m 0644 %{_vpath_builddir}/scripts/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf rm %{buildroot}%{_libdir}/mysql/*.a rm %{buildroot}%{_datadir}/%{pkg_name}/mysql.server @@ -596,15 +592,12 @@ ln -s %{_libexecdir}/mysqld %{buildroot}%{_sbindir}/mysqld mv %{buildroot}%{_bindir}/mysqld-debug %{buildroot}%{_libexecdir}/mysqld %endif -# Back to src dir -popd - # copy additional docs into build tree so %%doc will find them -install -p -m 0644 %{SOURCE6} %{basename:%{SOURCE6}} -install -p -m 0644 %{SOURCE7} %{basename:%{SOURCE7}} +install -p -m 0644 %{SOURCE6} %{_vpath_srcdir}/%{basename:%{SOURCE6}} +install -p -m 0644 %{SOURCE7} %{_vpath_srcdir}/%{basename:%{SOURCE7}} # Install the list of skipped tests to be available for user runs -install -p -m 0644 mysql-test/%{skiplist} %{buildroot}%{_datadir}/mysql-test +install -p -m 0644 %{_vpath_srcdir}/mysql-test/%{skiplist} %{buildroot}%{_datadir}/mysql-test %if %{without clibrary} unlink %{buildroot}%{_libdir}/mysql/libmysqlclient.so @@ -656,7 +649,7 @@ rm %{buildroot}%{_mandir}/man1/mysql_client_test.1* %check %if %{with test} %if %runselftest -pushd build +pushd %_vpath_builddir make test VERBOSE=1 pushd mysql-test cp ../../mysql-test/%{skiplist} . @@ -869,6 +862,12 @@ fi %endif %changelog +* Thu Aug 13 2020 Michal Schorm - 8.0.21-6 +- Do a proper out-of-source CMake builds +- Force the CMake change regarding the in-source builds also to F31 and F32 +- Use CMake macros instead of cmake & make direct commands +- %%cmake macro covers the %%{set_build_flags}, so they are not needed + * Wed Aug 12 2020 Honza Horak - 8.0.21-5 - Check that we have correct versions in bundled(*) Provides - Remove re2 dependency that is not needed any more