aboutsummaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2016-09-03 05:33:05 +0800
committerbrooks <brooks@FreeBSD.org>2016-09-03 05:33:05 +0800
commit60ecc180505b6a2aeeec4b96c4a74c797d68768a (patch)
tree6d82e19c8a7d81f27f166372b0a1c00cb66c70ae /devel
parent111febaa15996100f5c46af7e98b7ab65d234070 (diff)
downloadfreebsd-ports-gnome-60ecc180505b6a2aeeec4b96c4a74c797d68768a.tar.gz
freebsd-ports-gnome-60ecc180505b6a2aeeec4b96c4a74c797d68768a.tar.zst
freebsd-ports-gnome-60ecc180505b6a2aeeec4b96c4a74c797d68768a.zip
Add a hack to make -fopenmp work inspired by a submission from
Johannes Dieterich <dieterich@ogolem.org>. This differs from the submission in that it adds the library directly to the linker command line. I chose not to add the llvm library to the search path because that would (e.g.) make it hard to link something that uses a different version of llvm.
Diffstat (limited to 'devel')
-rw-r--r--devel/llvm38/Makefile7
-rw-r--r--devel/llvm38/files/clang-patch-fopenmp.diff28
2 files changed, 34 insertions, 1 deletions
diff --git a/devel/llvm38/Makefile b/devel/llvm38/Makefile
index f99d1aa09b07..1fee2b0f907c 100644
--- a/devel/llvm38/Makefile
+++ b/devel/llvm38/Makefile
@@ -2,7 +2,7 @@
PORTNAME= llvm
DISTVERSION= 3.8.1
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= devel lang
MASTER_SITES= http://llvm.org/${PRE_}releases/${LLVM_RELEASE}/${RCDIR}
DISTNAME= ${PORTNAME}-${DISTVERSION}.src
@@ -45,6 +45,7 @@ PLIST_FILES=
CLANG_DESC= Build clang
CLANG_EXTRA_PATCHES= \
${PATCHDIR}/clang-patch-fformat_extensions.diff \
+ ${PATCHDIR}/clang-patch-fopenmp.diff \
${PATCHDIR}/clang-patch-tools_clang_lib_Headers_CMakeLists.txt \
${PATCHDIR}/clang-patch-tools_clang_tools_clang-format_clang-format.py \
${PATCHDIR}/clang-patch-tools_clang_tools_scan-build_libexec_ccc-analyzer
@@ -312,6 +313,10 @@ post-build-COMPILER_RT-on:
${WRKSRC_compiler_rt} && \
${MAKE_ENV} ${MAKE_CMD}
+post-patch-CLANG-on:
+ ${REINPLACE_CMD} -e 's|%%LLVM_PREFIX%%|${LLVM_PREFIX}|' \
+ ${PATCH_WRKSRC}/tools/clang/lib/Driver/Tools.cpp
+
post-install:
${RMDIR} ${STAGEDIR}${LLVM_PREFIX}/include/llvm/MC/MCAnalysis
${INSTALL_SCRIPT} ${WRKDIR}/llvm-wrapper.sh \
diff --git a/devel/llvm38/files/clang-patch-fopenmp.diff b/devel/llvm38/files/clang-patch-fopenmp.diff
new file mode 100644
index 000000000000..5216a420e710
--- /dev/null
+++ b/devel/llvm38/files/clang-patch-fopenmp.diff
@@ -0,0 +1,28 @@
+--- tools/clang/lib/Driver/Tools.cpp.orig 2016-09-02 19:55:01.000873648 +0000
++++ tools/clang/lib/Driver/Tools.cpp 2016-09-02 19:54:32.001875868 +0000
+@@ -2733,13 +2733,22 @@
+
+ switch (getOpenMPRuntime(TC, Args)) {
+ case OMPRT_OMP:
+- CmdArgs.push_back("-lomp");
++ if (TC.getTriple().getOS() != llvm::Triple::FreeBSD || TC.isCrossCompiling() || !llvm::sys::fs::exists("%%LLVM_PREFIX%%/lib/libomp.so"))
++ CmdArgs.push_back("-lomp");
++ else
++ CmdArgs.push_back("%%LLVM_PREFIX%%/lib/libomp.so");
+ break;
+ case OMPRT_GOMP:
+- CmdArgs.push_back("-lgomp");
++ if (TC.getTriple().getOS() != llvm::Triple::FreeBSD || TC.isCrossCompiling() || !llvm::sys::fs::exists("%%LLVM_PREFIX%%/lib/libomp.so"))
++ CmdArgs.push_back("-lgomp");
++ else
++ CmdArgs.push_back("%%LLVM_PREFIX%%/lib/libgomp.so");
+ break;
+ case OMPRT_IOMP5:
+- CmdArgs.push_back("-liomp5");
++ if (TC.getTriple().getOS() != llvm::Triple::FreeBSD || TC.isCrossCompiling() || !llvm::sys::fs::exists("%%LLVM_PREFIX%%/lib/libomp.so"))
++ CmdArgs.push_back("-liomp5");
++ else
++ CmdArgs.push_back("%%LLVM_PREFIX%%/lib/libiomp5.so");
+ break;
+ case OMPRT_Unknown:
+ // Already diagnosed.