0b8ee0
This patch has been offered upstream with slight typo fixes:
0b8ee0
  https://github.com/codership/galera/pull/614
0b8ee0
on 21/02/2022
0b8ee0
0b8ee0
#----------------------
0b8ee0
0b8ee0
9bcca3
1) Documentation files
9bcca3
0b8ee0
--- galera-26.4.11/CMakeLists.txt	2022-02-20 03:35:32.039968825 +0100
0b8ee0
+++ galera-26.4.11/CMakeLists.txt_patched	2022-02-20 03:34:57.710641631 +0100
0b8ee0
@@ -109,14 +109,19 @@ add_subdirectory(galera)
9bcca3
 add_subdirectory(scripts/packages)
9bcca3
 add_subdirectory(wsrep/tests)
9bcca3
 
9bcca3
+# Make the intall destination for documentation files configurable
9bcca3
+if(NOT DEFINED INSTALL_DOCDIR)
9bcca3
+  set(INSTALL_DOCDIR "doc" CACHE STRING "path to install documentaion to")
9bcca3
+endif()
9bcca3
+
9bcca3
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD")
9bcca3
   install(FILES
0b8ee0
     ${PROJECT_SOURCE_DIR}/AUTHORS
0b8ee0
     ${PROJECT_SOURCE_DIR}/COPYING
0b8ee0
     ${PROJECT_SOURCE_DIR}/README
9bcca3
-    DESTINATION doc)
9bcca3
+    DESTINATION ${INSTALL_DOCDIR} )
0b8ee0
   install(FILES ${PROJECT_SOURCE_DIR}/asio/LICENSE_1_0.txt
9bcca3
-    DESTINATION doc
9bcca3
+    DESTINATION ${INSTALL_DOCDIR}
9bcca3
     RENAME LICENSE.asio)
9bcca3
 endif()
9bcca3
 
9bcca3
9bcca3
9bcca3
2) Configuration file
9bcca3
3) Executable files
9bcca3
4) Systemd service file
9bcca3
9bcca3
--- galera-26.4.8/garb/CMakeLists.txt	2021-06-10 03:54:55.482520883 +0200
9bcca3
+++ galera-26.4.8/garb/CMakeLists.txt_patched	2021-06-10 03:54:41.070274710 +0200
9bcca3
@@ -31,14 +31,51 @@ target_compile_options(garbd
9bcca3
 target_link_libraries(garbd gcs4garb gcomm gcache
9bcca3
   ${Boost_PROGRAM_OPTIONS_LIBRARIES})
9bcca3
 
9bcca3
-install(TARGETS garbd DESTINATION bin)
9bcca3
+# Make the install destination for garbd binary configurable
9bcca3
+if(NOT DEFINED INSTALL_GARBD)
9bcca3
+  set(INSTALL_GARBD "bin" CACHE STRING "path to install garbd binary to")
9bcca3
+endif()
9bcca3
+
9bcca3
+install(TARGETS garbd
9bcca3
+  DESTINATION ${INSTALL_GARBD})
9bcca3
+
9bcca3
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD")
9bcca3
+
9bcca3
+  # Make the install destination for garbd-systemd wrapper script configurable
9bcca3
+  if(NOT DEFINED INSTALL_GARBD-SYSTEMD)
9bcca3
+    set(INSTALL_GARBD-SYSTEMD "share" CACHE STRING "path to install garbd-systemd wrapper script to")
9bcca3
+  endif()
9bcca3
+
9bcca3
+  install(FILES
9bcca3
+    ${CMAKE_CURRENT_SOURCE_DIR}/files/garb-systemd
9bcca3
+    DESTINATION ${INSTALL_GARBD-SYSTEMD})
9bcca3
+
9bcca3
+  # Make the install destination for garbd configuration file configurable
9bcca3
+  if(NOT DEFINED INSTALL_CONFIGURATION)
9bcca3
+    set(INSTALL_CONFIGURATION "share" CACHE STRING "path to install garbd configuration to")
9bcca3
+  endif()
9bcca3
+
9bcca3
   install(FILES
9bcca3
     ${CMAKE_CURRENT_SOURCE_DIR}/files/garb.cnf
9bcca3
+    DESTINATION ${INSTALL_CONFIGURATION}
9bcca3
+    RENAME garb)
9bcca3
+
9bcca3
+  # Make the install destination for garbd systemd service file configurable
9bcca3
+  if(NOT DEFINED INSTALL_SYSTEMD_SERVICE)
9bcca3
+    set(INSTALL_SYSTEMD_SERVICE "share" CACHE STRING "path to install garbd Systemd service to")
9bcca3
+  endif()
9bcca3
+
9bcca3
+  install(FILES
9bcca3
     ${CMAKE_CURRENT_SOURCE_DIR}/files/garb.service
9bcca3
-    ${CMAKE_CURRENT_SOURCE_DIR}/files/garb-systemd
9bcca3
-    DESTINATION share)
9bcca3
+    DESTINATION ${INSTALL_SYSTEMD_SERVICE})
9bcca3
+
9bcca3
+  # Make the install destination for manpage configurable
9bcca3
+  if(NOT DEFINED INSTALL_MANPAGE)
9bcca3
+    set(INSTALL_MANPAGE "man/man8" CACHE STRING "path to install manpage to")
9bcca3
+  endif()
9bcca3
+
9bcca3
   install(FILES
0b8ee0
     ${PROJECT_SOURCE_DIR}/man/garbd.8
9bcca3
-    DESTINATION man/man8)
9bcca3
+    DESTINATION ${INSTALL_MANPAGE})
9bcca3
+
9bcca3
 endif()
9bcca3
9bcca3
9bcca3
9bcca3
5) Shared library path
9bcca3
9bcca3
--- galera-26.4.8/galera/src/CMakeLists.txt	2021-06-10 03:13:05.465005845 +0200
9bcca3
+++ galera-26.4.8/galera/src/CMakeLists.txt_patched	2021-06-10 03:16:53.388699046 +0200
9bcca3
@@ -112,7 +112,12 @@ endif()
9bcca3
 
9bcca3
 target_link_libraries(galera_smm galera ${GALERA_LINK_OPTIONS})
9bcca3
 
9bcca3
-install(TARGETS galera_smm DESTINATION lib)
9bcca3
+# Make the install destination for garbd binary configurable
9bcca3
+if(NOT DEFINED INSTALL_LIBDIR)
9bcca3
+  set(INSTALL_LIBDIR "lib" CACHE STRING "path to install shared libraries to")
9bcca3
+endif()
9bcca3
+
9bcca3
+install(TARGETS galera_smm DESTINATION ${INSTALL_LIBDIR})
9bcca3
 
9bcca3
 # The following checks are guaranteed to work only
9bcca3
 # Linux platform, we skip them on others.
9bcca3