2020-06-17 13:00:49 +02:00
|
|
|
{
|
|
|
|
stdenv
|
2020-11-19 18:50:30 +01:00
|
|
|
, fetchFromGitHub
|
2020-06-17 13:00:49 +02:00
|
|
|
, cmake
|
|
|
|
, lld
|
|
|
|
, bash
|
|
|
|
, python3
|
|
|
|
, perl
|
|
|
|
, which
|
2022-02-14 20:44:39 +01:00
|
|
|
, elfutils
|
2020-06-17 13:00:49 +02:00
|
|
|
, libffi
|
|
|
|
, pkg-config
|
2020-11-19 18:50:30 +01:00
|
|
|
, enableDebug ? false
|
2020-06-17 13:00:49 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-02-14 20:44:39 +01:00
|
|
|
version = "2021.11";
|
2020-06-17 13:00:49 +02:00
|
|
|
pname = "clang-ompss2";
|
2020-11-19 18:50:30 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bsc-pm";
|
|
|
|
repo = "llvm";
|
2022-02-14 20:44:39 +01:00
|
|
|
rev = "refs/tags/github-release-${version}";
|
|
|
|
sha256 = "1x9scp1jpb2d5vm2pymc39r51242b7bvhx39hp9143rw5b2w3wrm";
|
2020-11-19 18:50:30 +01:00
|
|
|
};
|
|
|
|
|
2020-06-17 13:00:49 +02:00
|
|
|
enableParallelBuilding = true;
|
2020-07-21 16:31:31 +02:00
|
|
|
isClang = true;
|
2020-06-17 13:00:49 +02:00
|
|
|
|
2020-07-27 17:55:35 +02:00
|
|
|
passthru = {
|
|
|
|
CC = "clang";
|
|
|
|
CXX = "clang++";
|
|
|
|
};
|
|
|
|
|
2020-06-17 13:00:49 +02:00
|
|
|
isClangWithOmpss = true;
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
which
|
|
|
|
bash
|
|
|
|
python3
|
|
|
|
perl
|
|
|
|
cmake
|
|
|
|
lld
|
2022-02-14 20:44:39 +01:00
|
|
|
elfutils
|
2020-06-17 13:00:49 +02:00
|
|
|
libffi
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2020-11-19 18:50:30 +01:00
|
|
|
# Error with -D_FORTIFY_SOURCE=2, see https://bugs.gentoo.org/636604:
|
|
|
|
# /build/source/compiler-rt/lib/tsan/dd/dd_interceptors.cpp:225:20:
|
|
|
|
# error: redefinition of 'realpath'
|
2021-04-21 19:42:37 +02:00
|
|
|
# Requires disabling the "fortify" set of flags, however, for performance we
|
|
|
|
# disable all:
|
|
|
|
hardeningDisable = [ "all" ];
|
2020-07-02 21:10:44 +02:00
|
|
|
|
2020-06-17 13:00:49 +02:00
|
|
|
cmakeBuildType = if enableDebug then "Debug" else "Release";
|
|
|
|
|
|
|
|
dontUseCmakeBuildDir = true;
|
2020-07-06 11:15:55 +02:00
|
|
|
enableAssertions = if enableDebug then "ON" else "OFF";
|
2020-06-17 13:00:49 +02:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
cmakeDir="../llvm"
|
|
|
|
cmakeFlagsArray=(
|
|
|
|
"-DLLVM_ENABLE_LLD=ON"
|
|
|
|
"-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames"
|
|
|
|
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,-gdb-index"
|
|
|
|
"-DLLVM_LIT_ARGS=-sv --xunit-xml-output=xunit.xml"
|
2020-07-02 21:10:44 +02:00
|
|
|
"-DLLVM_ENABLE_PROJECTS=clang;openmp;compiler-rt"
|
2020-07-03 18:34:57 +02:00
|
|
|
"-DLLVM_ENABLE_ASSERTIONS=${enableAssertions}"
|
2020-06-17 13:00:49 +02:00
|
|
|
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
|
2022-02-21 15:58:16 +01:00
|
|
|
"-DCMAKE_INSTALL_BINDIR=bin"
|
2020-06-17 13:00:49 +02:00
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
2020-07-06 15:58:09 +02:00
|
|
|
# Remove support for GNU and Intel Openmp
|
|
|
|
postInstall = ''
|
|
|
|
rm $out/lib/libgomp*
|
|
|
|
rm $out/lib/libiomp*
|
|
|
|
'';
|
|
|
|
|
2020-06-17 13:00:49 +02:00
|
|
|
# About "-DCLANG_DEFAULT_NANOS6_HOME=${nanos6}", we could specify a default
|
|
|
|
# nanos6 installation, but this is would require a recompilation of clang each
|
|
|
|
# time nanos6 is changed. Better to use the environment variable NANOS6_HOME,
|
|
|
|
# and specify nanos6 at run time.
|
|
|
|
}
|