As mentioned in #305146, keeping LLVM 12 is a source of pain because it
is the only version to be built from individual release tarball instead
of the LLVM monorepo. This commit makes LLVM 12 start from the monorepo
as well, simplifying all common LLVM expressions in the process.
With #347887, some quirks in the expressions for LLVM <14 were ironed
out, so building LLVM through from the monorepo is quite simple now.
- Most expressions only required minor changes, mostly removing the
special casing for `sourceRoot`.
- The patch lists from llvm/12/default.nix were ported to
common/default.nix. This only required a few extra conditionals which
could be reduced via a rebuild also involving other LLVM versions.
Outstanding tasks of little urgency have been noted in TODO comments.
I have verified that the patch lists stay the same for all packages
except LLVM where merely the order changes. An extra set of eyes
is appreciated, of course.
- clang: The expression was reworked to use the same symlink location
for clang-tools-extra for all versions including LLVM 12. This
required adjusting the ad hoc patching of the clangd cmake files
slightly.
- libunwind: We no longer need to make the libcxx sources available
manually. We can rely on the monorepo source instead.
- lld: We no longer need to make the libunwind sources available manually.
- llvm: We no longer need to make the polly sources available manually
- On Darwin, we need to bypass CMake's C++ compiler for libcxx and
libunwind now. It isn't a 100% clear why, probably because we've
started to use Darwin's bootstrapStdenv for libcxx in the common
expression compared to LLVM 12 on master [1].
The reordering of flags for wasm causes a rebuild for some packages
like firefox, but this should be tolerable on staging.
[1]: 665ebfb253/pkgs/development/compilers/llvm/12/default.nix (L392-L430)
(cherry picked from commit ee9eacf23e)
(cherry picked from commit c4e9f17ef9)
Pull #320261 introduced the possibility to consistently override
dependencies within an llvm package set. This is useful for development
and testing exotic configurations.
Go one step further and enable overriding targetLlvmLibraries.
This makes it possible to write an overlay such as:
```nix
overlays = [
(self: super: {
llvmPackages = super.llvmPackages.override (prev: {
targetLlvmLibraries = super.targetPackages.llvmPackages.libraries // {
compiler-rt = super.targetPackages.llvmPackages.libraries.compiler-rt.override {
...
}
};
});
})
];
```
... where the overridden compiler-rt will be used in a pkgsLLVM build.
As a straw man, I've done the minimally invasive thing to the code
structure: `targetLlvmLibraries` is not an explicitly named parameter
for llvmPackages; but it is available in `packageSetArgs` if passed.
This makes it slightly less discoverable, but this seems like a
reasonable tradeoff considered that modifying this would be a fairly
advanced/esoteric thing to need to do.
In some ways it would be better to have as an explicit parameter with a
default, but the obvious thing won't work because the default needs to
be a non-trivial expression. Potentially we could instead have it as a
defaulted parameter with the value of 'null', and if it's null, then
compute the current thing.
Signed-off-by: Peter Waller <p@pwaller.net>
Pull #320261 introduced the possibility to consistently override
dependencies within an llvm package set. I think #325175 accidentally
dropped this, so reinstate it.
Signed-off-by: Peter Waller <p@pwaller.net>
Now most packages in the llvm suite are built as separate derivations.
The exceptions are:
* compiler-rt must currently be built with llvm. This increases llvm's
size by 6 MB
* clang-tools-extra must be built with clang
In addition, the top-level llvm attribute is defaulted to llvm 3.4, and
llvm 3.3 must be accessed by the llvm_33 attribute. This is to make the
out-of-date packages obvious in the hope that eventually all will be
updated to work with 3.4 and 3.3 can be removed. I think we should keep
this policy in the future (latest llvm gets top-level name, the rest are
versioned until they can be removed).
The llvm packages (except libc++, which exception I will try to remove
on the next update) can all be accessed via the llvmPackages attribute,
and there are also aliases for the packages that already existed (llvm,
clang, and dragonegg).
Signed-off-by: Shea Levy <shea@shealevy.com>
Some packages in the llvm suite (e.g. compiler-rt) cannot be built
separate from the build of llvm, and while some others (e.g. clang) can
the combined build is much better tested (we've had to work around
annoying issues before). So this puts llvm, clang, clang-tools-extra,
compiler-rt, lld, lldb, and polly all into one big build (llvmFull).
This build includes a static llvm, as dynamic is similarly less tested
and has known failures.
This also updates libc++ and dragonegg. libc++ now builds against
libc++abi as a separate package rather than building it during the
libc++ build.
The clang purity patch is gone. Instead, we simply set --sysroot to
/var/empty for pure builds, as all impure paths are either looked up in
the gcc prefix (which we hard-code at compile time) or in the sysroot.
This also means that if NIX_ENFORCE_PURITY is 0 then clang will look in
the normal Linux paths by default, which is the proper behavior IMO.
polly required an updated isl. When stdenv-updates is merged, perhaps we
can update the isl used by gcc and avoid having two versions.
Since llvm on its own is now separate from the llvm used by clang, I've
removed myself as maintainer from llvm and will leave maintenance of
that to those who are interested in llvm separate from clang.
Signed-off-by: Shea Levy <shea@shealevy.com>
The 3.4 code was tested preliminary in x-updates,
described by 2e4eab1228.
Updates to llvm break builds of dependent packages (in all cases I've seen),
and often upstream isn't too fast in porting to the newest version.
Consequently, it seems better to keep more versions (two ATM),
both in one file to share eventual changes.
Also, using versioned llvm_* attributes is proposed because of this.
Conflicts (a little tricky, I did some cleanup of interacting changes):
pkgs/development/compilers/llvm/default.nix
pkgs/development/libraries/libpng/default.nix
pkgs/tools/package-management/nixops/default.nix
pkgs/top-level/all-packages.nix