Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit fb7ebf3)
- Loading branch information
Showing
13 changed files
with
758 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{ stdenv, fetch, cmake, libxml2, libedit, llvm, version, release_version, clang-tools-extra_src, python | ||
, fixDarwinDylibNames | ||
, enableManpages ? false | ||
}: | ||
|
||
let | ||
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc; | ||
self = stdenv.mkDerivation { | ||
name = "clang-${version}"; | ||
|
||
unpackPhase = '' | ||
unpackFile ${fetch "cfe" "0w09s8fn3lkn6i04nj0cisgp821r815fk5b5fjn97xrd371277q1"} | ||
mv cfe-${version}* clang | ||
sourceRoot=$PWD/clang | ||
unpackFile ${clang-tools-extra_src} | ||
mv clang-tools-extra-* $sourceRoot/tools/extra | ||
''; | ||
|
||
nativeBuildInputs = [ cmake python ] | ||
++ stdenv.lib.optional enableManpages python.pkgs.sphinx; | ||
|
||
buildInputs = [ libedit libxml2 llvm ] | ||
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; | ||
|
||
cmakeFlags = [ | ||
"-DCMAKE_CXX_FLAGS=-std=c++11" | ||
] ++ stdenv.lib.optionals enableManpages [ | ||
"-DCLANG_INCLUDE_DOCS=ON" | ||
"-DLLVM_ENABLE_SPHINX=ON" | ||
"-DSPHINX_OUTPUT_MAN=ON" | ||
"-DSPHINX_OUTPUT_HTML=OFF" | ||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF" | ||
] | ||
# Maybe with compiler-rt this won't be needed? | ||
++ stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}" | ||
++ stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include"; | ||
|
||
patches = [ ./purity.patch ]; | ||
|
||
postBuild = stdenv.lib.optionalString enableManpages '' | ||
cmake --build . --target docs-clang-man | ||
''; | ||
|
||
postPatch = '' | ||
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \ | ||
-e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \ | ||
lib/Driver/ToolChains/*.cpp | ||
# Patch for standalone doc building | ||
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt | ||
''; | ||
|
||
outputs = [ "out" "python" ] | ||
++ stdenv.lib.optional enableManpages "man"; | ||
|
||
# Clang expects to find LLVMgold in its own prefix | ||
# Clang expects to find sanitizer libraries in its own prefix | ||
postInstall = '' | ||
ln -sv ${llvm}/lib/LLVMgold.so $out/lib | ||
ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/ | ||
ln -sv $out/bin/clang $out/bin/cpp | ||
mkdir -p $python/bin $python/share/clang/ | ||
mv $out/bin/{git-clang-format,scan-view} $python/bin | ||
if [ -e $out/bin/set-xcode-analyzer ]; then | ||
mv $out/bin/set-xcode-analyzer $python/bin | ||
fi | ||
mv $out/share/clang/*.py $python/share/clang | ||
rm $out/bin/c-index-test | ||
'' | ||
+ stdenv.lib.optionalString enableManpages '' | ||
# Manually install clang manpage | ||
cp docs/man/*.1 $out/share/man/man1/ | ||
# Move it and other man pages to 'man' output | ||
moveToOutput "share/man" "$man" | ||
''; | ||
|
||
enableParallelBuilding = true; | ||
|
||
passthru = { | ||
lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both | ||
isClang = true; | ||
inherit llvm; | ||
} // stdenv.lib.optionalAttrs stdenv.isLinux { | ||
inherit gcc; | ||
}; | ||
|
||
meta = { | ||
description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler"; | ||
homepage = http://llvm.org/; | ||
license = stdenv.lib.licenses.ncsa; | ||
platforms = stdenv.lib.platforms.all; | ||
}; | ||
}; | ||
in self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001 | ||
From: Will Dietz <w@wdtz.org> | ||
Date: Thu, 18 May 2017 11:56:12 -0500 | ||
Subject: [PATCH] "purity" patch for 5.0 | ||
|
||
--- | ||
lib/Driver/ToolChains/Gnu.cpp | 7 ------- | ||
1 file changed, 7 deletions(-) | ||
|
||
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp | ||
index fe3c0191bb..c6a482bece 100644 | ||
--- a/lib/Driver/ToolChains/Gnu.cpp | ||
+++ b/lib/Driver/ToolChains/Gnu.cpp | ||
@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, | ||
if (!Args.hasArg(options::OPT_static)) { | ||
if (Args.hasArg(options::OPT_rdynamic)) | ||
CmdArgs.push_back("-export-dynamic"); | ||
- | ||
- if (!Args.hasArg(options::OPT_shared)) { | ||
- const std::string Loader = | ||
- D.DyldPrefix + ToolChain.getDynamicLinker(Args); | ||
- CmdArgs.push_back("-dynamic-linker"); | ||
- CmdArgs.push_back(Args.MakeArgString(Loader)); | ||
- } | ||
} | ||
|
||
CmdArgs.push_back("-o"); | ||
-- | ||
2.11.0 | ||
|
155 changes: 155 additions & 0 deletions
155
pkgs/development/compilers/llvm/5/compiler-rt-codesign.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001 | ||
From: Will Dietz <w@wdtz.org> | ||
Date: Tue, 19 Sep 2017 13:13:06 -0500 | ||
Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that | ||
needs it | ||
|
||
--- | ||
cmake/Modules/AddCompilerRT.cmake | 8 ------ | ||
test/asan/CMakeLists.txt | 52 --------------------------------------- | ||
test/tsan/CMakeLists.txt | 47 ----------------------------------- | ||
3 files changed, 107 deletions(-) | ||
|
||
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake | ||
index bc5fb9ff7..b64eb4246 100644 | ||
--- a/cmake/Modules/AddCompilerRT.cmake | ||
+++ b/cmake/Modules/AddCompilerRT.cmake | ||
@@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type) | ||
set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "") | ||
set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib") | ||
endif() | ||
- if(APPLE) | ||
- # Ad-hoc sign the dylibs | ||
- add_custom_command(TARGET ${libname} | ||
- POST_BUILD | ||
- COMMAND codesign --sign - $<TARGET_FILE:${libname}> | ||
- WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} | ||
- ) | ||
- endif() | ||
endif() | ||
install(TARGETS ${libname} | ||
ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} | ||
diff --git a/test/asan/CMakeLists.txt b/test/asan/CMakeLists.txt | ||
index 8bfc15b5c..f23d0f71a 100644 | ||
--- a/test/asan/CMakeLists.txt | ||
+++ b/test/asan/CMakeLists.txt | ||
@@ -83,58 +83,6 @@ foreach(arch ${ASAN_TEST_ARCH}) | ||
endif() | ||
endforeach() | ||
|
||
-# iOS and iOS simulator test suites | ||
-# These are not added into "check-all", in order to run these tests, use | ||
-# "check-asan-iossim-x86_64" and similar. They also require that an extra env | ||
-# variable to select which iOS device or simulator to use, e.g.: | ||
-# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6" | ||
-if(APPLE) | ||
- set(EXCLUDE_FROM_ALL ON) | ||
- | ||
- set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER}) | ||
- set(ASAN_TEST_IOS "1") | ||
- pythonize_bool(ASAN_TEST_IOS) | ||
- set(ASAN_TEST_DYNAMIC True) | ||
- | ||
- foreach(arch ${DARWIN_iossim_ARCHS}) | ||
- set(ASAN_TEST_IOSSIM "1") | ||
- pythonize_bool(ASAN_TEST_IOSSIM) | ||
- set(ASAN_TEST_TARGET_ARCH ${arch}) | ||
- set(ASAN_TEST_TARGET_CFLAGS "-arch ${arch} -isysroot ${DARWIN_iossim_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") | ||
- set(ASAN_TEST_CONFIG_SUFFIX "-${arch}-iossim") | ||
- get_bits_for_arch(${arch} ASAN_TEST_BITS) | ||
- string(TOUPPER ${arch} ARCH_UPPER_CASE) | ||
- set(CONFIG_NAME "IOSSim${ARCH_UPPER_CASE}Config") | ||
- configure_lit_site_cfg( | ||
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in | ||
- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg | ||
- ) | ||
- add_lit_testsuite(check-asan-iossim-${arch} "AddressSanitizer iOS Simulator ${arch} tests" | ||
- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ | ||
- DEPENDS ${ASAN_TEST_DEPS}) | ||
- endforeach() | ||
- | ||
- foreach (arch ${DARWIN_ios_ARCHS}) | ||
- set(ASAN_TEST_IOSSIM "0") | ||
- pythonize_bool(ASAN_TEST_IOSSIM) | ||
- set(ASAN_TEST_TARGET_ARCH ${arch}) | ||
- set(ASAN_TEST_TARGET_CFLAGS "-arch ${arch} -isysroot ${DARWIN_ios_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") | ||
- set(ASAN_TEST_CONFIG_SUFFIX "-${arch}-ios") | ||
- get_bits_for_arch(${arch} ASAN_TEST_BITS) | ||
- string(TOUPPER ${arch} ARCH_UPPER_CASE) | ||
- set(CONFIG_NAME "IOS${ARCH_UPPER_CASE}Config") | ||
- configure_lit_site_cfg( | ||
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in | ||
- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg | ||
- ) | ||
- add_lit_testsuite(check-asan-ios-${arch} "AddressSanitizer iOS ${arch} tests" | ||
- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ | ||
- DEPENDS ${ASAN_TEST_DEPS}) | ||
- endforeach() | ||
- | ||
- set(EXCLUDE_FROM_ALL OFF) | ||
-endif() | ||
- | ||
# Add unit tests. | ||
if(COMPILER_RT_INCLUDE_TESTS) | ||
set(ASAN_TEST_DYNAMIC False) | ||
diff --git a/test/tsan/CMakeLists.txt b/test/tsan/CMakeLists.txt | ||
index a68908612..cde0accb5 100644 | ||
--- a/test/tsan/CMakeLists.txt | ||
+++ b/test/tsan/CMakeLists.txt | ||
@@ -42,53 +42,6 @@ foreach(arch ${TSAN_TEST_ARCH}) | ||
list(APPEND TSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}) | ||
endforeach() | ||
|
||
-# iOS and iOS simulator test suites | ||
-# These are not added into "check-all", in order to run these tests, use | ||
-# "check-tsan-iossim-x86_64" and similar. They also require an extra environment | ||
-# variable to select which iOS device or simulator to use, e.g.: | ||
-# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6" | ||
-if(APPLE) | ||
- set(EXCLUDE_FROM_ALL ON) | ||
- | ||
- set(TSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER}) | ||
- set(TSAN_TEST_IOS "1") | ||
- pythonize_bool(TSAN_TEST_IOS) | ||
- | ||
- set(arch "x86_64") | ||
- set(TSAN_TEST_IOSSIM "1") | ||
- pythonize_bool(TSAN_TEST_IOSSIM) | ||
- set(TSAN_TEST_TARGET_ARCH ${arch}) | ||
- set(TSAN_TEST_TARGET_CFLAGS "-arch ${arch} -isysroot ${DARWIN_iossim_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") | ||
- set(TSAN_TEST_CONFIG_SUFFIX "-${arch}-iossim") | ||
- string(TOUPPER ${arch} ARCH_UPPER_CASE) | ||
- set(CONFIG_NAME "IOSSim${ARCH_UPPER_CASE}Config") | ||
- configure_lit_site_cfg( | ||
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in | ||
- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg | ||
- ) | ||
- add_lit_testsuite(check-tsan-iossim-${arch} "ThreadSanitizer iOS Simulator ${arch} tests" | ||
- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ | ||
- DEPENDS ${TSAN_TEST_DEPS}) | ||
- | ||
- set(arch "arm64") | ||
- set(TSAN_TEST_IOSSIM "0") | ||
- pythonize_bool(TSAN_TEST_IOSSIM) | ||
- set(TSAN_TEST_TARGET_ARCH ${arch}) | ||
- set(TSAN_TEST_TARGET_CFLAGS "-arch ${arch} -isysroot ${DARWIN_ios_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") | ||
- set(TSAN_TEST_CONFIG_SUFFIX "-${arch}-ios") | ||
- string(TOUPPER ${arch} ARCH_UPPER_CASE) | ||
- set(CONFIG_NAME "IOS${ARCH_UPPER_CASE}Config") | ||
- configure_lit_site_cfg( | ||
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in | ||
- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg | ||
- ) | ||
- add_lit_testsuite(check-tsan-ios-${arch} "ThreadSanitizer iOS Simulator ${arch} tests" | ||
- ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ | ||
- DEPENDS ${TSAN_TEST_DEPS}) | ||
- | ||
- set(EXCLUDE_FROM_ALL OFF) | ||
-endif() | ||
- | ||
if(COMPILER_RT_INCLUDE_TESTS) | ||
configure_lit_site_cfg( | ||
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in | ||
-- | ||
2.14.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook | ||
, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun | ||
, darwin | ||
}: | ||
|
||
let | ||
callPackage = newScope (self // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; }); | ||
|
||
release_version = "5.0.0"; | ||
version = release_version; # differentiating these is important for rc's | ||
|
||
fetch = name: sha256: fetchurl { | ||
url = "http://llvm.org/releases/${release_version}/${name}-${version}.src.tar.xz"; | ||
inherit sha256; | ||
}; | ||
|
||
compiler-rt_src = fetch "compiler-rt" "1cy0y389zxn7mk8vffqvfirk9bbcbc8ziwc1nf1a8d118rk55bfm"; | ||
clang-tools-extra_src = fetch "clang-tools-extra" "1ikkv6k8cfgpjqlm24iqz52i5nyafzsc4dyikzzyb9n4b6wpil47"; | ||
|
||
# Add man output without introducing extra dependencies. | ||
overrideManOutput = drv: | ||
let drv-manpages = drv.override { enableManpages = true; }; in | ||
drv // { man = drv-manpages.man; /*outputs = drv.outputs ++ ["man"];*/ }; | ||
|
||
llvm = callPackage ./llvm.nix { | ||
inherit compiler-rt_src stdenv; | ||
}; | ||
|
||
clang-unwrapped = callPackage ./clang { | ||
inherit clang-tools-extra_src stdenv; | ||
}; | ||
|
||
self = { | ||
llvm = overrideManOutput llvm; | ||
clang-unwrapped = overrideManOutput clang-unwrapped; | ||
|
||
llvm-manpages = lowPrio self.llvm.man; | ||
clang-manpages = lowPrio self.clang-unwrapped.man; | ||
|
||
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang; | ||
|
||
libstdcxxClang = ccWrapperFun { | ||
cc = self.clang-unwrapped; | ||
/* FIXME is this right? */ | ||
inherit (stdenv.cc) libc nativeTools nativeLibc; | ||
extraPackages = [ libstdcxxHook ]; | ||
}; | ||
|
||
libcxxClang = ccWrapperFun { | ||
cc = self.clang-unwrapped; | ||
/* FIXME is this right? */ | ||
inherit (stdenv.cc) libc nativeTools nativeLibc; | ||
extraPackages = [ self.libcxx self.libcxxabi ]; | ||
}; | ||
|
||
stdenv = stdenv.override (drv: { | ||
allowedRequisites = null; | ||
cc = self.clang; | ||
# Don't include the libc++ and libc++abi from the original stdenv. | ||
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF; | ||
}); | ||
|
||
libcxxStdenv = stdenv.override (drv: { | ||
allowedRequisites = null; | ||
cc = self.libcxxClang; | ||
# Don't include the libc++ and libc++abi from the original stdenv. | ||
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF; | ||
}); | ||
|
||
lld = callPackage ./lld.nix {}; | ||
|
||
lldb = callPackage ./lldb.nix {}; | ||
|
||
libcxx = callPackage ./libc++ {}; | ||
|
||
libcxxabi = callPackage ./libc++abi.nix {}; | ||
|
||
openmp = callPackage ./openmp.nix {}; | ||
}; | ||
|
||
in self |
Oops, something went wrong.