Skip to content

Commit

Permalink
Merge pull request #154465 from Ericson2314/bump-llvm-git
Browse files Browse the repository at this point in the history
llvmPackages_git.*: Bump to newer commit
  • Loading branch information
primeos authored Feb 27, 2022
2 parents 5ec0477 + 4badff4 commit 6dc6d8c
Show file tree
Hide file tree
Showing 22 changed files with 563 additions and 475 deletions.
15 changes: 11 additions & 4 deletions pkgs/development/compilers/llvm/git/clang/default.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{ lib, stdenv, llvm_meta, src, substituteAll, cmake, libxml2, libllvm, version, python3
{ lib, stdenv, llvm_meta
, monorepoSrc, runCommand
, substituteAll, cmake, libxml2, libllvm, version, python3
, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
}:

let
self = stdenv.mkDerivation ({
self = stdenv.mkDerivation (rec {
pname = "clang";
inherit version;

inherit src;
sourceRoot = "source/clang";
src = runCommand "${pname}-src-${version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/${pname} "$out"
'';

sourceRoot = "${src.name}/${pname}";

nativeBuildInputs = [ cmake python3 ]
++ lib.optional enableManpages python3.pkgs.sphinx
Expand Down
42 changes: 21 additions & 21 deletions pkgs/development/compilers/llvm/git/clang/gnu-install-dirs.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e74014134a0..976e6a1757fd 100644
index 7ea37850ad60..ac0f2d4f60b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.13.4)
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(Clang)

+ include(GNUInstallDirs)
+
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
@@ -416,7 +418,7 @@ include_directories(BEFORE
@@ -424,7 +426,7 @@ include_directories(BEFORE

if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/clang include/clang-c
Expand All @@ -20,7 +20,7 @@ index 9e74014134a0..976e6a1757fd 100644
COMPONENT clang-headers
FILES_MATCHING
PATTERN "*.def"
@@ -425,7 +427,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
@@ -433,7 +435,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
)

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
Expand All @@ -29,7 +29,7 @@ index 9e74014134a0..976e6a1757fd 100644
COMPONENT clang-headers
FILES_MATCHING
PATTERN "CMakeFiles" EXCLUDE
@@ -445,7 +447,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
@@ -453,7 +455,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)

add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
install(PROGRAMS utils/bash-autocomplete.sh
Expand All @@ -39,10 +39,10 @@ index 9e74014134a0..976e6a1757fd 100644
if(NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-bash-autocomplete
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
index 704278a0e93b..d25c8d325c71 100644
index 5752f4277444..5bf08dbf5e83 100644
--- a/cmake/modules/AddClang.cmake
+++ b/cmake/modules/AddClang.cmake
@@ -123,9 +123,9 @@ macro(add_clang_library name)
@@ -118,9 +118,9 @@ macro(add_clang_library name)
install(TARGETS ${lib}
COMPONENT ${lib}
${export_to_clangtargets}
Expand All @@ -55,16 +55,16 @@ index 704278a0e93b..d25c8d325c71 100644

if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${lib}
@@ -170,7 +170,7 @@ macro(add_clang_tool name)

@@ -159,7 +159,7 @@ macro(add_clang_tool name)
get_target_export_arg(${name} Clang export_to_clangtargets)
install(TARGETS ${name}
${export_to_clangtargets}
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT ${name})

if(NOT LLVM_ENABLE_IDE)
@@ -185,7 +185,7 @@ endmacro()
@@ -174,7 +174,7 @@ endmacro()
macro(add_clang_symlink name dest)
add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
# Always generate install targets
Expand All @@ -74,10 +74,10 @@ index 704278a0e93b..d25c8d325c71 100644

function(clang_target_link_libraries target type)
diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
index b2c0ce8dd4a0..19e5443d8c25 100644
index 078988980c52..14b58614b40a 100644
--- a/lib/Headers/CMakeLists.txt
+++ b/lib/Headers/CMakeLists.txt
@@ -215,7 +215,7 @@ set_target_properties(clang-resource-headers PROPERTIES
@@ -234,7 +234,7 @@ set_target_properties(clang-resource-headers PROPERTIES
FOLDER "Misc"
RUNTIME_OUTPUT_DIRECTORY "${output_dir}")

Expand All @@ -87,10 +87,10 @@ index b2c0ce8dd4a0..19e5443d8c25 100644
install(
FILES ${files} ${generated_files}
diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
index ceef4b08637c..8efad5520ca4 100644
index 99c6081db2d6..0887102febb3 100644
--- a/tools/c-index-test/CMakeLists.txt
+++ b/tools/c-index-test/CMakeLists.txt
@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
@@ -49,7 +49,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
"@executable_path/../../lib")
else()
Expand Down Expand Up @@ -146,10 +146,10 @@ index cda8e29ec5b1..0134d8ccd70b 100644
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
COMPONENT clang-rename)
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index 51ff2e7e1565..1ed5f8a079a1 100644
index bf88dca0a34b..7a10181e7738 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -166,7 +166,7 @@ endif()
@@ -186,7 +186,7 @@ endif()
if(INTERNAL_INSTALL_PREFIX)
set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
else()
Expand All @@ -158,7 +158,7 @@ index 51ff2e7e1565..1ed5f8a079a1 100644
endif()

install(DIRECTORY ../../include/clang-c
@@ -196,7 +196,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
@@ -216,7 +216,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
COMPONENT
libclang-python-bindings
DESTINATION
Expand All @@ -168,7 +168,7 @@ index 51ff2e7e1565..1ed5f8a079a1 100644
if(NOT LLVM_ENABLE_IDE)
add_custom_target(libclang-python-bindings)
diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
index ec0702d76f18..d25d982f51da 100644
index 74334e53c9b1..ebaae33e4324 100644
--- a/tools/scan-build/CMakeLists.txt
+++ b/tools/scan-build/CMakeLists.txt
@@ -47,7 +47,7 @@ if(CLANG_INSTALL_SCANBUILD)
Expand Down Expand Up @@ -199,10 +199,10 @@ index ec0702d76f18..d25d982f51da 100644
endforeach()

diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
index dd3d33439299..fea19c12ce70 100644
index eccc6b83195b..ff72d9cf0666 100644
--- a/tools/scan-view/CMakeLists.txt
+++ b/tools/scan-view/CMakeLists.txt
@@ -19,7 +19,7 @@ if(CLANG_INSTALL_SCANVIEW)
@@ -20,7 +20,7 @@ if(CLANG_INSTALL_SCANVIEW)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
install(PROGRAMS bin/${BinFile}
Expand All @@ -211,7 +211,7 @@ index dd3d33439299..fea19c12ce70 100644
COMPONENT scan-view)
endforeach()

@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
@@ -34,7 +34,7 @@ if(CLANG_INSTALL_SCANVIEW)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
install(FILES share/${ShareFile}
Expand Down
17 changes: 14 additions & 3 deletions pkgs/development/compilers/llvm/git/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{ lib, stdenv, llvm_meta, version, src, cmake, python3, libllvm, libcxxabi }:
{ lib, stdenv, llvm_meta, version
, monorepoSrc, runCommand
, cmake, python3, libllvm, libcxxabi
}:

let

Expand All @@ -7,14 +10,21 @@ let
haveLibc = stdenv.cc.libc != null;
inherit (stdenv.hostPlatform) isMusl;

baseName = "compiler-rt";

src = runCommand "${baseName}-src-${version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/${baseName} "$out"
'';
in

stdenv.mkDerivation {
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
pname = baseName + lib.optionalString (haveLibc) "-libc";
inherit version;

inherit src;
sourceRoot = "source/compiler-rt";
sourceRoot = "${src.name}/${baseName}";

nativeBuildInputs = [ cmake python3 libllvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
Expand Down Expand Up @@ -58,6 +68,7 @@ stdenv.mkDerivation {
patches = [
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
./gnu-install-dirs.patch
# ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
# extra `/`.
./normalize-var.patch
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c5003b5efa1d..4fffb9721284 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,8 @@

cmake_minimum_required(VERSION 3.13.4)

+include(GNUInstallDirs)
+
# Check if compiler-rt is built as a standalone project.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
project(CompilerRT C CXX ASM)
diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
index 1ada0ab30ba0..b4be6c4a3c73 100644
--- a/cmake/base-config-ix.cmake
+++ b/cmake/base-config-ix.cmake
@@ -66,7 +66,7 @@ if (LLVM_TREE_AVAILABLE)
else()
# Take output dir and install path from the user.
set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
- "Path where built compiler-rt libraries should be stored.")
+ "Path where built compiler-rt build artifacts should be stored.")
set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
"Path where built compiler-rt executables should be stored.")
set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
@@ -98,23 +98,23 @@ endif()
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(COMPILER_RT_OUTPUT_LIBRARY_DIR
${COMPILER_RT_OUTPUT_DIR}/lib)
- extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" lib)
+ extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_LIBDIR}")
set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt libraries should be installed.")
else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(COMPILER_RT_OUTPUT_LIBRARY_DIR
${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
- extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "lib/${COMPILER_RT_OS_DIR}")
+ extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_LIBDIR}/${COMPILER_RT_OS_DIR}")
set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt libraries should be installed.")
endif()
-extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" bin)
+extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_BINDIR}")
set(COMPILER_RT_INSTALL_BINARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt executables should be installed.")
-extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" include)
+extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_INCLUDEDIR}")
set(COMPILER_RT_INSTALL_INCLUDE_DIR "${default_install_path}" CACHE PATH
"Path where compiler-rt headers should be installed.")
-extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" share)
+extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_DATADIR}")
set(COMPILER_RT_INSTALL_DATA_DIR "${default_install_path}" CACHE PATH
"Path where compiler-rt data files should be installed.")

12 changes: 6 additions & 6 deletions pkgs/development/compilers/llvm/git/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ let
release_version = "14.0.0";
candidate = ""; # empty or "rcN"
dash-candidate = lib.optionalString (candidate != "") "-${candidate}";
rev = "ee65938357d5fffe9e586fa155b37268b5a358ac"; # When using a Git commit
rev-version = "unstable-2021-08-13"; # When using a Git commit
rev = "fb1582f6c54422995c6fb61ba4c55126b357f64e"; # When using a Git commit
rev-version = "unstable-2022-01-07"; # When using a Git commit
version = if rev != "" then rev-version else "${release_version}${dash-candidate}";
targetConfig = stdenv.targetPlatform.config;

src = fetchFromGitHub {
monorepoSrc = fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
rev = if rev != "" then rev else "llvmorg-${version}";
sha256 = "10ahc108wbg2rsp50j3mc8h018a453ykg1rivjkhizng80pyllm1";
sha256 = "1pkgdsscvf59i22ix763lp2z3sg0v2z2ywh0n07k3ki7q1qpqbhk";
};

llvm_meta = {
Expand All @@ -40,7 +40,7 @@ let
};

tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version src buildLlvmTools; });
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version monorepoSrc buildLlvmTools; });
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
Expand Down Expand Up @@ -218,7 +218,7 @@ let
});

libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version src; });
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version monorepoSrc; });
in {

compiler-rt-libc = callPackage ./compiler-rt {
Expand Down
24 changes: 20 additions & 4 deletions pkgs/development/compilers/llvm/git/libcxx/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta
, monorepoSrc, runCommand
, cmake, python3, fixDarwinDylibNames, version
, libcxxabi
, enableShared ? !stdenv.hostPlatform.isStatic

Expand All @@ -10,12 +12,26 @@
, headersOnly ? false
}:

let
basename = "libcxx";
in

stdenv.mkDerivation rec {
pname = if headersOnly then "cxx-headers" else "libcxx";
pname = basename + lib.optionalString headersOnly "-headers";
inherit version;

inherit src;
sourceRoot = "source/libcxx";
src = runCommand "${pname}-src-${version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/${basename} "$out"
mkdir -p "$out/libcxxabi"
cp -r ${monorepoSrc}/libcxxabi/include "$out/libcxxabi"
mkdir -p "$out/llvm"
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
'';

sourceRoot = "${src.name}/${basename}";

outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";

Expand Down
Loading

0 comments on commit 6dc6d8c

Please sign in to comment.