diff --git a/CHANGELOG.md b/CHANGELOG.md index a3f54112c2..2e86a42f2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Change Logs for rocm-core -Unreleased ROCm6.3.0 release +ROCm6.4.1 release + - Added changelog.debian and copyright for debian packages. +ROCm6.3.0 release - Enabled Support for CMAKE Module Config. ROCm6.1.0 release - Added new API to get ROCm install Path (getROCmInstallPath()) at runtime diff --git a/CMakeLists.txt b/CMakeLists.txt index fd268cda4c..3277e4c8e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,9 +37,27 @@ set( CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options ar ## Verbose output. set( CMAKE_VERBOSE_MAKEFILE on ) +include( GNUInstallDirs ) + +if(ENABLE_ASAN_PACKAGING) + # Only libraries required for ASAN Package + set( CPACK_COMPONENTS_ALL CORE_ASAN ) + set( COMP_TYPE "CORE_ASAN" ) + set( PKG_DESCRIPTION "ROCm AddressSanitizer Instrumented Runtime software stack" ) + set( CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DOCDIR}-asan" ) +else() + if(BUILD_SHARED_LIBS) + set( CPACK_COMPONENTS_ALL CORE_RUNTIME ) + set( COMP_TYPE "CORE_RUNTIME" ) + set( PKG_DESCRIPTION "ROCm Runtime software stack" ) + else() + set( CPACK_COMPONENTS_ALL CORE_STATIC ) + set( STATIC_COMP_TYPE "CORE_STATIC" ) + set( PKG_DESCRIPTION "ROCm Static software stack" ) + endif() +endif() include( utils.cmake ) -include( GNUInstallDirs ) #Parse Version message( STATUS "ROCM_VERSION = ${ROCM_VERSION}" ) @@ -48,12 +66,12 @@ parse_rocm_version( ${ROCM_VERSION} ) set( CPACK_PACKAGING_INSTALL_PREFIX "/opt/rocm" CACHE PATH "default cpack directory" ) set( BUILD_SHARED_LIBS ON CACHE BOOL "Build shared library (.so) or not." ) set( CPACK_GENERATOR "TGZ;DEB;RPM" CACHE STRING "package types to be produced " ) -set( COPYRIGHT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/copyright" ) +set( LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/copyright" ) set( BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR} ) - -if(NOT ENABLE_ASAN_PACKAGING) - option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorg with backward compatibility" OFF) -endif() +set( EXTENDED_PACKAGE_DESCRIPTION + "ROCM-CORE is a package which can be used to get ROCm release version, get ROCm install path information etc. + It is also important to note that ROCM-CORE takes the role as a base component on which all of ROCm can depend, + to make it easy to remove all of ROCm with a package manager." CACHE STRING "Debian Package Extended Description") ## Set variables set_variables() @@ -74,34 +92,16 @@ else () endif() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocmmod.in ${BUILD_DIR}/rocmmod @ONLY ) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm-core.postinst ${BUILD_DIR}/postinst @ONLY ) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm-core.prerm ${BUILD_DIR}/prerm @ONLY ) + +# Setting Permission 0755 for pre/post install scripts +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm-core.postinst ${BUILD_DIR}/postinst + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE @ONLY ) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm-core.prerm ${BUILD_DIR}/prerm + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE @ONLY ) #Generate BUILD_INFO configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm_version.h.in ${BUILD_DIR}/rocm_version.h @ONLY ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm_getpath.h.in ${BUILD_DIR}/rocm_getpath.h @ONLY ) -#File reorg Backward compatibility function -if(NOT WIN32) - if(FILE_REORG_BACKWARD_COMPATIBILITY) - # To enabe/disable #error in wrapper header files - if(NOT DEFINED ROCM_HEADER_WRAPPER_WERROR) - if(DEFINED ENV{ROCM_HEADER_WRAPPER_WERROR}) - set(ROCM_HEADER_WRAPPER_WERROR "$ENV{ROCM_HEADER_WRAPPER_WERROR}" - CACHE STRING "Header wrapper warnings as errors.") - else() - set(ROCM_HEADER_WRAPPER_WERROR "OFF" CACHE STRING "Header wrapper warnings as errors.") - endif() - endif() - - if(ROCM_HEADER_WRAPPER_WERROR) - set(deprecated_error 1) - else() - set(deprecated_error 0) - endif() - - include(rocm-core-backward-compat.cmake) - endif() #FILE_REORG_BACKWARD_COMPATIBILITY -endif() #Make the rocmlib set( SRCS rocm_version.cpp rocm_getpath.cpp) @@ -119,33 +119,16 @@ set( SO_VERSION_STRING "${SO_MAJOR}.${SO_MINOR}.${ROCM_LIBPATCH_VERSION}" ) set_property( TARGET ${CORE_TARGET} PROPERTY VERSION "${SO_VERSION_STRING}" ) set_property( TARGET ${CORE_TARGET} PROPERTY SOVERSION "${SO_MAJOR}" ) -if(ENABLE_ASAN_PACKAGING) - # Only libraries required for ASAN Package - set( CPACK_COMPONENTS_ALL CORE_ASAN ) - set( COMP_TYPE "CORE_ASAN" ) - set( PKG_DESCRIPTION "ROCm AddressSanitizer Instrumented Runtime software stack" ) -else() - if(BUILD_SHARED_LIBS) - set( CPACK_COMPONENTS_ALL CORE_RUNTIME ) - set( COMP_TYPE "CORE_RUNTIME" ) - set( PKG_DESCRIPTION "ROCm Runtime software stack" ) - else() - set( CPACK_COMPONENTS_ALL CORE_STATIC ) - set( STATIC_COMP_TYPE "CORE_STATIC" ) - set( PKG_DESCRIPTION "ROCm Static software stack" ) - endif() -endif() - #Add the libpatch version if available to the version file if( DEFINED VERSION_POINT ) - file ( WRITE "${CMAKE_CURRENT_BINARY_DIR}/version" "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_POINT}-${BUILD_ID}\n" ) + file ( WRITE "${CMAKE_CURRENT_BINARY_DIR}/version" "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_POINT}\n" ) else() - file ( WRITE "${CMAKE_CURRENT_BINARY_DIR}/version" "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${BUILD_ID}\n" ) + file ( WRITE "${CMAKE_CURRENT_BINARY_DIR}/version" "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}\n" ) endif() ## Support for Static and Shared Target Packaging if(BUILD_SHARED_LIBS) - install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/version DESTINATION .info COMPONENT CORE_RUNTIME ) + install ( FILES ${BUILD_DIR}/version DESTINATION .info COMPONENT CORE_RUNTIME ) # Target Library needs to installed/packaged to same destination # in both ASAN and nonASAN Shared library builds @@ -158,19 +141,16 @@ if(BUILD_SHARED_LIBS) install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/runpath_to_rpath.py DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/rocm-core COMPONENT CORE_RUNTIME ) - install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/rocmmod + install ( FILES ${BUILD_DIR}/rocmmod DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT CORE_RUNTIME ) # License file - install ( FILES ${COPYRIGHT_FILE} + install ( FILES ${LICENSE_FILE} DESTINATION ${CMAKE_INSTALL_DOCDIR} RENAME LICENSE.txt - COMPONENT CORE_RUNTIME) - install ( FILES ${COPYRIGHT_FILE} DESTINATION - ${CMAKE_INSTALL_DOCDIR}-asan RENAME LICENSE.txt - COMPONENT CORE_ASAN) + COMPONENT ${COMP_TYPE}) else() - install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/version + install ( FILES ${BUILD_DIR}/version DESTINATION .info COMPONENT ${STATIC_COMP_TYPE} ) install ( TARGETS ${CORE_TARGET} @@ -185,11 +165,11 @@ else() install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/runpath_to_rpath.py DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/rocm-core COMPONENT ${STATIC_COMP_TYPE} ) - install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/rocmmod + install ( FILES ${BUILD_DIR}/rocmmod DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${STATIC_COMP_TYPE} ) # License file - install ( FILES ${COPYRIGHT_FILE} + install ( FILES ${LICENSE_FILE} DESTINATION ${CMAKE_INSTALL_DOCDIR} RENAME LICENSE.txt COMPONENT ${STATIC_COMP_TYPE}) endif() @@ -208,18 +188,20 @@ set(CONFIG_PACKAGE_INSTALL_DIR ${CONF_LIB_DIR}/cmake/${CORE_TARGET}) set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") set(BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") +set(PKG_MAINTAINER_NM "ROCm Dev Support") +set(PKG_MAINTAINER_EMAIL "rocm-dev.support@amd.com") ## Generate Config File for rocm-core configure_package_config_file( ${CMAKE_MODULE_PATH}/${CORE_TARGET}-config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/${CORE_TARGET}-config.cmake + ${BUILD_DIR}/${CORE_TARGET}-config.cmake INSTALL_DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR} PATH_VARS LIB_INSTALL_DIR INCLUDE_INSTALL_DIR BIN_INSTALL_DIR ) ## Generate config Version File for rocm-core write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/${CORE_TARGET}-config-version.cmake + ${BUILD_DIR}/${CORE_TARGET}-config-version.cmake VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" COMPATIBILITY SameMajorVersion) @@ -240,9 +222,9 @@ set ( CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR} ) set ( CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR} ) set ( CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH} ) set ( CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" ) -set ( CPACK_PACKAGE_CONTACT "ROCm Dev Support " ) +set ( CPACK_PACKAGE_CONTACT "${PKG_MAINTAINER_NM} <${PKG_MAINTAINER_EMAIL}>" ) set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PKG_DESCRIPTION}" ) -set ( CPACK_RESOURCE_FILE_LICENSE "${COPYRIGHT_FILE}" ) +set ( CPACK_RESOURCE_FILE_LICENSE "${LICENSE_FILE}" ) ## packaging variables if ( DEFINED ROCM_LIBPATCH_VERSION ) set ( CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${ROCM_LIBPATCH_VERSION}" ) @@ -259,6 +241,13 @@ set ( CPACK_DEBIAN_CORE_STATIC_PACKAGE_NAME ${CORE_TARGET} ) message ( STATUS "Using CPACK_DEBIAN_PACKAGE_RELEASE ${CPACK_DEBIAN_PACKAGE_RELEASE}" ) set ( CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT" ) +# Debian specific packaging configuration +if(COMP_TYPE) +configure_debian_pkg( ${CORE_TARGET} ${COMP_TYPE} ${CPACK_PACKAGE_VERSION} ${PKG_MAINTAINER_NM} ${PKG_MAINTAINER_EMAIL} ) +elseif(STATIC_COMP_TYPE) +configure_debian_pkg( ${CORE_TARGET} ${STATIC_COMP_TYPE} ${CPACK_PACKAGE_VERSION} ${PKG_MAINTAINER_NM} ${PKG_MAINTAINER_EMAIL} ) +endif() + ## RPM package specific variables set ( CPACK_RPM_COMPONENT_INSTALL ON ) set ( CPACK_RPM_CORE_RUNTIME_PACKAGE_NAME "${CORE_TARGET}" ) @@ -267,7 +256,6 @@ set ( CPACK_RPM_CORE_ASAN_PACKAGE_NAME ${CORE_TARGET}-asan ) # STATIC package name - For Now, No change for static package Name from default set ( CPACK_RPM_CORE_STATIC_PACKAGE_NAME ${CORE_TARGET} ) - ## 'dist' breaks manual builds on debian systems due to empty Provides execute_process( COMMAND rpm --eval %{?dist} RESULT_VARIABLE PROC_RESULT @@ -283,27 +271,31 @@ set ( CPACK_RPM_FILE_NAME "RPM-DEFAULT" ) # Debian package specific variables set ( CPACK_DEBIAN_PACKAGE_DEPENDS ${DEB_DEPENDS_STRING} ) set ( CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ROCm/rocm-core" ) +set ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${BUILD_DIR}/postinst;${BUILD_DIR}/prerm" ) set ( CPACK_DEBIAN_CORE_ASAN_PACKAGE_DEPENDS ${CORE_TARGET} ) -set ( CPACK_DEBIAN_CORE_RUNTIME_PACKAGE_CONTROL_EXTRA "${BUILD_DIR}/postinst;${BUILD_DIR}/prerm" ) -set ( CPACK_DEBIAN_CORE_STATIC_PACKAGE_CONTROL_EXTRA "${BUILD_DIR}/postinst;${BUILD_DIR}/prerm" ) +set ( CPACK_DEBIAN_CORE_RUNTIME_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" ) +set ( CPACK_DEBIAN_CORE_STATIC_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" ) +set ( CPACK_DEBIAN_PACKAGE_DESCRIPTION "${EXTENDED_PACKAGE_DESCRIPTION}" ) ## RPM package specific variables set ( CPACK_RPM_PACKAGE_REQUIRES ${RPM_DEPENDS_STRING} ) set ( CPACK_RPM_PACKAGE_LICENSE "MIT" ) set ( CPACK_RPM_CORE_ASAN_PACKAGE_REQUIRES ${CORE_TARGET} ) -set ( CPACK_RPM_CORE_RUNTIME_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/postinst" ) -set ( CPACK_RPM_CORE_RUNTIME_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/prerm" ) -set ( CPACK_RPM_CORE_STATIC_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/postinst" ) -set ( CPACK_RPM_CORE_STATIC_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/prerm" ) +set ( CPACK_RPM_CORE_RUNTIME_POST_INSTALL_SCRIPT_FILE "${BUILD_DIR}/postinst" ) +set ( CPACK_RPM_CORE_RUNTIME_POST_UNINSTALL_SCRIPT_FILE "${BUILD_DIR}/prerm" ) +set ( CPACK_RPM_CORE_STATIC_POST_INSTALL_SCRIPT_FILE "${BUILD_DIR}/postinst" ) +set ( CPACK_RPM_CORE_STATIC_POST_UNINSTALL_SCRIPT_FILE "${BUILD_DIR}/prerm" ) +set ( CPACK_RPM_PACKAGE_DESCRIPTION "${EXTENDED_PACKAGE_DESCRIPTION}" ) if ( DEFINED CPACK_PACKAGING_INSTALL_PREFIX ) - set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/.info" ) -endif ( ) + set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION + "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/.info" ) +endif() + # Backward compatibility support for deprecated package rocm-clang-ocl # TODO: To be removed after two releases set(CPACK_DEBIAN_RUNTIME_PACKAGE_REPLACES "rocm-clang-ocl") set(CPACK_DEBIAN_RUNTIME_PACKAGE_CONFLICTS "rocm-clang-ocl") - set(CPACK_RPM_RUNTIME_PACKAGE_OBSOLETES "rocm-clang-ocl") ## Include packaging diff --git a/DEBIAN/changelog.in b/DEBIAN/changelog.in new file mode 100644 index 0000000000..95ba9572fb --- /dev/null +++ b/DEBIAN/changelog.in @@ -0,0 +1,5 @@ +@DEB_PACKAGE_NAME@ (@DEB_PACKAGE_VERSION@) stable; urgency=low + + * ROCm Runtime software stack Base Package. + -- @DEB_MAINTAINER_NAME@ <@DEB_MAINTAINER_EMAIL@> @DEB_TIMESTAMP@ + diff --git a/DEBIAN/copyright.in b/DEBIAN/copyright.in new file mode 100644 index 0000000000..e90d34aa20 --- /dev/null +++ b/DEBIAN/copyright.in @@ -0,0 +1,26 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: @DEB_PACKAGE_NAME@ +Upstream-Contact: @DEB_MAINTAINER_NAME@ <@DEB_MAINTAINER_EMAIL@> +Source: https://github.com/ROCm/@DEB_PACKAGE_NAME@ +Files: * +License: @DEB_LICENSE@ +Copyright: @DEB_COPYRIGHT_YEAR@ Advanced Micro Devices, Inc. All rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/header_template.hpp.in b/header_template.hpp.in deleted file mode 100644 index 0d8c481e90..0000000000 --- a/header_template.hpp.in +++ /dev/null @@ -1,48 +0,0 @@ -/* - MIT License - - Copyright (c) 2017 - 2023 Advanced Micro Devices, Inc. All rights Reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - */ -#ifndef @include_guard@ -#define @include_guard@ - -#ifndef ROCM_HEADER_WRAPPER_WERROR -#define ROCM_HEADER_WRAPPER_WERROR @deprecated_error@ -#endif -#if ROCM_HEADER_WRAPPER_WERROR /* ROCM_HEADER_WRAPPER_WERROR 1 */ -#error "@file_name@ has moved to @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ " -#else /* ROCM_HEADER_WRAPPER_WERROR 0 */ -#if defined(__GNUC__) -#warning "@file_name@ has moved to @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ " -#else -#pragma message ("@file_name@ has moved to @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ ") -#endif -#endif /* ROCM_HEADER_WRAPPER_WERROR */ - -@include_statements@ - -@hashzero_check@ - -@file_contents@ - -@hash_endif@ - -#endif diff --git a/rocm-core-backward-compat.cmake b/rocm-core-backward-compat.cmake deleted file mode 100644 index e96572e669..0000000000 --- a/rocm-core-backward-compat.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) 2023 Advanced Micro Devices, Inc. All Rights Reserved. -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -cmake_minimum_required(VERSION 3.16.8) - -set(ROCM_CORE_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(ROCM_CORE_WRAPPER_DIR ${ROCM_CORE_BUILD_DIR}/wrapper_dir) -set(ROCM_CORE_WRAPPER_INC_DIR ${ROCM_CORE_WRAPPER_DIR}/include) -set(headerfile_dir "rocm-core") - -#Function to set actual file contents in wrapper files -#Some components grep for the contents in the file -function(set_file_contents input_file) - set(hashzero_check "#if 0 -/* The following is a copy of the original file for the benefit of build systems which grep for values - * in this file rather than preprocess it. This is just for backward compatibility */") - - file(READ ${input_file} file_contents) - set(hash_endif "#endif") - get_filename_component(file_name ${input_file} NAME) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/header_template.hpp.in ${ROCM_CORE_WRAPPER_INC_DIR}/${file_name}) -endfunction() - -#use header template file and generate wrapper header files -function(generate_wrapper_header) - file(MAKE_DIRECTORY ${ROCM_CORE_WRAPPER_INC_DIR}) - - #find all header files - file(GLOB include_files ${ROCM_CORE_BUILD_DIR}/*.h) - #Create wrapper files - foreach(header_file ${include_files}) - # set include guard - get_filename_component(INC_GAURD_NAME ${header_file} NAME_WE) - string(TOUPPER ${INC_GAURD_NAME} INC_GAURD_NAME) - set(include_guard "ROCM_CORE_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H") - #set #include statement - get_filename_component(file_name ${header_file} NAME) - set(include_statements "#include \"${headerfile_dir}/${file_name}\"\n") - set_file_contents(${header_file}) - endforeach() - -endfunction() - -#Use template header file and generater wrapper header files -generate_wrapper_header() -install(DIRECTORY ${ROCM_CORE_WRAPPER_INC_DIR} DESTINATION . COMPONENT runtime) - diff --git a/utils.cmake b/utils.cmake index f9fb2fd319..42c075b30a 100644 --- a/utils.cmake +++ b/utils.cmake @@ -169,4 +169,85 @@ function( set_variables ) endfunction() +## Configure Copyright File for Debian Package +function( configure_debian_pkg PACKAGE_NAME_T COMPONENT_NAME_T PACKAGE_VERSION_T MAINTAINER_NM_T MAINTAINER_EMAIL_T) + # Check If Debian Platform + find_file (DEBIAN debian_version debconf.conf PATHS /etc) + if(DEBIAN) + set_debian_pkg_cmake_flags( ${PACKAGE_NAME_T} ${PACKAGE_VERSION_T} + ${MAINTAINER_NM_T} ${MAINTAINER_EMAIL_T} ) + # Create debian directory in build tree + file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/DEBIAN") + + # Configure the copyright file + configure_file( + "${CMAKE_SOURCE_DIR}/DEBIAN/copyright.in" + "${CMAKE_BINARY_DIR}/DEBIAN/copyright" + @ONLY + ) + + # Install copyright file + install ( FILES "${CMAKE_BINARY_DIR}/DEBIAN/copyright" + DESTINATION "${CMAKE_INSTALL_DOCDIR}" + COMPONENT ${COMPONENT_NAME_T} ) + + # Configure the changelog file + configure_file( + "${CMAKE_SOURCE_DIR}/DEBIAN/changelog.in" + "${CMAKE_BINARY_DIR}/DEBIAN/changelog.Debian" + @ONLY + ) + + # Install Change Log + find_program ( DEB_GZIP_EXEC gzip ) + if(EXISTS "${CMAKE_BINARY_DIR}/DEBIAN/changelog.Debian" ) + execute_process( + COMMAND ${DEB_GZIP_EXEC} -9 "${CMAKE_BINARY_DIR}/DEBIAN/changelog.Debian" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/DEBIAN" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE error + ) + if(NOT ${result} EQUAL 0) + message(FATAL_ERROR "Failed to compress: ${error}") + endif() + install ( FILES "${CMAKE_BINARY_DIR}/DEBIAN/${DEB_CHANGELOG_INSTALL_FILENM}" + DESTINATION ${CMAKE_INSTALL_DOCDIR} + COMPONENT ${COMPONENT_NAME_T}) + endif() + else() + message( STATUS "Ignore Configuring Debian Specific Packaging Configuration" ) + endif() +endfunction() + +# Set variables for changelog and copyright +# For Debian specific Packages +function( set_debian_pkg_cmake_flags DEB_PACKAGE_NAME_T DEB_PACKAGE_VERSION_T DEB_MAINTAINER_NM_T DEB_MAINTAINER_EMAIL_T ) + # Setting configure flags + set( DEB_PACKAGE_NAME "${DEB_PACKAGE_NAME_T}" CACHE STRING "Debian Package Name" ) + set( DEB_PACKAGE_VERSION "${DEB_PACKAGE_VERSION_T}" CACHE STRING "Debian Package Version String" ) + set( DEB_MAINTAINER_NAME "${DEB_MAINTAINER_NM_T}" CACHE STRING "Debian Package Maintainer Name" ) + set( DEB_MAINTAINER_EMAIL "${DEB_MAINTAINER_EMAIL_T}" CACHE STRING "Debian Package Maintainer Email" ) + set( DEB_COPYRIGHT_YEAR "2025" CACHE STRING "Debian Package Copyright Year" ) + set( DEB_LICENSE "MIT" CACHE STRING "Debian Package License Type" ) + set( DEB_CHANGELOG_INSTALL_FILENM "changelog.Debian.gz" CACHE STRING "Debian Package ChangeLog File Name" ) + + # Get TimeStamp + find_program( DEB_DATE_TIMESTAMP_EXEC date ) + set ( DEB_TIMESTAMP_FORMAT_OPTION "-R" ) + execute_process ( + COMMAND ${DEB_DATE_TIMESTAMP_EXEC} ${DEB_TIMESTAMP_FORMAT_OPTION} + OUTPUT_VARIABLE TIMESTAMP_T + ) + set( DEB_TIMESTAMP "${TIMESTAMP_T}" CACHE STRING "Current Time Stamp for Copyright/Changelog" ) + + message(STATUS "DEB_PACKAGE_NAME : ${DEB_PACKAGE_NAME}" ) + message(STATUS "DEB_PACKAGE_VERSION : ${DEB_PACKAGE_VERSION}" ) + message(STATUS "DEB_MAINTAINER_NAME : ${DEB_MAINTAINER_NAME}" ) + message(STATUS "DEB_MAINTAINER_EMAIL : ${DEB_MAINTAINER_EMAIL}" ) + message(STATUS "DEB_COPYRIGHT_YEAR : ${DEB_COPYRIGHT_YEAR}" ) + message(STATUS "DEB_LICENSE : ${DEB_LICENSE}" ) + message(STATUS "DEB_TIMESTAMP : ${DEB_TIMESTAMP}" ) + message(STATUS "DEB_CHANGELOG_INSTALL_FILENM : ${DEB_CHANGELOG_INSTALL_FILENM}" ) +endfunction()