Adjust LLVM/CLang to work with GCC4 in base, while still working

with ports GCC4 for arch which haven't switched yet.

With/ok jsg@.
This commit is contained in:
sthen 2010-06-12 12:15:08 +00:00
parent df231a2341
commit c40c2a56d2
4 changed files with 40 additions and 26 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.20 2010/04/29 16:37:09 jsg Exp $
# $OpenBSD: Makefile,v 1.21 2010/06/12 12:15:08 sthen Exp $
COMMENT = Low Level Virtual Machine (LLVM) compiler infrastructure
LLVM_V = 2.7
DISTNAME = llvm-${LLVM_V}
PKGNAME = ${DISTNAME}p0
CATEGORIES = devel
@ -64,10 +65,23 @@ CONFIGURE_ARGS = --enable-bindings=no \
MODGNU_CONFIG_GUESS_DIRS = ${WRKSRC}/autoconf
.include <bsd.own.mk>
.if ${COMPILER_VERSION} == "gcc3"
PATCH_LIST += patch-* gcc3-*
.endif
pre-configure:
@perl -pi -e s,-lpthread,-pthread,g ${WRKSRC}/configure
@${SUBST_CMD} ${WRKSRC}/tools/clang/tools/scan-build/scan-build
@ln -s ${MODPY_BIN} ${WRKDIR}/bin/python
.if ${COMPILER_VERSION:L} == "gcc3"
@perl -pi -e 's,-L/usr/lib/gcc-lib/,-L${LOCALBASE}/lib/gcc/,;' \
-e 's, "/4.2.1, "/4.2.4,;' \
${WRKSRC}/tools/clang/lib/Driver/Tools.cpp
@perl -pi -e 's,/usr/include/g\+\+,${LOCALBASE}/include/c++/4.2.4,' \
${WRKSRC}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
.endif
post-install:
@ln -s ${TRUEPREFIX}/libexec/clang-cc ${PREFIX}/bin

View File

@ -0,0 +1,16 @@
$OpenBSD: gcc3-tools_clang_lib_Driver_Tools_cpp,v 1.1 2010/06/12 12:15:08 sthen Exp $
--- tools/clang/lib/Driver/Tools.cpp.orig Sun Mar 7 05:46:18 2010
+++ tools/clang/lib/Driver/Tools.cpp Wed Apr 28 21:14:33 2010
@@ -2581,6 +2586,12 @@ void openbsd::Link::ConstructJob(Compilation &C, const
if (!Args.hasArg(options::OPT_nostdlib) &&
!Args.hasArg(options::OPT_nodefaultlibs)) {
+ if (D.CCCIsCXX) {
+ CmdArgs.push_back("-L/usr/local/lib");
+ CmdArgs.push_back("-lestdc++");
+ CmdArgs.push_back("-lm");
+ }
+
// FIXME: For some reason GCC passes -lgcc before adding
// the default system libraries. Just mimic this for now.
CmdArgs.push_back("-lgcc");

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.4 2010/04/29 16:37:09 jsg Exp $
--- tools/clang/lib/Driver/Tools.cpp.orig Sun Mar 7 05:46:18 2010
+++ tools/clang/lib/Driver/Tools.cpp Wed Apr 28 21:14:33 2010
$OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.5 2010/06/12 12:15:08 sthen Exp $
--- tools/clang/lib/Driver/Tools.cpp.orig Sun Mar 7 04:46:18 2010
+++ tools/clang/lib/Driver/Tools.cpp Thu Jun 10 16:12:25 2010
@@ -576,6 +576,11 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
CPUName = "core2";
else if (getToolChain().getArchName() == "i386")
@ -13,27 +13,12 @@ $OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.4 2010/04/29 16:37:09 jsg E
} else {
if (getToolChain().getArchName() == "x86_64")
CPUName = "x86-64";
@@ -2550,8 +2555,8 @@ void openbsd::Link::ConstructJob(Compilation &C, const
std::string Triple = getToolChain().getTripleString();
@@ -2551,7 +2556,7 @@ void openbsd::Link::ConstructJob(Compilation &C, const
if (Triple.substr(0, 6) == "x86_64")
Triple.replace(0, 6, "amd64");
- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc-lib/" + Triple +
CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc-lib/" + Triple +
- "/3.3.5"));
+ CmdArgs.push_back(Args.MakeArgString("-L/usr/local/lib/gcc/" + Triple +
+ "/4.2.4"));
+ "/4.2.1"));
Args.AddAllArgs(CmdArgs, options::OPT_L);
Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
@@ -2576,6 +2581,12 @@ void openbsd::Link::ConstructJob(Compilation &C, const
if (!Args.hasArg(options::OPT_nostdlib) &&
!Args.hasArg(options::OPT_nodefaultlibs)) {
+ if (D.CCCIsCXX) {
+ CmdArgs.push_back("-L/usr/local/lib");
+ CmdArgs.push_back("-lestdc++");
+ CmdArgs.push_back("-lm");
+ }
+
// FIXME: For some reason GCC passes -lgcc before adding
// the default system libraries. Just mimic this for now.
CmdArgs.push_back("-lgcc");

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-tools_clang_lib_Frontend_InitHeaderSearch_cpp,v 1.1 2010/04/29 16:37:09 jsg Exp $
$OpenBSD: patch-tools_clang_lib_Frontend_InitHeaderSearch_cpp,v 1.2 2010/06/12 12:15:08 sthen Exp $
--- tools/clang/lib/Frontend/InitHeaderSearch.cpp.orig Sat Mar 6 20:38:10 2010
+++ tools/clang/lib/Frontend/InitHeaderSearch.cpp Wed Apr 28 21:11:32 2010
@@ -581,6 +581,16 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths
@@ -581,6 +581,15 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths
case llvm::Triple::FreeBSD:
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", "", "", "", triple);
break;
@ -10,8 +10,7 @@ $OpenBSD: patch-tools_clang_lib_Frontend_InitHeaderSearch_cpp,v 1.1 2010/04/29 1
+ std::string t = triple.getTriple();
+ if (t.substr(0, 6) == "x86_64")
+ t.replace(0, 6, "amd64");
+ // 4.7 gcc 4.2.4 from ports
+ AddGnuCPlusPlusIncludePaths("/usr/local/include/c++/4.2.4",
+ AddGnuCPlusPlusIncludePaths("/usr/include/g++",
+ t, "", "", triple);
+ }
+ break;