llvmPackages_git: Build from Git

The version will initially remain the same so that no additional changes
to the packaging are required (i.e. this commit only includes the
required changes to build from the mono repository instead of individual
tarballs).
This commit is contained in:
Michael Weiss 2021-04-26 19:18:45 +02:00
parent e458a01401
commit a7f062d898
No known key found for this signature in database
GPG Key ID: 5BE487C4D4771D83
10 changed files with 40 additions and 77 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
{ lib, stdenv, llvm_meta, src, cmake, libxml2, libllvm, version, python3
, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
@ -9,15 +9,8 @@ let
pname = "clang";
inherit version;
src = fetch "clang" "1vd9rhhrd8ghdg111lac7w8by71y9l14yh5zxfijsm6lj4p4avp2";
inherit clang-tools-extra_src;
unpackPhase = ''
unpackFile $src
mv clang-* clang
sourceRoot=$PWD/clang
unpackFile ${clang-tools-extra_src}
'';
inherit src;
sourceRoot = "source/clang";
nativeBuildInputs = [ cmake python3 ]
++ lib.optional enableManpages python3.pkgs.sphinx

View File

@ -1,4 +1,4 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, llvm, libcxxabi }:
{ lib, stdenv, llvm_meta, version, src, cmake, python3, llvm, libcxxabi }:
let
@ -12,7 +12,9 @@ in
stdenv.mkDerivation {
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
inherit version;
src = fetch "compiler-rt" "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45";
inherit src;
sourceRoot = "source/compiler-rt";
nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;

View File

@ -1,6 +1,6 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
, gccForLibs, preLibcCrossHeaders
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
, libxml2, python3, isl, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
# This is the default binutils, but with *this* version of LLD rather
@ -24,13 +24,13 @@ let
version = "${release_version}${dash-candidate}"; # differentiating these (variables) is important for RCs
targetConfig = stdenv.targetPlatform.config;
fetch = name: sha256: fetchurl {
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/${name}-${release_version}${candidate}.src.tar.xz";
inherit sha256;
src = fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
rev = "llvmorg-${version}";
sha256 = "07jz8pywc2qqa1srdnqg5p2y4lx3ki1inpigarzgxc3j20r4gb58";
};
clang-tools-extra_src = fetch "clang-tools-extra" "0p3dzr0qa7mar83y66xa5m5apynf6ia0lsdsq6axwnm64ysy0hdd";
llvm_meta = {
license = lib.licenses.ncsa;
maintainers = with lib.maintainers; [ lovek323 raskin dtzWill primeos ];
@ -38,7 +38,7 @@ let
};
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version src buildLlvmTools; });
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
@ -70,7 +70,7 @@ let
llvm = tools.libllvm.out // { outputUnspecified = true; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
inherit llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
@ -116,7 +116,6 @@ let
lld = callPackage ./lld {
inherit llvm_meta;
inherit (libraries) libunwind;
};
lldb = callPackage ./lldb {
@ -214,7 +213,7 @@ let
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version src; });
in {
compiler-rt-libc = callPackage ./compiler-rt {
@ -256,7 +255,6 @@ let
libunwind = callPackage ./libunwind {
inherit llvm_meta;
inherit (buildLlvmTools) llvm;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
else stdenv;

View File

@ -1,19 +1,13 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta, src, cmake, python3, libcxxabi, fixDarwinDylibNames, version
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "libcxx";
inherit version;
src = fetch "libcxx" "1wf3ww29xkx7prs7pdwicy5qqfapib26110jgmkjrbka9z57bjvx";
postUnpack = ''
unpackFile ${libcxxabi.src}
mv libcxxabi-* libcxxabi
unpackFile ${llvm.src}
mv llvm-* llvm
'';
inherit src;
sourceRoot = "source/${pname}";
outputs = [ "out" "dev" ];

View File

@ -1,21 +1,17 @@
{ lib, stdenv, llvm_meta, cmake, python3, fetch, libcxx, libunwind, llvm, version
{ lib, stdenv, llvm_meta, cmake, python3, src, libunwind, version
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "libcxxabi";
inherit version;
src = fetch "libcxxabi" "1cbmzspwjlr8f6sp73pw6ivf4dpg6rpc61by0q1m2zca2k6yif3a";
inherit src;
sourceRoot = "source/${pname}";
outputs = [ "out" "dev" ];
postUnpack = ''
unpackFile ${libcxx.src}
mv libcxx-* libcxx
unpackFile ${llvm.src}
mv llvm-* llvm
'' + lib.optionalString stdenv.isDarwin ''
postUnpack = lib.optionalString stdenv.isDarwin ''
export TRIPLE=x86_64-apple-darwin
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d libcxx -i ${../../libcxx-0001-musl-hacks.patch}

View File

@ -1,4 +1,4 @@
{ lib, stdenv, llvm_meta, version, fetch, libcxx, llvm, cmake
{ lib, stdenv, llvm_meta, version, src, cmake
, enableShared ? !stdenv.hostPlatform.isStatic
}:
@ -6,14 +6,8 @@ stdenv.mkDerivation rec {
pname = "libunwind";
inherit version;
src = fetch pname "1x8wpmsrsgnwj2v5ih52ylni7r6n8gzkcj6hx65zbxski2rablly";
postUnpack = ''
unpackFile ${libcxx.src}
mv libcxx-* libcxx
unpackFile ${llvm.src}
mv llvm-* llvm
'';
inherit src;
sourceRoot = "source/${pname}";
patches = [
./gnu-install-dirs.patch

View File

@ -1,7 +1,6 @@
{ lib, stdenv, llvm_meta
, buildLlvmTools
, fetch
, libunwind
, src
, cmake
, libxml2
, libllvm
@ -12,19 +11,13 @@ stdenv.mkDerivation rec {
pname = "lld";
inherit version;
src = fetch pname "1zakyxk5bwnh7jarckcd4rbmzi58jgn2dbah5j5cwcyfyfbx9drc";
inherit src;
sourceRoot = "source/${pname}";
patches = [
./gnu-install-dirs.patch
];
postPatch = ''
substituteInPlace MachO/CMakeLists.txt --replace \
'(''${LLVM_MAIN_SRC_DIR}/' '('
mkdir -p libunwind/include
tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/"
'';
nativeBuildInputs = [ cmake ];
buildInputs = [ libllvm libxml2 ];

View File

@ -1,6 +1,6 @@
{ lib, stdenv, llvm_meta
, runCommand
, fetch
, src
, cmake
, zlib
, ncurses
@ -26,7 +26,8 @@ stdenv.mkDerivation (rec {
pname = "lldb";
inherit version;
src = fetch pname "1v85qyq3snk81vjmwq5q7xikyyqsfpqy2c4qmr81mps4avsw1g0l";
inherit src;
sourceRoot = "source/${pname}";
patches = [
./procfs.patch

View File

@ -1,6 +1,6 @@
{ lib, stdenv, llvm_meta
, pkgsBuildBuild
, fetch
, src
, fetchpatch
, cmake
, python3
@ -34,17 +34,8 @@ in stdenv.mkDerivation (rec {
pname = "llvm";
inherit version;
src = fetch pname "0l4b79gwfvxild974aigcq1yigypjsk2j5p59syhl6ksd744gp29";
polly_src = fetch "polly" "1ixl9yj526n8iqh9ckyiah2vzravs9d1akybqq7rvy32n9vgr6hd";
unpackPhase = ''
unpackFile $src
mv llvm-${release_version}* llvm
sourceRoot=$PWD/llvm
'' + optionalString enablePolly ''
unpackFile $polly_src
mv polly-* $sourceRoot/tools/polly
'';
inherit src;
sourceRoot = "source/${pname}";
outputs = [ "out" "lib" "dev" "python" ];

View File

@ -1,7 +1,7 @@
{ lib
, stdenv
, llvm_meta
, fetch
, src
, cmake
, llvm
, perl
@ -12,7 +12,8 @@ stdenv.mkDerivation rec {
pname = "openmp";
inherit version;
src = fetch pname "0z8n1wanby6aq3i7d91mgk72hb33zfl5blayk0a22cs7l8i706zb";
inherit src;
sourceRoot = "source/${pname}";
nativeBuildInputs = [ cmake perl ];
buildInputs = [ llvm ];