1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
From 93133d777fd4c9d5e0f0cc563927f303f9527159 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sat, 20 Aug 2016 23:47:41 +0200
Subject: [PATCH] llvm-config: Clean up exported values, update for shared
linking
Gentoo-specific fixup for llvm-config, including:
- wiping build-specific CFLAGS, CXXFLAGS,
- updating library suffixes for shared libs,
- wiping --system-libs for shared linking,
- making --obj-root and --src-root return invalid path (/dev/null),
- making --build-mode return "Release" rather than "Gentoo".
Thanks to Steven Newbury for the initial patch.
Bug: https://bugs.gentoo.org/565358
Bug: https://bugs.gentoo.org/501684
---
tools/llvm-config/CMakeLists.txt | 11 ++++++++---
tools/llvm-config/llvm-config.cpp | 15 ++++++++++++---
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
index 744fa4e..593788a 100644
--- a/tools/llvm-config/CMakeLists.txt
+++ b/tools/llvm-config/CMakeLists.txt
@@ -34,4 +34,8 @@ set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
-set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
-set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
+# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler
+# specific flags will be set when we don't know what compiler will be used
+# with external project utilising llvm-config. C++ Standard is required.
+# TODO: figure out if we can remove -std=c++11 and move it to revdeps.
+set(LLVM_CFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
set(LLVM_BUILD_SYSTEM cmake)
@@ -48,3 +52,4 @@ set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
-set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
+# We don't do static libs, so we don't need to supply any system-libs
+set(LLVM_SYSTEM_LIBS "")
if(BUILD_SHARED_LIBS)
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index c63733f..ead11b9 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -524,3 +524,4 @@ int main(int argc, char **argv) {
} else if (Arg == "--build-mode") {
- OS << build_mode << '\n';
+ // force Release since we force non-standard Gentoo build mode
+ OS << "Release" << '\n';
} else if (Arg == "--assertion-mode") {
@@ -540,5 +540,9 @@ int main(int argc, char **argv) {
} else if (Arg == "--obj-root") {
OS << ActivePrefix << '\n';
} else if (Arg == "--src-root") {
- OS << LLVM_SRC_ROOT << '\n';
+ if (IsInDevelopmentTree) {
+ OS << LLVM_SRC_ROOT << '\n';
+ } else {
+ OS << "/dev/null\n";
+ }
} else if (Arg == "--link-shared") {
--
2.9.3
|