commit:     c0aa27dab035db39ddc15bc22c0aba651513fead
Author:     Craig Andrews <candrews <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 31 15:53:28 2019 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Wed Aug  7 17:38:46 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0aa27da

dev-libs/rocm-comgr: Radeon Open Compute Code Object Manager

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>

 dev-libs/rocm-comgr/Manifest                       |  1 +
 .../files/rocm-comgr-2.6.0-correctly-install.patch | 44 +++++++++++++++
 .../files/rocm-comgr-2.6.0-dependencies.patch      | 63 ++++++++++++++++++++++
 .../files/rocm-comgr-2.6.0-find-clang.patch        | 26 +++++++++
 .../files/rocm-comgr-2.6.0-find-lld-includes.patch | 43 +++++++++++++++
 dev-libs/rocm-comgr/metadata.xml                   | 14 +++++
 dev-libs/rocm-comgr/rocm-comgr-2.6.0.ebuild        | 45 ++++++++++++++++
 7 files changed, 236 insertions(+)

diff --git a/dev-libs/rocm-comgr/Manifest b/dev-libs/rocm-comgr/Manifest
new file mode 100644
index 00000000000..8e7150e7fd2
--- /dev/null
+++ b/dev-libs/rocm-comgr/Manifest
@@ -0,0 +1 @@
+DIST rocm-comgr-2.6.0.tar.gz 1484343 BLAKE2B 
fcb496b4997d672640e3f75622e74085eeb9dfe83c88ae025530389d3cdca7628155168060e71f7a3ff915e933ffe70c7026720dc124d128d16ef4df397525e7
 SHA512 
b14e90603d2b6e17f6b0335ea35da2e5d7e31710f301d7a7f7751a45d996e3dbbfbf84a03e2e911e8798e72e77b87b5cd88317e897cb4de3ee5cf0e7c3222d68

diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-correctly-install.patch 
b/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-correctly-install.patch
new file mode 100644
index 00000000000..74206760f39
--- /dev/null
+++ b/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-correctly-install.patch
@@ -0,0 +1,44 @@
+From 98f589636729b1e25625db6880fbd7820dcf9e40 Mon Sep 17 00:00:00 2001
+From: Craig Andrews <candr...@integralblue.com>
+Date: Wed, 31 Jul 2019 10:04:11 -0400
+Subject: [PATCH] Install to standard locations using GNUInstallDirs
+
+Some distributions require 64 bit libraries to be installed to lib64, for 
example.
+Using GNUInstallDirs ensures that files are installed to the expected 
locations.
+---
+ CMakeLists.txt | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 454b830..a89af16 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,5 +1,7 @@
+ cmake_minimum_required(VERSION 3.2.0)
+ 
++include (GNUInstallDirs)
++
+ # Build ROCM-Compiler-Support with ccache if the package is present.
+ set(ROCM_COMPILER_SUPPORT_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache 
enabled build")
+ if(ROCM_COMPILER_SUPPORT_CCACHE_BUILD)
+@@ -146,17 +148,17 @@ configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in"
+ 
+ install(TARGETS amd_comgr
+   EXPORT amd_comgr_export
+-  DESTINATION lib)
++  DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ 
+ install(FILES
+   "include/amd_comgr.h"
+-  DESTINATION include)
++  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ 
+ install(FILES
+   "README.md"
+   "LICENSE.txt"
+   "NOTICES.txt"
+-  DESTINATION share/amd_comgr)
++  DESTINATION ${CMAKE_INSTALL_DATADIR}/amd_comgr)
+ 
+ # Generate the install-tree package.
+ set(AMD_COMGR_PREFIX_CODE "

diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-dependencies.patch 
b/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-dependencies.patch
new file mode 100644
index 00000000000..47f03716829
--- /dev/null
+++ b/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-dependencies.patch
@@ -0,0 +1,63 @@
+https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/pull/19
+
+--- comgr/CMakeLists.old       2019-07-19 17:19:26.080276421 +0200
++++ comgr/CMakeLists.txt       2019-07-19 18:17:25.780163592 +0200
+@@ -185,7 +185,11 @@
+ include_directories(./yaml-cpp/include)
+ 
+ set(CLANG_LIBS
+-  clangFrontendTool)
++  clangFrontendTool
++  clangFrontend
++  clangBasic
++  clangDriver
++  clangSerialization)
+ 
+ set(LLD_LIBS
+   lldELF
+@@ -193,8 +197,19 @@
+ 
+ llvm_map_components_to_libnames(LLVM_LIBS
+   ${LLVM_TARGETS_TO_BUILD}
++  Option
+   DebugInfoDWARF
+-  Symbolize)
++  Symbolize
++  Support
++  Object
++  BitWriter
++  MC
++  MCParser
++  MCDisassembler
++  Core
++  IRReader
++  CodeGen
++  Linker)
+ 
+ target_link_libraries(amd_comgr
+   PUBLIC
+@@ -203,8 +218,8 @@
+     ${AMD_COMGR_PRIVATE_LINKER_OPTIONS}
+     yaml-cpp
+     ${CLANG_LIBS}
+-    ${LLD_LIBS}
+     ${LLVM_LIBS}
++    ${LLD_LIBS}
+ )
+ 
+ if (NOT UNIX)
+@@ -238,3 +253,14 @@
+ if (NOT CPack_CMake_INCLUDED)
+   include(CPack)
+ endif()
++
++MESSAGE(STATUS "<<< Gentoo configuration >>>
++Build type      ${CMAKE_BUILD_TYPE}
++Install path    ${CMAKE_INSTALL_PREFIX}
++Compiler flags:
++C               ${CMAKE_C_FLAGS}
++C++             ${CMAKE_CXX_FLAGS}
++Linker flags:
++Executable      ${CMAKE_EXE_LINKER_FLAGS}
++Module          ${CMAKE_MODULE_LINKER_FLAGS}
++Shared          ${CMAKE_SHARED_LINKER_FLAGS}\n")

diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-find-clang.patch 
b/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-find-clang.patch
new file mode 100644
index 00000000000..dda005ab7a2
--- /dev/null
+++ b/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-find-clang.patch
@@ -0,0 +1,26 @@
+https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/pull/16
+
+From 09eb70afa22e2d6066a5f29888158c6005170ca6 Mon Sep 17 00:00:00 2001
+From: Craig Andrews <candr...@integralblue.com>
+Date: Wed, 31 Jul 2019 10:13:30 -0400
+Subject: [PATCH] Find Clang avoiding the system (non-ROC) LLVM
+
+Use NO_DEFAULT_PATH to avoid finding the system (non-ROC) LLVM.
+Use /opt/rocm/llvm as an additional hint to be consistent with the build 
systems of other ROC projects (such as ROCm-OpenCL-Driver)
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 454b830..8642c98 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -13,7 +13,7 @@ endif()
+ 
+ project(code_object_manager)
+ 
+-find_package(Clang REQUIRED CONFIG)
++find_package(Clang REQUIRED CONFIG PATHS ${LLVM_DIR} "/opt/rocm/llvm" 
NO_DEFAULT_PATH)
+ add_definitions(${LLVM_DEFINITIONS})
+ include_directories(${LLVM_INCLUDE_DIRS})
+ link_directories(${LLVM_LIBRARY_DIRS})

diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-find-lld-includes.patch 
b/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-find-lld-includes.patch
new file mode 100644
index 00000000000..5b44feaf1b3
--- /dev/null
+++ b/dev-libs/rocm-comgr/files/rocm-comgr-2.6.0-find-lld-includes.patch
@@ -0,0 +1,43 @@
+https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/pull/17
+
+From 4588c1a5aad3edae9d3e121685d8d1f5fddd54ba Mon Sep 17 00:00:00 2001
+From: Craig Andrews <candr...@integralblue.com>
+Date: Wed, 31 Jul 2019 10:45:01 -0400
+Subject: [PATCH] Find lld includes in LLVM_INCLUDE_DIRS
+
+Allows building against an LLVM build tree
+---
+ CMakeLists.txt | 20 ++------------------
+ 1 file changed, 2 insertions(+), 18 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 454b830..db28533 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -19,24 +19,8 @@ include_directories(${LLVM_INCLUDE_DIRS})
+ link_directories(${LLVM_LIBRARY_DIRS})
+ include_directories(${CLANG_INCLUDE_DIRS})
+ 
+-# FIXME: There is no way to directly determine the include paths for LLD when
+-# working with an LLVM build tree, but we want to avoid having to install LLVM
+-# to build Comgr. This should eventually be fixed in usptream LLD so this can
+-# be removed.
+-if(DEFINED LLVM_BUILD_MAIN_SRC_DIR)
+-  set(INTERNAL_LLD_INCLUDE_DIRS 
"${LLVM_BUILD_MAIN_SRC_DIR}/tools/lld/include")
+-  set(EXTERNAL_LLD_INCLUDE_DIRS "${LLVM_BUILD_MAIN_SRC_DIR}/../lld/include")
+-  if (EXISTS "${INTERNAL_LLD_INCLUDE_DIRS}"
+-      AND IS_DIRECTORY "${INTERNAL_LLD_INCLUDE_DIRS}")
+-    set(LLD_INCLUDE_DIRS "${INTERNAL_LLD_INCLUDE_DIRS}")
+-  elseif (EXISTS "${EXTERNAL_LLD_INCLUDE_DIRS}"
+-      AND IS_DIRECTORY "${EXTERNAL_LLD_INCLUDE_DIRS}")
+-    set(LLD_INCLUDE_DIRS "${EXTERNAL_LLD_INCLUDE_DIRS}")
+-  else()
+-    message(FATAL_ERROR "You are attempting to compile using an LLVM build 
tree, but the LLD include directory could not be located. The paths 
'${INTERNAL_LLD_INCLUDE_DIRS}' and '${EXTERNAL_LLD_INCLUDE_DIRS}' were tried.")
+-  endif()
+-  include_directories(${LLD_INCLUDE_DIRS})
+-endif()
++set(LLD_INCLUDE_DIRS "${LLVM_INCLUDE_DIRS}/lld")
++include_directories(${LLD_INCLUDE_DIRS})
+ 
+ find_package(AMDDeviceLibs CONFIG)
+ 

diff --git a/dev-libs/rocm-comgr/metadata.xml b/dev-libs/rocm-comgr/metadata.xml
new file mode 100644
index 00000000000..20237687f91
--- /dev/null
+++ b/dev-libs/rocm-comgr/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+    <maintainer type="person">
+        <email>candr...@gentoo.org</email>
+        <name>Craig Andrews</name>
+    </maintainer>
+    <upstream>
+        <remote-id 
type="github">RadeonOpenCompute/ROCm-CompilerSupport</remote-id>
+    </upstream>
+    <longdescription lang="en">
+        Radeon Open Compute Code Object Manager
+    </longdescription>
+</pkgmetadata>

diff --git a/dev-libs/rocm-comgr/rocm-comgr-2.6.0.ebuild 
b/dev-libs/rocm-comgr/rocm-comgr-2.6.0.ebuild
new file mode 100644
index 00000000000..0f058da194b
--- /dev/null
+++ b/dev-libs/rocm-comgr/rocm-comgr-2.6.0.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake-utils
+
+if [[ ${PV} == *9999 ]] ; then
+       
EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/";
+       inherit git-r3
+       S="${WORKDIR}/${P}/lib/comgr"
+else
+       
SRC_URI="https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/archive/roc-${PV}.tar.gz
 -> ${P}.tar.gz"
+       S="${WORKDIR}/ROCm-CompilerSupport-roc-${PV}/lib/comgr"
+       KEYWORDS="~amd64"
+fi
+PATCHES=(
+       "${FILESDIR}/${P}-correctly-install.patch"
+       "${FILESDIR}/${P}-find-clang.patch"
+       "${FILESDIR}/${P}-find-lld-includes.patch"
+       "${FILESDIR}/${P}-dependencies.patch"
+)
+
+DESCRIPTION="Radeon Open Compute Code Object Manager"
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm-CompilerSupport";
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+
+RDEPEND="dev-libs/rocm-device-libs
+       dev-cpp/yaml-cpp
+       sys-devel/llvm-roc"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+#      rm -rf yaml-cpp || die
+       cmake-utils_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DLLVM_DIR="${EPREFIX}/usr/lib/llvm/roc/"
+               -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/"
+       )
+       cmake-utils_src_configure
+}

Reply via email to