llvmPackages: Fix more inconsistencies

The main thing was using `llvm_meta` in all versions.

Secondarily:

 - libunwindx7: Forgot to split outputs

 - libcxx{,abi} 12: Forgot to apply output-splitting patches.

 - simplify `useLLVM` stdenv-switching logic.

 - openmp always gets its own directory
This commit is contained in:
John Ericson
2021-05-12 00:16:11 +00:00
parent 37194a325d
commit e830db4320
82 changed files with 1489 additions and 623 deletions
@@ -1,4 +1,4 @@
{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
@@ -100,11 +100,20 @@ let
inherit libllvm;
};
meta = {
description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
homepage = "https://llvm.org/";
license = lib.licenses.ncsa;
platforms = lib.platforms.all;
meta = llvm_meta // {
homepage = "https://clang.llvm.org/";
description = "A C language family frontend for LLVM";
longDescription = ''
The Clang project provides a language front-end and tooling
infrastructure for languages in the C language family (C, C++, Objective
C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project.
It aims to deliver amazingly fast compiles, extremely useful error and
warning messages and to provide a platform for building great source
level tools. The Clang Static Analyzer and clang-tidy are tools that
automatically find bugs in your code, and are great examples of the sort
of tools that can be built using the Clang frontend as a library to
parse C/C++ code.
'';
};
} // lib.optionalAttrs enableManpages {
pname = "clang-manpages";
@@ -123,6 +132,8 @@ let
doCheck = false;
meta.description = "man page for Clang ${version}";
meta = llvm_meta // {
description = "man page for Clang ${version}";
};
});
in self
@@ -1,4 +1,4 @@
{ lib, stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, llvm, libcxxabi }:
let
@@ -90,4 +90,20 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'';
meta = llvm_meta // {
homepage = "https://compiler-rt.llvm.org/";
description = "Compiler runtime libraries";
longDescription = ''
The compiler-rt project provides highly tuned implementations of the
low-level code generator support routines like "__fixunsdfdi" and other
calls generated when a target doesn't have a short sequence of native
instructions to implement a core IR operation. It also provides
implementations of run-time libraries for dynamic testing tools such as
AddressSanitizer, ThreadSanitizer, MemorySanitizer, and DataFlowSanitizer.
'';
# "All of the code in the compiler-rt project is dual licensed under the MIT
# license and the UIUC License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
};
}
+44 -19
View File
@@ -17,6 +17,12 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "0lb4kdh7j2fhfz8kd6iv5df7m3pikiryk1vvwsf87spc90n09q0w";
llvm_meta = {
license = lib.licenses.ncsa;
maintainers = with lib.maintainers; [ lovek323 raskin dtzWill primeos ];
platforms = lib.platforms.all;
};
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands0 = cc: ''
@@ -31,23 +37,29 @@ let
in {
libllvm = callPackage ./llvm { };
libllvm = callPackage ./llvm {
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
libllvm-polly = callPackage ./llvm { enablePolly = true; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src;
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;
inherit clang-tools-extra_src;
libllvm = tools.libllvm-polly;
enablePolly = true;
@@ -85,9 +97,13 @@ let
extraBuildCommands = mkExtraBuildCommands cc;
};
lld = callPackage ./lld {};
lld = callPackage ./lld {
inherit llvm_meta;
};
lldb = callPackage ./lldb {};
lldb = callPackage ./lldb {
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
# fully LLVM toolchain from scratch. No GCC toolchain should be
@@ -183,12 +199,14 @@ let
in {
compiler-rt-libc = callPackage ./compiler-rt {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
else stdenv;
};
compiler-rt-no-libc = callPackage ./compiler-rt {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
else stdenv;
@@ -203,24 +221,31 @@ let
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
libcxx = callPackage ./libcxx ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
}));
libcxx = callPackage ./libcxx {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
else stdenv;
};
libcxxabi = callPackage ./libcxxabi ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
libunwind = libraries.libunwind;
}));
libcxxabi = callPackage ./libcxxabi {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
else stdenv;
};
libunwind = callPackage ./libunwind ({
libunwind = callPackage ./libunwind {
inherit llvm_meta;
inherit (buildLlvmTools) llvm;
} // lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
});
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
else stdenv;
};
openmp = callPackage ./openmp.nix {};
openmp = callPackage ./openmp {
inherit llvm_meta;
};
});
in { inherit tools libraries; } // libraries // tools
@@ -1,4 +1,4 @@
{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
, enableShared ? !stdenv.hostPlatform.isStatic
}:
@@ -17,7 +17,9 @@ stdenv.mkDerivation {
patches = [
./gnu-install-dirs.patch
] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
prePatch = ''
substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
@@ -34,7 +36,7 @@ stdenv.mkDerivation {
++ lib.optional stdenv.hostPlatform.isMusl python3
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ] ;
buildInputs = [ libcxxabi ];
cmakeFlags = [
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
@@ -48,10 +50,15 @@ stdenv.mkDerivation {
isLLVM = true;
};
meta = {
meta = llvm_meta // {
homepage = "https://libcxx.llvm.org/";
description = "A new implementation of the C++ standard library, targeting C++11";
license = with lib.licenses; [ ncsa mit ];
platforms = lib.platforms.unix;
description = "C++ standard library";
longDescription = ''
libc++ is an implementation of the C++ standard library, targeting C++11,
C++14 and above.
'';
# "All of the code in libc++ is dual licensed under the MIT license and the
# UIUC License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
};
}
@@ -1,4 +1,4 @@
{ lib, stdenv, cmake, fetch, libcxx, libunwind, llvm, version
{ lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version
, standalone ? stdenv.hostPlatform.useLLVM or false
, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm
# on musl the shared objects don't build
@@ -58,11 +58,15 @@ stdenv.mkDerivation {
${lib.optionalString enableShared "ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1"}
'';
meta = {
meta = llvm_meta // {
homepage = "https://libcxxabi.llvm.org/";
description = "A new implementation of low level support for a standard C++ library";
license = with lib.licenses; [ ncsa mit ];
maintainers = with lib.maintainers; [ vlstill ];
platforms = lib.platforms.unix;
description = "Provides C++ standard library support";
longDescription = ''
libc++abi is a new implementation of low level support for a standard C++ library.
'';
# "All of the code in libc++abi is dual licensed under the MIT license and
# the UIUC License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
};
}
@@ -1,12 +1,12 @@
{ lib, stdenv, version, fetch, fetchpatch, cmake, llvm
{ lib, stdenv, llvm_meta, version, fetch, fetchpatch, cmake, llvm
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "libunwind";
inherit version;
src = fetch "libunwind" "035dsxs10nyiqd00q07yycvmkjl01yz4jdlrjvmch8klxg4pyjhp";
src = fetch pname "035dsxs10nyiqd00q07yycvmkjl01yz4jdlrjvmch8klxg4pyjhp";
postUnpack = ''
unpackFile ${llvm.src}
@@ -29,6 +29,8 @@ stdenv.mkDerivation {
})
];
outputs = [ "out" "dev" ];
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optionals (!enableShared) [
@@ -36,4 +38,16 @@ stdenv.mkDerivation {
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLLVM_ENABLE_LIBCXX=ON"
];
meta = llvm_meta // {
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst
homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library";
description = "LLVM's unwinder library";
longDescription = ''
The unwind library provides a family of _Unwind_* functions implementing
the language-neutral stack unwinding portion of the Itanium C++ ABI (Level
I). It is a dependency of the C++ ABI library, and sometimes is a
dependency of other runtimes.
'';
};
}
@@ -1,4 +1,4 @@
{ lib, stdenv
{ lib, stdenv, llvm_meta
, buildLlvmTools
, fetch
, cmake
@@ -7,11 +7,11 @@
, version
}:
stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "lld";
inherit version;
src = fetch "lld" "0rsqb7zcnij5r5ipfhr129j7skr5n9pyr388kjpqwh091952f3x1";
src = fetch pname "0rsqb7zcnij5r5ipfhr129j7skr5n9pyr388kjpqwh091952f3x1";
patches = [
./gnu-install-dirs.patch
@@ -28,10 +28,16 @@ stdenv.mkDerivation {
outputs = [ "out" "lib" "dev" ];
meta = {
description = "The LLVM Linker";
homepage = "https://lld.llvm.org/";
license = lib.licenses.ncsa;
platforms = lib.platforms.all;
meta = llvm_meta // {
homepage = "https://lld.llvm.org/";
description = "The LLVM linker";
longDescription = ''
LLD is a linker from the LLVM project that is a drop-in replacement for
system linkers and runs much faster than them. It also provides features
that are useful for toolchain developers.
The linker supports ELF (Unix), PE/COFF (Windows), and Mach-O (macOS)
in descending order of completeness. Internally, LLD consists
of several different linkers.
'';
};
}
@@ -1,4 +1,4 @@
{ lib, stdenv
{ lib, stdenv, llvm_meta
, fetch
, cmake
, zlib
@@ -76,10 +76,14 @@ stdenv.mkDerivation rec {
cp ../docs/lldb.1 $out/share/man/man1/
'';
meta = with lib; {
meta = llvm_meta // {
homepage = "https://lldb.llvm.org/";
description = "A next-generation high-performance debugger";
homepage = "https://llvm.org/";
license = licenses.ncsa;
platforms = platforms.all;
longDescription = ''
LLDB is a next generation, high-performance debugger. It is built as a set
of reusable components which highly leverage existing libraries in the
larger LLVM Project, such as the Clang expression parser and LLVM
disassembler.
'';
};
}
@@ -1,4 +1,4 @@
{ lib, stdenv
{ lib, stdenv, llvm_meta
, pkgsBuildBuild
, fetch
, fetchpatch
@@ -184,12 +184,23 @@ in stdenv.mkDerivation ({
checkTarget = "check-all";
requiredSystemFeatures = [ "big-parallel" ];
meta = {
description = "Collection of modular and reusable compiler and toolchain technologies";
homepage = "https://llvm.org/";
license = lib.licenses.ncsa;
maintainers = with lib.maintainers; [ lovek323 raskin dtzWill ];
platforms = lib.platforms.all;
meta = llvm_meta // {
homepage = "https://llvm.org/";
description = "A collection of modular and reusable compiler and toolchain technologies";
longDescription = ''
The LLVM Project is a collection of modular and reusable compiler and
toolchain technologies. Despite its name, LLVM has little to do with
traditional virtual machines. The name "LLVM" itself is not an acronym; it
is the full name of the project.
LLVM began as a research project at the University of Illinois, with the
goal of providing a modern, SSA-based compilation strategy capable of
supporting both static and dynamic compilation of arbitrary programming
languages. Since then, LLVM has grown to be an umbrella project consisting
of a number of subprojects, many of which are being used in production by
a wide variety of commercial and open source projects as well as being
widely used in academic research. Code in the LLVM project is licensed
under the "Apache 2.0 License with LLVM exceptions".
'';
};
} // lib.optionalAttrs enableManpages {
pname = "llvm-manpages";
@@ -211,5 +222,7 @@ in stdenv.mkDerivation ({
doCheck = false;
meta.description = "man pages for LLVM ${version}";
meta = llvm_meta // {
description = "man pages for LLVM ${version}";
};
})
@@ -1,25 +0,0 @@
{ lib
, stdenv
, fetch
, cmake
, llvm
, perl
, version
}:
stdenv.mkDerivation {
pname = "openmp";
inherit version;
src = fetch "openmp" "1dg53wzsci2kra8lh1y0chh60h2l8h1by93br5spzvzlxshkmrqy";
nativeBuildInputs = [ cmake perl ];
buildInputs = [ llvm ];
meta = {
description = "Components required to build an executable OpenMP program";
homepage = "https://openmp.llvm.org/";
license = lib.licenses.mit;
platforms = lib.platforms.all;
};
}
@@ -0,0 +1,34 @@
{ lib
, stdenv
, llvm_meta
, fetch
, cmake
, llvm
, perl
, version
}:
stdenv.mkDerivation {
pname = "openmp";
inherit version;
src = fetch "openmp" "1dg53wzsci2kra8lh1y0chh60h2l8h1by93br5spzvzlxshkmrqy";
nativeBuildInputs = [ cmake perl ];
buildInputs = [ llvm ];
meta = llvm_meta // {
homepage = "https://openmp.llvm.org/";
description = "Support for the OpenMP language";
longDescription = ''
The OpenMP subproject of LLVM contains the components required to build an
executable OpenMP program that are outside the compiler itself.
Contains the code for the runtime library against which code compiled by
"clang -fopenmp" must be linked before it can run and the library that
supports offload to target devices.
'';
# "All of the code is dual licensed under the MIT license and the UIUC
# License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
};
}