From 7d64251f01b43e14a9bd2b2b445d8435904535f5 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 18 Jun 2019 04:44:10 -0600 Subject: [PATCH] Fixed RPM dependencies Require rpm-build --- CMakeLists.txt | 75 +++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7d8246a4..ca02790ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ cmake_minimum_required(VERSION 3.0.0) -project(GUFI C) +project(GUFI VERSION 0.2.0 LANGUAGES C) # Require C99 set(CMAKE_C_STANDARD 99) @@ -123,6 +123,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/contrib/cmake ${CMAKE_MODULE_PATH}) # Detect and handle xattr.h platform specifics find_package(xattr REQUIRED XATTR) message(STATUS "xattr headers located in ${XATTR_INCLUDEDIR}") +set(CPACK_RPM_PACKAGE_REQUIRES "libattr") if (XATTR_ATTR_XATTR_HEADER) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCONFIG_ATTR_XATTR_H") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCONFIG_ATTR_XATTR_H") @@ -158,6 +159,7 @@ pkg_search_module(PCRE REQUIRED libpcre) # if (NOT EXISTS PCRE_STATIC_LIBS) # message(FATAL_ERROR "Could not find static library files for libpcre.") # endif() +set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, pcre >= ${PCRE_VERSION}") # download and build all non-system dependencies set(DEP_DOWNLOAD_PREFIX "${CMAKE_SOURCE_DIR}/contrib/deps" CACHE PATH "Location of dependency sources") @@ -183,6 +185,7 @@ if (UNIX AND NOT APPLE AND NOT CYGWIN) set(MY_FUSE_FOUND YES) set(MY_FUSE_CFLAGS ${FUSE_CFLAGS}) set(MY_FUSE_LDFLAGS ${FUSE_LDFLAGS}) + set(MY_FUSE_VERSION ${FUSE_VERSION}) endif() elseif (APPLE) pkg_search_module(OSXFUSE osxfuse) @@ -193,11 +196,15 @@ elseif (APPLE) set(MY_FUSE_FOUND YES) set(MY_FUSE_CFLAGS ${OSXFUSE_CFLAGS}) set(MY_FUSE_LDFLAGS ${OSXFUSE_LDFLAGS}) + set(MY_FUSE_VERSION ${OSXFUSE_VERSION}) endif() endif() -if (NOT MY_FUSE_FOUND) +if (MY_FUSE_FOUND) + set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, fuse-libs >= ${MY_FUSE_VERSION}") +else() message(STATUS "FUSE not found. Not building bffuse and bfresultfuse.") + set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, fuse-libs") endif() # Find MySQL @@ -205,6 +212,7 @@ pkg_search_module(MYSQL mysql) if (MYSQL_FOUND) message(STATUS "MySQL headers located in ${MYSQL_INCLUDEDIR}") message(STATUS "MySQL libraries located in ${MYSQL_LIBDIR}") + set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, mysql >= ${MYSQL_VERSION}") else() message(STATUS "MySQL not found. Not building bfmi.") endif() @@ -213,6 +221,7 @@ endif() find_library(GPFS_LIB gpfs PATH "/usr/lpp/mmfs/lib") if(GPFS_LIB) message(STATUS "GPFS libraries found; building gpfs-scan-tool") + set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, gpfs >= ${GPFS_LIB_VERSION}") else() message(STATUS "GPFS libraries not found; not building gpfs-scan-tool") endif() @@ -222,6 +231,7 @@ pkg_search_module(DB2 db2) if (DB2_FOUND) message(STATUS "DB2 headers located in ${DB2_INCLUDEDIR}") message(STATUS "DB2 libraries located in ${DB2_LIBDIR}") + set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, db2 >= ${DB2_VERSION}") else() message(STATUS "DB2 not found.") endif() @@ -317,43 +327,34 @@ add_custom_target(test_gary COMMAND ${CMAKE_COMMAND} -E remove_directory ${TARBA WORKING_DIRECTORY ${CMAKE_BINARY_DIR} DEPENDS build_gary) -# generate RPMs # these variables have to be set before include(CPack) +set(CPACK_PACKAGE_VERSION_MAJOR ${GUFI_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${GUFI_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${GUFI_VERSION_PATCH}) -# build tar.gz by default -set(CPACK_GENERATOR "TGZ") -set(CPACK_PACKAGE_VERSION_MAJOR "0") -set(CPACK_PACKAGE_VERSION_MINOR "2") -set(CPACK_PACKAGE_VERSION_PATCH "0") - -# also build RPMs -find_program(RPMBUILD rpmbuild) -if (RPMBUILD) - execute_process(COMMAND ${RPMBUILD} --version - OUTPUT_VARIABLE RPMBUILD_VERSION) - - set(CPACK_GENERATOR "RPM;${CPACK_GENERATOR}") - set(CPACK_RPM_COMPONENT_INSTALL On) - set(CPACK_RPM_PACKAGE_SUMMARY "Grand Unified File Index") - set(CPACK_RPM_PACKAGE_NAME "GUFI") - set(CPACK_RPM_PACKAGE_VERSION "0.2.0") - set(CPACK_RPM_PACKAGE_RELEASE 1) - set(CPACK_RPM_PACKAGE_LICENSE "BSD/LANL") - set(CPACK_RPM_PACKAGE_VENDOR "LANL") - set(CPACK_RPM_PACKAGE_URL "https://github.com/mar-file-system/GUFI") - set(CPACK_RPM_PACKAGE_REQUIRES "gcc >= 4.8.5, python >= 2.7, python < 3, cmake3 >= 3.0, pkgconfig >= 0.27.1, coreutils >= 8.20, libattr >= 2.4, pcre >= 8.30") - if (NOT ("${RPMBUILD_VERSION}" VERSION_LESS "4.13.0")) - set(CPACK_RPM_PACKAGE_SUGGESTS "gcc >= 4.9.3, gcc-c++ >= 4.9.3") - endif() - set(CPACK_RPM_PACKAGE_RELOCATABLE On) - set(CPACK_RPM_Server_PACKAGE_SUMMARY "GUFI Server RPM") - - if (PARAMIKO) - # python libraries are probably installed through pip, and won't be found by rpm - # set(CPACK_RPM_Client_PACKAGE_REQUIRES "python >= 2.7, python < 3, python2-cryptography >= 2.0.0, python2-bcrypt >= 3.1.0, python2-pynacl >= 1.1.1") - set(CPACK_RPM_Client_PACKAGE_REQUIRES "python >= 2.7, python < 3") - set(CPACK_RPM_Client_PACKAGE_SUMMARY "GUFI Client RPM") - endif() +# generate RPMs +find_program(RPMBUILD REQUIRED rpmbuild) +execute_process(COMMAND ${RPMBUILD} --version + OUTPUT_VARIABLE RPMBUILD_VERSION) + +set(CPACK_GENERATOR "RPM") +set(CPACK_RPM_COMPONENT_INSTALL On) +set(CPACK_RPM_PACKAGE_SUMMARY "Grand Unified File Index") +set(CPACK_RPM_PACKAGE_NAME "GUFI") +set(CPACK_RPM_PACKAGE_VERSION "${GUFI_VERSION}") +set(CPACK_RPM_PACKAGE_RELEASE 1) +set(CPACK_RPM_PACKAGE_LICENSE "BSD/LANL") +set(CPACK_RPM_PACKAGE_VENDOR "LANL") +set(CPACK_RPM_PACKAGE_URL "https://github.com/mar-file-system/GUFI") +set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, python >= 2.7, python < 3, coreutils >= 8.20") +set(CPACK_RPM_PACKAGE_RELOCATABLE On) +set(CPACK_RPM_Server_PACKAGE_SUMMARY "GUFI Server RPM") + +if (PARAMIKO) + # python libraries are probably installed through pip, and won't be found by rpm + # set(CPACK_RPM_Client_PACKAGE_REQUIRES "python >= 2.7, python < 3, python2-cryptography >= 2.0.0, python2-bcrypt >= 3.1.0, python2-pynacl >= 1.1.1, openssh") + set(CPACK_RPM_Client_PACKAGE_REQUIRES "python >= 2.7, python < 3, openssh") + set(CPACK_RPM_Client_PACKAGE_SUMMARY "GUFI Client RPM") endif() include(CPack)