#11 Switch from Scons to CMake building for mariadb-10.4
Closed 2 years ago by mschorm. Opened 2 years ago by ljavorsk.
rpms/ ljavorsk/galera mariadb-10.4  into  mariadb-10.4

file added
+112
@@ -0,0 +1,112 @@ 

+ 1) Documentation files

+ 

+ --- galera-26.4.8/CMakeLists.txt	2021-04-08 08:05:44.000000000 +0200

+ +++ galera-26.4.8/CMakeLists.txt_patched	2021-06-10 01:40:26.886770832 +0200

+ @@ -106,14 +106,19 @@ add_subdirectory(galera)

+  add_subdirectory(scripts/packages)

+  add_subdirectory(wsrep/tests)

+  

+ +# Make the intall destination for documentation files configurable

+ +if(NOT DEFINED INSTALL_DOCDIR)

+ +  set(INSTALL_DOCDIR "doc" CACHE STRING "path to install documentaion to")

+ +endif()

+ +

+  if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD")

+    install(FILES

+      ${CMAKE_SOURCE_DIR}/AUTHORS

+      ${CMAKE_SOURCE_DIR}/COPYING

+      ${CMAKE_SOURCE_DIR}/README

+ -    DESTINATION doc)

+ +    DESTINATION ${INSTALL_DOCDIR} )

+    install(FILES ${CMAKE_SOURCE_DIR}/asio/LICENSE_1_0.txt

+ -    DESTINATION doc

+ +    DESTINATION ${INSTALL_DOCDIR}

+      RENAME LICENSE.asio)

+  endif()

+  

+ 

+ 

+ 2) Configuration file

+ 3) Executable files

+ 4) Systemd service file

+ 

+ --- galera-26.4.8/garb/CMakeLists.txt	2021-06-10 03:54:55.482520883 +0200

+ +++ galera-26.4.8/garb/CMakeLists.txt_patched	2021-06-10 03:54:41.070274710 +0200

+ @@ -31,14 +31,51 @@ target_compile_options(garbd

+  target_link_libraries(garbd gcs4garb gcomm gcache

+    ${Boost_PROGRAM_OPTIONS_LIBRARIES})

+  

+ -install(TARGETS garbd DESTINATION bin)

+ +# Make the install destination for garbd binary configurable

+ +if(NOT DEFINED INSTALL_GARBD)

+ +  set(INSTALL_GARBD "bin" CACHE STRING "path to install garbd binary to")

+ +endif()

+ +

+ +install(TARGETS garbd

+ +  DESTINATION ${INSTALL_GARBD})

+ +

+  if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD")

+ +

+ +  # Make the install destination for garbd-systemd wrapper script configurable

+ +  if(NOT DEFINED INSTALL_GARBD-SYSTEMD)

+ +    set(INSTALL_GARBD-SYSTEMD "share" CACHE STRING "path to install garbd-systemd wrapper script to")

+ +  endif()

+ +

+ +  install(FILES

+ +    ${CMAKE_CURRENT_SOURCE_DIR}/files/garb-systemd

+ +    DESTINATION ${INSTALL_GARBD-SYSTEMD})

+ +

+ +  # Make the install destination for garbd configuration file configurable

+ +  if(NOT DEFINED INSTALL_CONFIGURATION)

+ +    set(INSTALL_CONFIGURATION "share" CACHE STRING "path to install garbd configuration to")

+ +  endif()

+ +

+    install(FILES

+      ${CMAKE_CURRENT_SOURCE_DIR}/files/garb.cnf

+ +    DESTINATION ${INSTALL_CONFIGURATION}

+ +    RENAME garb)

+ +

+ +  # Make the install destination for garbd systemd service file configurable

+ +  if(NOT DEFINED INSTALL_SYSTEMD_SERVICE)

+ +    set(INSTALL_SYSTEMD_SERVICE "share" CACHE STRING "path to install garbd Systemd service to")

+ +  endif()

+ +

+ +  install(FILES

+      ${CMAKE_CURRENT_SOURCE_DIR}/files/garb.service

+ -    ${CMAKE_CURRENT_SOURCE_DIR}/files/garb-systemd

+ -    DESTINATION share)

+ +    DESTINATION ${INSTALL_SYSTEMD_SERVICE})

