Created
May 3, 2023 22:48
-
-
Save rrbutani/ca327f2a76873341bd6b2a223d9cef2b to your computer and use it in GitHub Desktop.
https://github.com/NixOS/nixpkgs/pull/216273 as an overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import ./. {} }: let | |
overlay = f: p: let base = p.llvmPackages_15; in { | |
llvmPackages_15 = let | |
patch = f.fetchpatch { | |
url = "https://github.com/llvm/llvm-project/commit/57c7bb3ec89565c68f858d316504668f9d214d59.patch"; | |
hash = "sha256-AaM9A6tQ4YAw7uDqCIV4VaiUyLZv+unwcOqbakwW9/k="; | |
relative = "libcxx"; | |
}; | |
tools = base.tools; | |
libraries = base.libraries.extend (fin: prev: { | |
libcxx = prev.libcxx.overrideAttrs (old: let | |
inherit (prev.libcxx) cxxabi; | |
libcxx_cxx_abi_options = { | |
"c++abi" = { name = "system-libcxxabi"; headers = "${cxxabi.dev}/include/c++/v1"; }; | |
"cxxrt" = { name = "libcxxrt"; headers = "${cxxabi}/include"; }; | |
}.${cxxabi.libName} or (throw "unknown cxxabi: ${cxxabi.libName} (${cxxabi.pname})"); | |
in { | |
# https://github.com/NixOS/nixpkgs/pull/216273/commits/6828e2353b60bf1e1951ca4516a4ed735d162db8 | |
cmakeFlags = f.lib.pipe old.cmakeFlags [ | |
(map (x: [x])) | |
(map (x: if f.lib.hasPrefix "-DLIBCXX_CXX_ABI=" (builtins.head x) | |
then [ | |
"-DLIBCXX_CXX_ABI=${libcxx_cxx_abi_options.name}" | |
"-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${libcxx_cxx_abi_options.headers}" | |
"-DLIBCXX_CXX_ABI_LIBRARY_PATH=${cxxabi}/lib" | |
] | |
else if f.lib.hasPrefix "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=" (builtins.head x) then [] | |
else [x] | |
)) | |
f.lib.flatten | |
]; | |
# https://github.com/NixOS/nixpkgs/pull/216273/commits/99b2500ca56fd269396e5388fdd5c2550b48d033 | |
patches = old.patches ++ [ patch ]; # watch out for musl | |
}); | |
libcxxabi = prev.libcxxabi.override (o: { | |
cxx-headers = o.cxx-headers.overrideAttrs (old: { | |
patches = old.patches ++ [ patch ]; | |
}); | |
}); | |
}); | |
in { | |
inherit tools libraries; | |
inherit (base) release_version; | |
} // libraries // tools; | |
}; | |
in (pkgs.extend overlay).llvmPackages_15.libcxxClang |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment