diff options
author | Artturin <Artturin@artturin.com> | 2023-11-21 01:44:34 +0200 |
---|---|---|
committer | Artturin <Artturin@artturin.com> | 2023-11-21 01:46:51 +0200 |
commit | c1e1a583a02f1a7ee34b822a09ee2a5bae184396 (patch) | |
tree | 83a4f5a3906045fb5075bb1104c7216f91ec3e71 /pkgs/development/compilers/llvm | |
parent | e6751897e0209add93b7ee9725e7479dea25c873 (diff) | |
download | nixlib-c1e1a583a02f1a7ee34b822a09ee2a5bae184396.tar nixlib-c1e1a583a02f1a7ee34b822a09ee2a5bae184396.tar.gz nixlib-c1e1a583a02f1a7ee34b822a09ee2a5bae184396.tar.bz2 nixlib-c1e1a583a02f1a7ee34b822a09ee2a5bae184396.tar.lz nixlib-c1e1a583a02f1a7ee34b822a09ee2a5bae184396.tar.xz nixlib-c1e1a583a02f1a7ee34b822a09ee2a5bae184396.tar.zst nixlib-c1e1a583a02f1a7ee34b822a09ee2a5bae184396.zip |
llvmPackages_{13,14}: Use releaseInfo and monorepoSrc
Doing the same thing as was done in the initial adding of `monorepoSrc` to `llvmPackages_15` d231d18e4aa5e1d00f86b4f484f9e4344538e3ea
Diffstat (limited to 'pkgs/development/compilers/llvm')
-rw-r--r-- | pkgs/development/compilers/llvm/13/default.nix | 58 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/14/default.nix | 55 |
2 files changed, 81 insertions, 32 deletions
diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index 0469b77fe425..0a1b90fc9fd4 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -16,25 +16,51 @@ then null else pkgs.bintools , darwin +# LLVM release information; specify one of these but not both: +, gitRelease ? null + # i.e.: + # { + # version = /* i.e. "15.0.0" */; + # rev = /* commit SHA */; + # rev-version = /* human readable version; i.e. "unstable-2022-26-07" */; + # sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */; + # } +, officialRelease ? { version = "13.0.1"; sha256 = "06dv6h5dmvzdxbif2s8njki6h32796v368dyb5945x8gjj72xh7k"; } + # i.e.: + # { + # version = /* i.e. "15.0.0" */; + # candidate = /* optional; if specified, should be: "rcN" */ + # sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */; + # } +# By default, we'll try to fetch a release from `github:llvm/llvm-project` +# corresponding to the `gitRelease` or `officialRelease` specified. +# +# You can provide your own LLVM source by specifying this arg but then it's up +# to you to make sure that the LLVM repo given matches the release configuration +# specified. +, monorepoSrc ? null + }: +assert let + int = a: if a then 1 else 0; + xor = a: b: ((builtins.bitXor (int a) (int b)) == 1); +in + lib.assertMsg + (xor + (gitRelease != null) + (officialRelease != null)) + ("must specify `gitRelease` or `officialRelease`" + + (lib.optionalString (gitRelease != null) " — not both")); let - release_version = "13.0.1"; - candidate = ""; # empty or "rcN" - dash-candidate = lib.optionalString (candidate != "") "-${candidate}"; - rev = ""; # When using a Git commit - rev-version = ""; # When using a Git commit - version = if rev != "" then rev-version else "${release_version}${dash-candidate}"; - targetConfig = stdenv.targetPlatform.config; - - src = fetchFromGitHub { - owner = "llvm"; - repo = "llvm-project"; - rev = if rev != "" then rev else "llvmorg-${version}"; - sha256 = "06dv6h5dmvzdxbif2s8njki6h32796v368dyb5945x8gjj72xh7k"; - }; - - inherit (import ../common/common-let.nix { inherit lib release_version; }) llvm_meta; + monorepoSrc' = monorepoSrc; +in let + # Import releaseInfo separately to avoid infinite recursion + inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; + inherit (releaseInfo) release_version version; + inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc; + + src = monorepoSrc; tools = lib.makeExtensible (tools: let callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version src buildLlvmTools; }); diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index 442b0f731579..da37ce0ef1e2 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -16,25 +16,48 @@ then null else pkgs.bintools , darwin +# LLVM release information; specify one of these but not both: +, gitRelease ? null + # i.e.: + # { + # version = /* i.e. "15.0.0" */; + # rev = /* commit SHA */; + # rev-version = /* human readable version; i.e. "unstable-2022-26-07" */; + # sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */; + # } +, officialRelease ? { version = "14.0.6"; sha256 = "sha256-vffu4HilvYwtzwgq+NlS26m65DGbp6OSSne2aje1yJE="; } + # i.e.: + # { + # version = /* i.e. "15.0.0" */; + # candidate = /* optional; if specified, should be: "rcN" */ + # sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */; + # } +# By default, we'll try to fetch a release from `github:llvm/llvm-project` +# corresponding to the `gitRelease` or `officialRelease` specified. +# +# You can provide your own LLVM source by specifying this arg but then it's up +# to you to make sure that the LLVM repo given matches the release configuration +# specified. +, monorepoSrc ? null }: +assert let + int = a: if a then 1 else 0; + xor = a: b: ((builtins.bitXor (int a) (int b)) == 1); +in + lib.assertMsg + (xor + (gitRelease != null) + (officialRelease != null)) + ("must specify `gitRelease` or `officialRelease`" + + (lib.optionalString (gitRelease != null) " — not both")); let - release_version = "14.0.6"; - candidate = ""; # empty or "rcN" - dash-candidate = lib.optionalString (candidate != "") "-${candidate}"; - rev = ""; # When using a Git commit - rev-version = ""; # When using a Git commit - version = if rev != "" then rev-version else "${release_version}${dash-candidate}"; - targetConfig = stdenv.targetPlatform.config; - - monorepoSrc = fetchFromGitHub { - owner = "llvm"; - repo = "llvm-project"; - rev = if rev != "" then rev else "llvmorg-${version}"; - sha256 = "sha256-vffu4HilvYwtzwgq+NlS26m65DGbp6OSSne2aje1yJE="; - }; - - inherit (import ../common/common-let.nix { inherit lib; }) llvm_meta; + monorepoSrc' = monorepoSrc; +in let + # Import releaseInfo separately to avoid infinite recursion + inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; + inherit (releaseInfo) release_version version; + inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc; tools = lib.makeExtensible (tools: let callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 release_version version monorepoSrc buildLlvmTools; }); |