+ +

+ +  # Make the install destination for manpage configurable

+ +  if(NOT DEFINED INSTALL_MANPAGE)

+ +    set(INSTALL_MANPAGE "man/man8" CACHE STRING "path to install manpage to")

+ +  endif()

+ +

+    install(FILES

+      ${CMAKE_SOURCE_DIR}/man/garbd.8

+ -    DESTINATION man/man8)

+ +    DESTINATION ${INSTALL_MANPAGE})

+ +

+  endif()

+ 

+ 

+ 

+ 5) Shared library path

+ 

+ --- galera-26.4.8/galera/src/CMakeLists.txt	2021-06-10 03:13:05.465005845 +0200

+ +++ galera-26.4.8/galera/src/CMakeLists.txt_patched	2021-06-10 03:16:53.388699046 +0200

+ @@ -112,7 +112,12 @@ endif()

+  

+  target_link_libraries(galera_smm galera ${GALERA_LINK_OPTIONS})

+  

+ -install(TARGETS galera_smm DESTINATION lib)

+ +# Make the install destination for garbd binary configurable

+ +if(NOT DEFINED INSTALL_LIBDIR)

+ +  set(INSTALL_LIBDIR "lib" CACHE STRING "path to install shared libraries to")

+ +endif()

+ +

+ +install(TARGETS galera_smm DESTINATION ${INSTALL_LIBDIR})

+  

+  # The following checks are guaranteed to work only

+  # Linux platform, we skip them on others.

+ 

file removed
-17
@@ -1,17 +0,0 @@ 

- Upstream PR:

- https://github.com/codership/galera/pull/512

- 

- diff -up galera-25.3.23/SConstruct.bak galera-25.3.23/SConstruct

- --- galera-25.3.23/SConstruct.bak	2018-07-13 15:14:49.059835554 +0200

- +++ galera-25.3.23/SConstruct	2018-07-13 15:19:07.717967794 +0200

- @@ -194,8 +194,8 @@ if link != 'default':

-      env.Replace(LINK = link)

-  

-  # Get compiler name/version, CXX may be set to "c++" which may be clang or gcc

- -cc_version = str(read_first_line(env['CC'].split() + ['--version']))

- -cxx_version = str(read_first_line(env['CXX'].split() + ['--version']))

- +cc_version = str(read_first_line(env['CC'].split() + ['--version']).decode())

- +cxx_version = str(read_first_line(env['CXX'].split() + ['--version']).decode())

-  

-  print('Using C compiler executable: ' + env['CC'])

-  print('C compiler version is: ' + cc_version)

file modified
+94 -39
@@ -1,6 +1,6 @@ 

  Name:           galera

- Version:        26.4.8

- Release:        1%{?dist}

+ Version:        26.4.9

+ Release:        2%{?dist}

  Summary:        Synchronous multi-master wsrep provider (replication engine)

  

  License:        GPLv2
@@ -15,10 +15,12 @@ 

  Source1:        garbd.service

  Source2:        garbd-wrapper

  

- Patch0:         galera-python3.patch

+ Patch0:         cmake_paths.patch

  

- BuildRequires:  boost-devel check-devel openssl-devel python3-scons systemd gcc-c++ asio-devel

+ BuildRequires:  boost-devel check-devel openssl-devel cmake systemd gcc-c++ asio-devel

+ Requires(pre):  /usr/sbin/useradd

  Requires:       nmap-ncat

+ Requires:       procps-ng

  

  %{?systemd_requires}

  
@@ -34,48 +36,77 @@ 

  %setup -q

  %patch0 -p1

  

- # Fix for BZ#1959484

- # The script is checking the version without the wsrep API number (the first number separated by dot)

- # This could be caused by wrongly providing the version from wsrep_load function

- # Issue is already reported here: https://github.com/codership/galera/issues/596

- # So we can temporary remove API version from the test to make it work, however, we will wait for the upstream's

