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
This commit is contained in:
Michal Schorm 2020-08-13 01:23:52 +02:00
parent 99822cc68f
commit 26b91bc699

View File

@ -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 # Name of the package without any prefixes
%global pkg_name %{name} %global pkg_name %{name}
%global pkgnamepatch community-mysql %global pkgnamepatch community-mysql
@ -69,7 +73,7 @@
Name: community-mysql Name: community-mysql
Version: 8.0.21 Version: 8.0.21
Release: 5%{?with_debug:.debug}%{?dist} Release: 6%{?with_debug:.debug}%{?dist}
Summary: MySQL client programs and shared libraries Summary: MySQL client programs and shared libraries
URL: http://www.mysql.com URL: http://www.mysql.com
@ -444,8 +448,7 @@ add_test gis.spatial_operators_union
%endif %endif
# mysql-test
popd popd
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ 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 # but fails miserably. Just disable for the whole package
# until the package internals are fixed # until the package internals are fixed
%define _lto_cflags %{nil} %define _lto_cflags %{nil}
%{set_build_flags}
# fail quickly and obviously if user tries to build as root # fail quickly and obviously if user tries to build as root
%if %runselftest %if %runselftest
@ -468,12 +470,9 @@ cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \
fi fi
%endif %endif
# build out of source
mkdir -p build && pushd build
# The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX # The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX
# so we can't use %%{_datadir} and so forth here. # so we can't use %%{_datadir} and so forth here.
cmake .. \ %cmake \
-DBUILD_CONFIG=mysql_release \ -DBUILD_CONFIG=mysql_release \
-DFEATURE_SET="community" \ -DFEATURE_SET="community" \
-DINSTALL_LAYOUT=RPM \ -DINSTALL_LAYOUT=RPM \
@ -513,7 +512,7 @@ cmake .. \
%endif %endif
-DWITH_ROUTER=OFF \ -DWITH_ROUTER=OFF \
-DWITH_SYSTEM_LIBS=ON \ -DWITH_SYSTEM_LIBS=ON \
-DWITH_BOOST=../boost \ -DWITH_BOOST=boost \
-DREPRODUCIBLE_BUILD=OFF \ -DREPRODUCIBLE_BUILD=OFF \
-DCMAKE_C_FLAGS="%{optflags}%{?with_debug: -fno-strict-overflow -Wno-unused-result -Wno-unused-function -Wno-unused-but-set-variable}" \ -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}" \ -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 # 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 %cmake_build
popd
%install %install
pushd build %cmake_install
make DESTDIR=%{buildroot} install
# multilib support for shell scripts # multilib support for shell scripts
# we only apply this to known Red Hat multilib arches, per bug #181335 # we only apply this to known Red Hat multilib arches, per bug #181335
if %multilib_capable; then if %multilib_capable; then
mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits} 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 fi
# install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files, # install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files,
# but that's pretty wacko --- see also %%{name}-file-contents.patch) # 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 %{_vpath_builddir}/Docs/INFO_SRC %{buildroot}%{_libdir}/mysql/
install -p -m 0644 Docs/INFO_BIN %{buildroot}%{_libdir}/mysql/ install -p -m 0644 %{_vpath_builddir}/Docs/INFO_BIN %{buildroot}%{_libdir}/mysql/
mkdir -p %{buildroot}%{logfiledir} 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 install -p -m 0700 -d %{buildroot}%{_localstatedir}/lib/mysql-keyring
%if %{with config} %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 %endif
# install systemd unit files and scripts for handling server startup # 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 %{_vpath_builddir}/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 644 %{_vpath_builddir}/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 0644 %{_vpath_builddir}/scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{daemon_name}.conf
rm -r %{buildroot}%{_tmpfilesdir}/mysql.conf rm -r %{buildroot}%{_tmpfilesdir}/mysql.conf
# helper scripts for service starting # helper scripts for service starting
install -D -p -m 755 scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir install -D -p -m 755 %{_vpath_builddir}/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 %{_vpath_builddir}/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 755 %{_vpath_builddir}/scripts/mysql-check-socket %{buildroot}%{_libexecdir}/mysql-check-socket
install -p -m 644 scripts/mysql-scripts-common %{buildroot}%{_libexecdir}/mysql-scripts-common install -p -m 644 %{_vpath_builddir}/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 0644 %{_vpath_builddir}/scripts/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf
rm %{buildroot}%{_libdir}/mysql/*.a rm %{buildroot}%{_libdir}/mysql/*.a
rm %{buildroot}%{_datadir}/%{pkg_name}/mysql.server 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 mv %{buildroot}%{_bindir}/mysqld-debug %{buildroot}%{_libexecdir}/mysqld
%endif %endif
# Back to src dir
popd
# copy additional docs into build tree so %%doc will find them # copy additional docs into build tree so %%doc will find them
install -p -m 0644 %{SOURCE6} %{basename:%{SOURCE6}} install -p -m 0644 %{SOURCE6} %{_vpath_srcdir}/%{basename:%{SOURCE6}}
install -p -m 0644 %{SOURCE7} %{basename:%{SOURCE7}} install -p -m 0644 %{SOURCE7} %{_vpath_srcdir}/%{basename:%{SOURCE7}}
# Install the list of skipped tests to be available for user runs # 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} %if %{without clibrary}
unlink %{buildroot}%{_libdir}/mysql/libmysqlclient.so unlink %{buildroot}%{_libdir}/mysql/libmysqlclient.so
@ -656,7 +649,7 @@ rm %{buildroot}%{_mandir}/man1/mysql_client_test.1*
%check %check
%if %{with test} %if %{with test}
%if %runselftest %if %runselftest
pushd build pushd %_vpath_builddir
make test VERBOSE=1 make test VERBOSE=1
pushd mysql-test pushd mysql-test
cp ../../mysql-test/%{skiplist} . cp ../../mysql-test/%{skiplist} .
@ -869,6 +862,12 @@ fi
%endif %endif
%changelog %changelog
* Thu Aug 13 2020 Michal Schorm <mschorm@redhat.com> - 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 <hhorak@redhat.com> - 8.0.21-5 * Wed Aug 12 2020 Honza Horak <hhorak@redhat.com> - 8.0.21-5
- Check that we have correct versions in bundled(*) Provides - Check that we have correct versions in bundled(*) Provides
- Remove re2 dependency that is not needed any more - Remove re2 dependency that is not needed any more