|
16 | 16 | then null |
17 | 17 | else pkgs.bintools |
18 | 18 | , darwin |
| 19 | +# LLVM release information; specify one of these but not both: |
| 20 | +, gitRelease ? null |
| 21 | + # i.e.: |
| 22 | + # { |
| 23 | + # version = /* i.e. "15.0.0" */; |
| 24 | + # rev = /* commit SHA */; |
| 25 | + # rev-version = /* human readable version; i.e. "unstable-2022-26-07" */; |
| 26 | + # sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */; |
| 27 | + # } |
| 28 | +, officialRelease ? { version = "13.0.1"; sha256 = "06dv6h5dmvzdxbif2s8njki6h32796v368dyb5945x8gjj72xh7k"; } |
| 29 | + # i.e.: |
| 30 | + # { |
| 31 | + # version = /* i.e. "15.0.0" */; |
| 32 | + # candidate = /* optional; if specified, should be: "rcN" */ |
| 33 | + # sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */; |
| 34 | + # } |
| 35 | +# By default, we'll try to fetch a release from `github:llvm/llvm-project` |
| 36 | +# corresponding to the `gitRelease` or `officialRelease` specified. |
| 37 | +# |
| 38 | +# You can provide your own LLVM source by specifying this arg but then it's up |
| 39 | +# to you to make sure that the LLVM repo given matches the release configuration |
| 40 | +# specified. |
| 41 | +, monorepoSrc ? null |
| 42 | + |
19 | 43 | }: |
20 | 44 |
|
| 45 | +assert let |
| 46 | + int = a: if a then 1 else 0; |
| 47 | + xor = a: b: ((builtins.bitXor (int a) (int b)) == 1); |
| 48 | +in |
| 49 | + lib.assertMsg |
| 50 | + (xor |
| 51 | + (gitRelease != null) |
| 52 | + (officialRelease != null)) |
| 53 | + ("must specify `gitRelease` or `officialRelease`" + |
| 54 | + (lib.optionalString (gitRelease != null) " — not both")); |
21 | 55 | let |
22 | | - release_version = "13.0.1"; |
23 | | - candidate = ""; # empty or "rcN" |
24 | | - dash-candidate = lib.optionalString (candidate != "") "-${candidate}"; |
25 | | - rev = ""; # When using a Git commit |
26 | | - rev-version = ""; # When using a Git commit |
27 | | - version = if rev != "" then rev-version else "${release_version}${dash-candidate}"; |
28 | | - targetConfig = stdenv.targetPlatform.config; |
29 | | - |
30 | | - src = fetchFromGitHub { |
31 | | - owner = "llvm"; |
32 | | - repo = "llvm-project"; |
33 | | - rev = if rev != "" then rev else "llvmorg-${version}"; |
34 | | - sha256 = "06dv6h5dmvzdxbif2s8njki6h32796v368dyb5945x8gjj72xh7k"; |
35 | | - }; |
36 | | - |
37 | | - inherit (import ../common/common-let.nix { inherit lib release_version; }) llvm_meta; |
| 56 | + monorepoSrc' = monorepoSrc; |
| 57 | +in let |
| 58 | + # Import releaseInfo separately to avoid infinite recursion |
| 59 | + inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; |
| 60 | + inherit (releaseInfo) release_version version; |
| 61 | + inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc; |
| 62 | + |
| 63 | + src = monorepoSrc; |
38 | 64 |
|
39 | 65 | tools = lib.makeExtensible (tools: let |
40 | 66 | callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version src buildLlvmTools; }); |
|
0 commit comments