You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkgs/development/compilers/llvm/README.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,3 +77,22 @@ Instead of applying the patches to the worktree per the above instructions, one
77
77
For newer LLVM versions, enough has has been upstreamed,
78
78
(see https://reviews.llvm.org/differential/query/5UAfpj_9zHwY/ for my progress upstreaming),
79
79
that I have just assembled new gnu-install-dirs patches from the remaining unmerged patches instead of rebasing from the prior LLVM's gnu install dirs patch.
80
+
81
+
## Adding a patch
82
+
83
+
To add an LLVM patch in the Nixpkgs tree,
84
+
85
+
1. Put the patch in the corresponding directory (`<VERSION>/<PACKAGE>`).
86
+
87
+
_Example_: If you want your patch to apply to clang version 12 (and, optionally, later versions), put it in`./12/clang`.
88
+
2. Add the patch to the `patches` argument of the corresponding package in`./common`, guarded by a `lib.optionals` with the desired version constraints, passed through the `getVersionFile` function.
89
+
90
+
_Example_: If you want the patch `./12/llvm/fix-llvm-issue-49955.patch` to apply to LLVM 12, add `lib.optional (lib.versions.major release_version == "12") (getVersionFile "llvm/fix-llvm-issue-49955.patch")` to `./common/llvm/default.nix`.
91
+
3. If you wish forthis single patch to apply to multiple versions of the package, extend the conditionsin the `lib.optional` guard and add the corresponding constraints to `./common/patches.nix`; note that `after` is inclusive and `before` is exclusive.
92
+
93
+
_Example_:
94
+
If you want the patch `./12/clang/purity.patch` to apply to versions 12, 13 and 14, you have to
95
+
- Modify the guard in`./common/clang/default.nix` as follows: `lib.optional (lib.versionAtLeast release_version "12"&& lib.versionOlder release_version "15")`
96
+
- Add `{ "clang/purity.patch" = [ { after = 12; before = 15; path = ../12; } ]; }` to `common/patches.nix`.
97
+
You may have multiple different patches with the same name that would apply to different versions;in that case, add the necessary constraints to `common/patches.nix`.
0 commit comments