From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Mon, 19 Aug 2013 13:22:46 +0200
Subject: [PATCH] gentoo install fixes

---
 Makefile.config.in                      | 6 +++---
 Makefile.rules                          | 6 +++---
 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(+), 10 deletions(-)

diff --git a/Makefile.config.in b/Makefile.config.in
index dcca45f..e75ae2e 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)
 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 e53598b..217f754 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
   BuildMode := Release
   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
   ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
-    OmitFramePointer := -fomit-frame-pointer
+    OmitFramePointer :=
   endif
 
   CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
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,4 @@
 #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
 #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
 #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+#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,8 @@ $(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_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 3924e2e..f439c60 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;
     ActiveIncludeOption = "-I" + ActiveIncludeDir;
   }
 
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.4.2

