diff options
Diffstat (limited to 'dev-libs/roct-thunk-interface/files')
-rw-r--r-- | dev-libs/roct-thunk-interface/files/roct-thunk-interface-2.0.0-correctly-install.patch | 288 |
1 files changed, 288 insertions, 0 deletions
diff --git a/dev-libs/roct-thunk-interface/files/roct-thunk-interface-2.0.0-correctly-install.patch b/dev-libs/roct-thunk-interface/files/roct-thunk-interface-2.0.0-correctly-install.patch new file mode 100644 index 000000000000..8248c5f4b367 --- /dev/null +++ b/dev-libs/roct-thunk-interface/files/roct-thunk-interface-2.0.0-correctly-install.patch @@ -0,0 +1,288 @@ +https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/pull/25 +From c60501d7e69db24f5d880aace73662384ea90b27 Mon Sep 17 00:00:00 2001 +From: Andreas Schneider <asn@cryptomilk.org> +Date: Fri, 7 Sep 2018 10:30:05 +0200 +Subject: [PATCH 1/7] cmake: Do not mess with CMAKE_C_FLAGS + +--- + CMakeLists.txt | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cb2605b..8a0f362 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -59,15 +59,9 @@ set ( BUILD_VERSION_STRING "${BUILD_VERSION_MAJOR}.${BUILD_VERSION_MINOR}.${BUIL + #set ( CMAKE_VERBOSE_MAKEFILE on ) + + ## Compiler flags +-set ( CMAKE_C_FLAGS "-fPIC -W -Wall -Wextra -Wno-unused-parameter -Wformat-security -Wswitch-default -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wlogical-op -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wunreachable-code -std=gnu99 -fvisibility=hidden" ) ++set (HSAKMT_C_FLAGS -fPIC -W -Wall -Wextra -Wno-unused-parameter -Wformat-security -Wswitch-default -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wlogical-op -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wunreachable-code -std=gnu99 -fvisibility=hidden) + if ( "${CMAKE_C_COMPILER_VERSION}" STRGREATER "4.8.0") +- set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror" ) +-endif () +- +-if ( "${CMAKE_BUILD_TYPE}" STREQUAL Release ) +- set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2" ) +-else () +- set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" ) ++ set (HSAKMT_C_FLAGS ${HSAKMT_C_FLAGS} -Werror) + endif () + + set ( HSAKMT_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/src/libhsakmt.ver" ) +@@ -96,6 +90,7 @@ include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/src ) + + ## Add the library + add_library ( ${HSAKMT_TARGET} SHARED ${HSAKMT_SRC} ) ++target_compile_options(${HSAKMT_TARGET} PRIVATE ${HSAKMT_C_FLAGS}) + + ## Set the VERSION and SOVERSION values + set_property ( TARGET ${HSAKMT_TARGET} PROPERTY VERSION "${LIB_VERSION_STRING}" ) + +From d37b3e2e634a40192c113d9a8256f3d2aa24acfa Mon Sep 17 00:00:00 2001 +From: Andreas Schneider <asn@cryptomilk.org> +Date: Fri, 7 Sep 2018 10:31:59 +0200 +Subject: [PATCH 2/7] cmake: Do not mess with CMAKE_SHARED_LINKER_FLAGS + +--- + CMakeLists.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8a0f362..a2a36cd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -67,7 +67,7 @@ endif () + set ( HSAKMT_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/src/libhsakmt.ver" ) + + ## Linker Flags +-set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=${HSAKMT_LINKER_SCRIPT} -Wl,-soname=${HSAKMT_COMPONENT}.so.$(PROJECT_VERSION_MAJOR) -Wl,-z,nodelete -Wl,-no-undefined" ) ++set (HSAKMT_LINK_FLAGS "-Wl,--version-script=${HSAKMT_LINKER_SCRIPT} -Wl,-soname=${HSAKMT_COMPONENT}.so.$(PROJECT_VERSION_MAJOR) -Wl,-z,nodelete -Wl,-no-undefined" ) + + ## Source files + set ( HSAKMT_SRC "src/debug.c" +@@ -91,6 +91,7 @@ include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/src ) + ## Add the library + add_library ( ${HSAKMT_TARGET} SHARED ${HSAKMT_SRC} ) + target_compile_options(${HSAKMT_TARGET} PRIVATE ${HSAKMT_C_FLAGS}) ++set_property(TARGET ${HSAKMT_TARGET} PROPERTY LINK_FLAGS ${HSAKMT_LINK_FLAGS}) + + ## Set the VERSION and SOVERSION values + set_property ( TARGET ${HSAKMT_TARGET} PROPERTY VERSION "${LIB_VERSION_STRING}" ) + +From 7f9ad94a9932319930f96d49a78fa9e741cd7292 Mon Sep 17 00:00:00 2001 +From: Andreas Schneider <asn@cryptomilk.org> +Date: Fri, 7 Sep 2018 10:41:04 +0200 +Subject: [PATCH 3/7] cmake: Use GNUInstallDirs for installtion + +This will allow distributions to install it correctly. +--- + CMakeLists.txt | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a2a36cd..58076fa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -111,8 +111,9 @@ endif () + + ## Define default variable and variables for the optional build target hsakmt-dev + set ( SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Location of hsakmt source code." ) +-set ( CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE STRING "Default installation directory." ) +-set ( CPACK_PACKAGING_INSTALL_PREFIX "/opt/rocm" CACHE STRING "Default packaging prefix." ) ++set ( HSAKMT_INSTALL_PREFIX "/opt/rocm" CACHE STRING "Default installation directory." ) ++set ( HSAKMT_INSTALL_LIBDIR "hsakmt/lib" CACHE STRING "Default installation directory." ) ++set ( HSAKMT_PACKAGING_INSTALL_PREFIX "/opt/rocm" CACHE STRING "Default packaging prefix." ) + set ( CPACK_GENERATOR "DEB;RPM" CACHE STRING "Default packaging generators." ) + + ## Specify build, install and package targets hsakmt-dev +@@ -121,9 +122,12 @@ configure_file ( hsakmt-dev.txt ${DEV_BUILD_DIR}/CMakeLists.txt @ONLY ) + add_custom_target ( build-dev + COMMAND ${CMAKE_COMMAND} + -DSOURCE_DIR="${SOURCE_DIR}" +- -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" ++ -DCMAKE_INSTALL_PREFIX="${HSAKMT_INSTALL_PREFIX}" ++ -DCMAKE_INSTALL_LIBDIR="${HSAKMT_INSTALL_LIBDIR}" + -DCPACK_RPM_PACKAGE_REQUIRES="hsakmt-roct" +- -DCPACK_PACKAGING_INSTALL_PREFIX="${CPACK_PACKAGING_INSTALL_PREFIX}" ++ -DCPACK_PACKAGING_INSTALL_PREFIX="${HSAKMT_PACKAGING_INSTALL_PREFIX}" ++ COMMAND rm -rf *.deb *.rpm *.tar.gz ++ COMMAND make package + WORKING_DIRECTORY ${DEV_BUILD_DIR} ) + + ## Custom targets for the devel package +@@ -135,7 +139,6 @@ add_custom_target ( package-dev DEPENDS build-dev + + ## Add the install directives for the runtime library. + install ( TARGETS ${HSAKMT_TARGET} DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +-install ( FILES ${SOURCE_DIR}/LICENSE.md DESTINATION libhsakmt ) + + ## Add the packaging directives for the runtime library. + set ( CPACK_PACKAGE_NAME ${HSAKMT_PACKAGE} ) + +From d3f841cf2c504c7af9735d27d4f4b9784754708d Mon Sep 17 00:00:00 2001 +From: Andreas Schneider <asn@cryptomilk.org> +Date: Fri, 7 Sep 2018 11:10:52 +0200 +Subject: [PATCH 4/7] cmake: Install header files + +--- + CMakeLists.txt | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 58076fa..81ec134 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -140,6 +140,14 @@ add_custom_target ( package-dev DEPENDS build-dev + ## Add the install directives for the runtime library. + install ( TARGETS ${HSAKMT_TARGET} DESTINATION ${CMAKE_INSTALL_LIBDIR} ) + ++install(FILES ++ include/hsakmt.h ++ include/hsakmttypes.h ++ DESTINATION ++ ${CMAKE_INSTALL_INCLUDEDIR}/libhsakmt ++ COMPONENT ++ ${HSAKMT_COMPONENT}-header) ++ + ## Add the packaging directives for the runtime library. + set ( CPACK_PACKAGE_NAME ${HSAKMT_PACKAGE} ) + set ( CPACK_PACKAGE_VENDOR "AMD" ) + +From 66e43bab21ee2a8ba1eed59e6a5052eb2f0fc1b8 Mon Sep 17 00:00:00 2001 +From: Andreas Schneider <asn@cryptomilk.org> +Date: Fri, 7 Sep 2018 10:43:26 +0200 +Subject: [PATCH 5/7] cmake: Install the pkgconfig file + +--- + CMakeLists.txt | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 81ec134..5482e02 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -169,5 +169,11 @@ set ( CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/RPM/rpm_ + + # CPACK_PACKAGING_INSTALL_PREFIX is needed in libhsakmt.pc.in + configure_file ( libhsakmt.pc.in ${DEV_BUILD_DIR}/libhsakmt.pc @ONLY ) ++install(FILES ++ ${DEV_BUILD_DIR}/libhsakmt.pc ++ DESTINATION ++ ${CMAKE_INSTALL_LIBDIR}/pkgconfig ++ COMPONENT ++ ${HSAKMT_COMPONENT}-pkgconfig) + + include ( CPack ) + +From 5f1ed605a484e30c51954817b6d8712ab4c6046e Mon Sep 17 00:00:00 2001 +From: Andreas Schneider <asn@cryptomilk.org> +Date: Tue, 25 Sep 2018 18:47:57 +0200 +Subject: [PATCH 6/7] cmake: Do not strip targets in the release build + +Distributions want to generate debuginfo packages, do not strip them! If +you want to do it during installation use 'make install/strip'! +--- + CMakeLists.txt | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5482e02..f8f58cd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -104,11 +104,6 @@ target_link_libraries ( ${HSAKMT_TARGET} + pthread rt numa ${PC_LIBPCI_LIBRARIES} + ) + +-## If the library is a release, strip the target library +-if ( "${CMAKE_BUILD_TYPE}" STREQUAL Release ) +- add_custom_command ( TARGET ${HSAKMT_TARGET} POST_BUILD COMMAND ${CMAKE_STRIP} ${HSAKMT_COMPONENT}.so ) +-endif () +- + ## Define default variable and variables for the optional build target hsakmt-dev + set ( SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Location of hsakmt source code." ) + set ( HSAKMT_INSTALL_PREFIX "/opt/rocm" CACHE STRING "Default installation directory." ) + +From 86b29b265c1a91d2bc931453e4edac66a6d9da0d Mon Sep 17 00:00:00 2001 +From: Andreas Schneider <asn@cryptomilk.org> +Date: Tue, 25 Sep 2018 19:16:43 +0200 +Subject: [PATCH 7/7] cmake: Create cmake config file + +Another cmake project like hsa-runtime could just use: + +find_package(hsakmt REQUIRED 1.9.0) +--- + CMakeLists.txt | 31 ++++++++++++++++++++++++++++++- + hsakmt-config.cmake.in | 9 +++++++++ + 2 files changed, 39 insertions(+), 1 deletion(-) + create mode 100644 hsakmt-config.cmake.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f8f58cd..6e5a0fe 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -30,7 +30,7 @@ set ( HSAKMT_PACKAGE "hsakmt-roct" ) + set ( HSAKMT_COMPONENT "lib${HSAKMT}" ) + set ( HSAKMT_TARGET "${HSAKMT}" ) + +-project ( ${HSAKMT_TARGET} ) ++project ( ${HSAKMT_TARGET} VERSION 1.9.0) + + ## Set default module path if not already set + if ( NOT DEFINED CMAKE_MODULE_PATH ) +@@ -44,6 +44,8 @@ include ( GNUInstallDirs ) + ## Setup the package version. + get_version ( "1.0.0" ) + ++# FIXME: The library version should not be tied to the project version! ++# There are rules how to bump version numbers for libraries. + set ( BUILD_VERSION_MAJOR ${VERSION_MAJOR} ) + set ( BUILD_VERSION_MINOR ${VERSION_MINOR} ) + set ( BUILD_VERSION_PATCH ${VERSION_PATCH} ) +@@ -171,4 +173,31 @@ install(FILES + COMPONENT + ${HSAKMT_COMPONENT}-pkgconfig) + ++# Create cmake configuration files ++include(CMakePackageConfigHelpers) ++ ++set(HSAKMT_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) ++ ++set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} CACHE INTERNAL "") ++set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE INTERNAL "") ++ ++configure_package_config_file(${PROJECT_NAME}-config.cmake.in ++ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake ++ PATH_VARS ++ INCLUDE_INSTALL_DIR LIB_INSTALL_DIR ++ INSTALL_DESTINATION ++ ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) ++ ++write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake ++ COMPATIBILITY ++ AnyNewerVersion) ++ ++install(FILES ++ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake ++ DESTINATION ++ ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ++ COMPONENT ++ devel) ++ + include ( CPack ) +diff --git a/hsakmt-config.cmake.in b/hsakmt-config.cmake.in +new file mode 100644 +index 0000000..e6bad17 +--- /dev/null ++++ b/hsakmt-config.cmake.in +@@ -0,0 +1,9 @@ ++@PACKAGE_INIT@ ++ ++set_and_check(HSAKMT_INCLUDE_DIR @PACKAGE_LIB_INSTALL_DIR@) ++set_and_check(HSAKMT_LIB_DIR @PACKAGE_LIB_INSTALL_DIR@) ++ ++set(HSAKMT_LIBRARY @PACKAGE_LIB_INSTALL_DIR@/@HSAKMT_LIBRARY_NAME@) ++set(HSAKMT_LIBRARIES @PACKAGE_LIB_INSTALL_DIR@/@HSAKMT_LIBRARY_NAME@) ++ ++mark_as_advanced(HSAKMT_LIBRARY HSAKMT_INCLUDE_DIR) |