From 9651d5dbbd9eb3d1c7addafc72e97c7004486c04 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 18 Dec 2024 15:25:10 +1100 Subject: [PATCH] MDEV-32686 Use Red Hat package notes in compilation This tests the compile using a spec file. This spec file is defined by environment variables. If the spec file doesn't exist (SLES/OpenSUSE), isn't supported (e.g. clang), or has incorrect environment variables the linker flag won't be used. --- cmake/cpack_rpm.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 5e8966ec7bbb3..1e09dee5806d5 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -2,6 +2,8 @@ IF(RPM) MESSAGE(STATUS "CPackRPM building with RPM configuration: ${RPM}") +INCLUDE(check_linker_flag) + SET(CPACK_GENERATOR "RPM") SET(CPACK_RPM_PACKAGE_DEBUG 1) SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -52,6 +54,14 @@ SET(CPACK_PACKAGE_RELOCATABLE FALSE) SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") SET(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_URL}) +# The spec file depends on environment variables +SET(ENV{RPM_PACKAGE_NAME} ${CPACK_RPM_PACKAGE_NAME}) +EXECUTE_PROCESS(COMMAND rpm --eval ${CPACK_RPM_PACKAGE_RELEASE} OUTPUT_VARIABLE RPM_PACKAGE_RELEASE_EXPANDED) +SET(ENV{RPM_PACKAGE_RELEASE} ${RPM_PACKAGE_RELEASE_EXPANDED}) +SET(ENV{RPM_ARCH} ${CMAKE_SYSTEM_PROCESSOR}) +SET(ENV{RPM_PACKAGE_VERSION} ${SERVER_VERSION}) +MY_CHECK_AND_SET_LINKER_FLAG("-specs=/usr/lib/rpm/redhat/redhat-package-notes") + SET(CPACK_RPM_shared_PACKAGE_VENDOR "MariaDB Corporation Ab") SET(CPACK_RPM_shared_PACKAGE_LICENSE "LGPLv2.1")