Skip to content

Commit c1e1a58

Browse files
committed
llvmPackages_{13,14}: Use releaseInfo and monorepoSrc
Doing the same thing as was done in the initial adding of `monorepoSrc` to `llvmPackages_15` d231d18
1 parent e675189 commit c1e1a58

2 files changed

Lines changed: 81 additions & 32 deletions

File tree

pkgs/development/compilers/llvm/13/default.nix

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,51 @@
1616
then null
1717
else pkgs.bintools
1818
, 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+
1943
}:
2044

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"));
2155
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;
3864

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

pkgs/development/compilers/llvm/14/default.nix

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,48 @@
1616
then null
1717
else pkgs.bintools
1818
, 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 = "14.0.6"; sha256 = "sha256-vffu4HilvYwtzwgq+NlS26m65DGbp6OSSne2aje1yJE="; }
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
1942
}:
2043

44+
assert let
45+
int = a: if a then 1 else 0;
46+
xor = a: b: ((builtins.bitXor (int a) (int b)) == 1);
47+
in
48+
lib.assertMsg
49+
(xor
50+
(gitRelease != null)
51+
(officialRelease != null))
52+
("must specify `gitRelease` or `officialRelease`" +
53+
(lib.optionalString (gitRelease != null) " — not both"));
2154
let
22-
release_version = "14.0.6";
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-
monorepoSrc = fetchFromGitHub {
31-
owner = "llvm";
32-
repo = "llvm-project";
33-
rev = if rev != "" then rev else "llvmorg-${version}";
34-
sha256 = "sha256-vffu4HilvYwtzwgq+NlS26m65DGbp6OSSne2aje1yJE=";
35-
};
36-
37-
inherit (import ../common/common-let.nix { inherit lib; }) llvm_meta;
55+
monorepoSrc' = monorepoSrc;
56+
in let
57+
# Import releaseInfo separately to avoid infinite recursion
58+
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
59+
inherit (releaseInfo) release_version version;
60+
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
3861

3962
tools = lib.makeExtensible (tools: let
4063
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 release_version version monorepoSrc buildLlvmTools; });

0 commit comments

Comments
 (0)