- # solution in the issue linked above

- sed -i '/^GALERA_VER/s/API + //' wsrep/tests/SConscript

- 

  %build

  %{set_build_flags}

  

- # Print help:

- #   scons-3 --help

- #   scons-3 -H

  

- # Possibly usefull arguments:

- #   --debug=findlibs

- #   --debug=stacktrace

- #   --warn=all

- #   debug=0

+ %cmake . \

+        -DCMAKE_BUILD_TYPE="%{?with_debug:Debug}%{!?with_debug:RelWithDebInfo}" \

+        -DINSTALL_LAYOUT=RPM \

+        -DCMAKE_RULE_MESSAGES:BOOL=OFF \

+        \

+        -DBUILD_SHARED_LIBS:BOOL=OFF \

+        \

+        -DINSTALL_DOCDIR="share/doc/%{name}/" \

+        -DINSTALL_GARBD="sbin" \

+        -DINSTALL_GARBD-SYSTEMD="sbin" \

+        -DINSTALL_CONFIGURATION="/etc/sysconfig/" \

+        -DINSTALL_SYSTEMD_SERVICE="lib/systemd/system" \

+        -DINSTALL_LIBDIR="%{_lib}/galera" \

+        -DINSTALL_MANPAGE="share/man/man8"

  

- # Workaround for version 26.4.7

- export CXXFLAGS="$CXXFLAGS -Wno-error=format-extra-args"

- # ... and for 32 bit arches

- export CXXFLAGS="$CXXFLAGS -Wno-error=format"

- export CFLAGS="$CFLAGS -Wno-error=format-extra-args -Wno-error=format"

- # end of workaroound

+ cmake -B %_vpath_builddir -LAH

  

- scons-3 %{?_smp_mflags} strict_build_flags=1

+ %cmake_build

  

  

  %install

- install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/garbd.service

- install -D -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/garbd-wrapper

- install -D -m 755 garb/garbd %{buildroot}%{_sbindir}/garbd

- install -D -m 755 libgalera_smm.so %{buildroot}%{_libdir}/galera/libgalera_smm.so

- install -D -m 644 garb/files/garb.cnf %{buildroot}%{_sysconfdir}/sysconfig/garb

- install -D -m 644 COPYING %{buildroot}%{_docdir}/galera/COPYING

- install -D -m 644 asio/LICENSE_1_0.txt %{buildroot}%{_docdir}/galera/LICENSE.asio

- install -D -m 644 scripts/packages/README %{buildroot}%{_docdir}/galera/README

- install -D -m 644 scripts/packages/README-MySQL %{buildroot}%{_docdir}/galera/README-MySQL

- 

+ %cmake_install

+ 

+ # PATCH 1:

+ #   Change the Systemd service name from "garb" to "garbd"

+ #

+ #   The Galera upstream uses name "garb" for the service while providing "garbd" alias

+ #   Fedora downstream packaging historically used "garbd" name for the service.

+ #

+ #   Let's stick with the Fedora legacy naming, AND provide an alias to the Galera upstream name

+ mv %{buildroot}/usr/lib/systemd/system/garb.service %{buildroot}/usr/lib/systemd/system/garbd.service

+ sed -i 's/Alias=garbd.service/Alias=garb.service/g' %{buildroot}/usr/lib/systemd/system/garbd.service

+ 

+ # PATCH 2:

+ #   Fix the hardcoded paths

+ #     In the Systemd service file:

+ sed -i 's;/usr/bin/garb-systemd;/usr/sbin/garb-systemd;g' %{buildroot}/usr/lib/systemd/system/garbd.service

+ #     In the wrapper script:

+ sed -i 's;/usr/bin/garbd;/usr/sbin/garbd;g' %{buildroot}/usr/sbin/garb-systemd

+ 

+ # PATCH 4:

+ #  Use a dedicated user for the Systemd service

+ #  To fix an security issue reported by Systemd:

+ #

+ ## systemd[1]: /usr/lib/systemd/system/garb.service:14: Special user nobody configured, this is not safe!

