Install llvm utils

clang needs these to run the tests.
This commit is contained in:
Tom Stellard 2017-04-03 14:23:17 +00:00
parent 7a52d8c344
commit 383dd27625
3 changed files with 93 additions and 2 deletions

View File

@ -0,0 +1,44 @@
From 974c288631ef8d05bf3a3f91b32bf38eae16e5c8 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Mon, 6 Mar 2017 13:55:55 +0000
Subject: [PATCH] CMake: Add LLVM_UTILS_INSTALL_DIR option
This is like the LLVM_TOOLS_INSTALL_DIR option, but for the utils
that are installed when the LLVM_INSTALL_UTILS. This option
defaults to 'bin' to remain consistent with the current behavior, but
distros may want to install these to libexec/llvm.
---
CMakeLists.txt | 3 +++
cmake/modules/AddLLVM.cmake | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58ee3cf..f93405c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -281,6 +281,9 @@ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name
set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+set(LLVM_UTILS_INSTALL_DIR "bin" CACHE STRING "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to 'bin')")
+mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 7f7608c..0da8162 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -864,7 +864,7 @@ macro(add_llvm_utility name)
set_target_properties(${name} PROPERTIES FOLDER "Utils")
if( LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS )
install (TARGETS ${name}
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
COMPONENT ${name})
if (NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(install-${name}
--
2.9.3

View File

@ -0,0 +1,38 @@
From a46be0c0b5cb17d0e2eeb19a180c583df63ee766 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Mon, 6 Mar 2017 15:51:00 +0000
Subject: [PATCH] CMake: Don't install llvm-tblgen twice
Summary:
The add_tablegen macros defines its own install target, and it was also calling
add_llvm_utility which adds another install target.
Configuring with -DLLVM_TOOLS_INSTALL_DIR set to something other than
'bin' along with -DLLVM_INSTALL_UTILS=ON was causing llvm-tablgen
to be installed to two separate directories.
Reviewers: beanz, hans
Subscribers: llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D30656
---
cmake/modules/TableGen.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake
index 0c00bf5..da0858e 100644
--- a/cmake/modules/TableGen.cmake
+++ b/cmake/modules/TableGen.cmake
@@ -99,7 +99,7 @@ macro(add_tablegen target project)
set(LLVM_ENABLE_OBJLIB ON)
endif()
- add_llvm_utility(${target} ${ARGN})
+ add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS})
set(${project}_TABLEGEN "${target}" CACHE
--
2.9.3

View File

@ -5,9 +5,11 @@
%bcond_with gold %bcond_with gold
%endif %endif
%global llvm_bindir %{_libdir}/%{name}
Name: llvm Name: llvm
Version: 4.0.0 Version: 4.0.0
Release: 5%{?dist} Release: 6%{?dist}
Summary: The Low Level Virtual Machine Summary: The Low Level Virtual Machine
License: NCSA License: NCSA
@ -21,6 +23,8 @@ Patch2: rust-lang-llvm-pr67.patch
Patch3: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch Patch3: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch
Patch4: 0001-Revert-Revert-CMake-Move-sphinx-detection-into-AddSp.patch Patch4: 0001-Revert-Revert-CMake-Move-sphinx-detection-into-AddSp.patch
Patch5: 0001-CMake-Fix-docs-llvm-man-target-when-clang-llvm-is-in.patch Patch5: 0001-CMake-Fix-docs-llvm-man-target-when-clang-llvm-is-in.patch
Patch6: 0001-CMake-Add-LLVM_UTILS_INSTALL_DIR-option.patch
Patch7: 0001-CMake-Don-t-install-llvm-tblgen-twice.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: zlib-devel BuildRequires: zlib-devel
@ -126,7 +130,8 @@ cd _build
-DLLVM_BUILD_EXAMPLES:BOOL=OFF \ -DLLVM_BUILD_EXAMPLES:BOOL=OFF \
\ \
-DLLVM_INCLUDE_UTILS:BOOL=ON \ -DLLVM_INCLUDE_UTILS:BOOL=ON \
-DLLVM_INSTALL_UTILS:BOOL=OFF \ -DLLVM_INSTALL_UTILS:BOOL=ON \
-DLLVM_UTILS_INSTALL_DIR:PATH=%{llvm_bindir} \
\ \
-DLLVM_INCLUDE_DOCS:BOOL=ON \ -DLLVM_INCLUDE_DOCS:BOOL=ON \
-DLLVM_BUILD_DOCS:BOOL=ON \ -DLLVM_BUILD_DOCS:BOOL=ON \
@ -170,6 +175,7 @@ fi
%files %files
%{_bindir}/* %{_bindir}/*
%{llvm_bindir}
%{_mandir}/man1/*.1.* %{_mandir}/man1/*.1.*
%exclude %{_bindir}/llvm-config-%{__isa_bits} %exclude %{_bindir}/llvm-config-%{__isa_bits}
%exclude %{_mandir}/man1/llvm-config.1.* %exclude %{_mandir}/man1/llvm-config.1.*
@ -200,6 +206,9 @@ fi
%{_libdir}/cmake/llvm/LLVMStaticExports.cmake %{_libdir}/cmake/llvm/LLVMStaticExports.cmake
%changelog %changelog
* Thu Jun 15 2017 Tom Stellard <tstellar@redhat.com> - 4.0.0-6
- Install llvm utils
* Thu Jun 08 2017 Tom Stellard <tstellar@redhat.com> - 4.0.0-5 * Thu Jun 08 2017 Tom Stellard <tstellar@redhat.com> - 4.0.0-5
- Fix docs-llvm-man target - Fix docs-llvm-man target