summaryrefslogtreecommitdiff
blob: e477be505244b10b7ab1cde0f799d67059952fd3 (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
From 378109dbae7e4772d9b096384904c638a6a34028 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl>
Date: Fri, 19 Jul 2013 10:10:52 +0200
Subject: [PATCH 1/2] gentoo install fixes

---
 Makefile.config.in                      | 6 +++---
 Makefile.rules                          | 7 +++----
 tools/gold/Makefile                     | 2 +-
 tools/llvm-config/BuildVariables.inc.in | 2 ++
 tools/llvm-config/Makefile              | 4 ++++
 tools/llvm-config/llvm-config.cpp       | 5 +++--
 utils/FileCheck/Makefile                | 2 +-
 7 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/Makefile.config.in b/Makefile.config.in
index fd4f6ef..5634ecc 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
 endif
 
 PROJ_bindir     := $(PROJ_prefix)/bin
-PROJ_libdir     := $(PROJ_prefix)/lib
+PROJ_libdir     := $(PROJ_prefix)/$(GENTOO_LIBDIR)/llvm
 PROJ_datadir    := $(PROJ_prefix)/share
-PROJ_docsdir    := $(PROJ_prefix)/docs/llvm
-PROJ_etcdir     := $(PROJ_prefix)/etc/llvm
+PROJ_docsdir    := $(PROJ_prefix)/share/doc/@PF@
+PROJ_etcdir     := @EPREFIX@/etc/llvm
 PROJ_includedir := $(PROJ_prefix)/include
 PROJ_infodir    := $(PROJ_prefix)/info
 PROJ_mandir     := $(PROJ_prefix)/share/man
diff --git a/Makefile.rules b/Makefile.rules
index f0c542b..db252f7 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -276,7 +276,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
   ifneq ($(HOST_OS),FreeBSD)
   ifneq ($(HOST_OS),Darwin)
-    OmitFramePointer := -fomit-frame-pointer
+    OmitFramePointer :=
   endif
   endif
 
@@ -639,7 +638,7 @@ endif
 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
   ifneq ($(HOST_OS), Darwin)
     ifdef TOOLNAME
-      LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
+      LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' $(RPATH) -Wl,'$(PROJ_libdir)'
       ifdef EXAMPLE_TOOL
         LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
       else
@@ -648,7 +647,7 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
   endif
 else
   ifneq ($(DARWIN_MAJVERS),4)
-    LD.Flags += $(RPATH) -Wl,@executable_path/../lib
+    LD.Flags += $(RPATH) -Wl,@executable_path/../lib -Wl,'$(PROJ_libdir)'
   endif
   ifeq ($(RC_XBS),YES)
     TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
diff --git a/tools/gold/Makefile b/tools/gold/Makefile
index 496e31c..d36b340 100644
--- a/tools/gold/Makefile
+++ b/tools/gold/Makefile
@@ -24,7 +24,7 @@ include $(LEVEL)/Makefile.config
 # Because off_t is used in the public API, the largefile parts are required for
 # ABI compatibility.
 CXXFLAGS += -I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-LDFLAGS += -L$(SharedLibDir)/$(SharedPrefix)
+LDFLAGS += -L$(PROJ_libdir)
 
 include $(LEVEL)/Makefile.common
 
diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
index fe87afb..fd9f2c6 100644
--- a/tools/llvm-config/BuildVariables.inc.in
+++ b/tools/llvm-config/BuildVariables.inc.in
@@ -25,3 +25,5 @@
 #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
 #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
 #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+#define LLVM_RPATH "@LLVM_RPATH@"
+#define LLVM_LIBDIR "@LLVM_LIBDIR@"
diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
index b20b6bf..fc56781 100644
--- a/tools/llvm-config/Makefile
+++ b/tools/llvm-config/Makefile
@@ -55,6 +55,10 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
 	  >> temp.sed
 	$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
 	  >> temp.sed
+	$(Verb) $(ECHO) 's/@LLVM_RPATH@/$(subst /,\/,$(RPATH))/' \
+	  >> temp.sed
+	$(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
+	  >> temp.sed
 	$(Verb) $(SED) -f temp.sed < $< > $@
 	$(Verb) $(RM) temp.sed
 
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 7edf5ec..4541c28 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
     ActivePrefix = CurrentExecPrefix;
     ActiveIncludeDir = ActivePrefix + "/include";
     ActiveBinDir = ActivePrefix + "/bin";
-    ActiveLibDir = ActivePrefix + "/lib";
+    ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR "/llvm";
     ActiveIncludeOption = "-I" + ActiveIncludeDir;
   }
 
@@ -277,7 +277,8 @@ int main(int argc, char **argv) {
       } else if (Arg == "--cxxflags") {
         OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n';
       } else if (Arg == "--ldflags") {
-        OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS
+        OS << "-L" << ActiveLibDir << ' '
+           << LLVM_RPATH << " -Wl," << ActiveLibDir << ' ' << LLVM_LDFLAGS
            << ' ' << LLVM_SYSTEM_LIBS << '\n';
       } else if (Arg == "--libs") {
         PrintLibs = true;
diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile
index 268b7bc..e7674f9 100644
--- a/utils/FileCheck/Makefile
+++ b/utils/FileCheck/Makefile
@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a
 TOOL_NO_EXPORTS = 1
 
 # Don't install this utility
-NO_INSTALL = 1
+#NO_INSTALL = 1
 
 include $(LEVEL)/Makefile.common
 
-- 
1.8.3.2