+ ##   Subject: Special user nobody configured, this is not safe!

+ ##   Defined-By: systemd

+ ##   Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel

+ ##   Documentation: https://systemd.io/UIDS-GIDS

+ ##

+ ##   The unit garb.service is configured to use User=nobody.

+ ##

+ ##   This is not safe. The nobody user's main purpose on Linux-based

+ ##   operating systems is to be the owner of files that otherwise cannot be mapped

+ ##   to any local user. It's used by the NFS client and Linux user namespacing,

+ ##   among others. By running a unit's processes under the identity of this user

+ ##   they might possibly get read and even write access to such files that cannot

+ ##   otherwise be mapped.

+ ##

+ ##   It is strongly recommended to avoid running services under this user identity,

+ ##   in particular on systems using NFS or running containers. Allocate a user ID

+ ##   specific to this service, either statically via systemd-sysusers or dynamically

+ ##   via the DynamicUser= service setting.

+ sed -i 's/User=nobody/User=garb/g' %{buildroot}/usr/lib/systemd/system/garbd.service

+ 

+ %pre

+ /usr/sbin/useradd -M -r -d /dev/null -s /sbin/nologin -c "Galera Arbitrator Daemon" garb >/dev/null 2>&1 || :

  

  %post

  /sbin/ldconfig
@@ -91,19 +122,43 @@ 

  

  %files

  %config(noreplace,missingok) %{_sysconfdir}/sysconfig/garb

+ 

  %dir %{_docdir}/galera

  %dir %{_libdir}/galera

+ 

  %{_sbindir}/garbd

- %{_sbindir}/garbd-wrapper

+ #%{_sbindir}/garbd-wrapper

+ 

+ # PATCH 3:

+ #   Make sure the wrapper script is executable

+ %attr(755, -, -) %{_sbindir}/garb-systemd

+ 

+ %{_mandir}/man8/garbd.8*

+ 

  %{_unitdir}/garbd.service

+ 

  %{_libdir}/galera/libgalera_smm.so

+ 

+ %doc %{_docdir}/galera/AUTHORS

  %doc %{_docdir}/galera/COPYING

  %doc %{_docdir}/galera/LICENSE.asio

  %doc %{_docdir}/galera/README

- %doc %{_docdir}/galera/README-MySQL

+ #%doc %{_docdir}/galera/README-MySQL

  

  

  %changelog

+ * Fri Nov 19 2021 Lukas Javorsky <ljavorsk@redhat.com> - 26.4.9-2

+ - Explicitly require the 'procps-ng' package

+ - Otherwise it will not require it in the lightweight systems (e.g. containers)

+ - and Galera won't work properly

+ 

+ * Sat Aug 07 2021 Michal Schorm <mschorm@redhat.com> - 26.4.9-1

+ - Rebase to 26.4.9

+ 

+ * Thu Jul 15 2021 Michal Schorm <mschorm@redhat.com> - 26.4.8-2

+ - Switch from SCONS build tooling to CMAKE build tooling

+ - Use upstream variants of Systemd service file and Systemd service file wrapper srcipt

+ 

  * Thu Jun 03 2021 Lukas Javorsky <ljavorsk@redhat.com> - 26.4.8-1

  - Rebase to 26.4.8

  

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (galera-26.4.8.tar.gz) = 9ae72b7fcef5efde8349179e5a0d0759959d1b90923ec2830f05c570b37b5d514dd638fff6b7e94bb36dd4058260db71b83f64e072d1d6d8dedc8584bc562723

+ SHA512 (galera-26.4.9.tar.gz) = a67f89e71d4635a634a6a4eb138a4a3fd6a8f1444dd0ba7bd46a2c1342e815da2ebd1df56a111cddf4470ad51a5b0a8e2153357c6066d8ba99aa3aec8761a857

Also, rebase to version 26.4.9 which is a version built-in MariaDB-10.4.21 (currently in 10.4 MariaDB Fedora branch)

I merged 'mariadb-10.4' branch into 'rawhide'

Pull-Request has been closed by mschorm

2 years ago