Last active
May 1, 2022 01:43
-
-
Save yvt/e325b65db5fcd0ca27ea7294f9dfbba4 to your computer and use it in GitHub Desktop.
Nix code to build a patched version of `libgccjit.so` for <https://github.com/rust-lang/rustc_codegen_gcc>
This file contains 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
with import <nixpkgs> {}; | |
with lib; | |
let | |
antoyoGccRev = "72cb89f82a6c9c5471f0b2c122b21dbe387c7904"; | |
gccjit = (gcc11.cc.overrideAttrs (oldAttrs: oldAttrs // { | |
src = fetchFromGitHub { | |
owner = "antoyo"; | |
repo = "gcc"; | |
rev = antoyoGccRev; | |
sha256 = "+h/ezfeEs+VoPjK1nl3LKk+proeGaoNQEduwZ+2aJos="; | |
}; | |
name = "libgccjit"; | |
version = antoyoGccRev; | |
nativeBuildInputs = oldAttrs.nativeBuildInputs | |
++ [ flex ]; | |
prePatch = '' | |
mv gcc/gcc.cc gcc/gcc.c | |
mv gcc/cppdefault.cc gcc/cppdefault.c | |
''; | |
postPatch = oldAttrs.postPatch + '' | |
mv gcc/gcc.c gcc/gcc.cc | |
mv gcc/cppdefault.c gcc/cppdefault.cc | |
''; | |
configureFlags = oldAttrs.configureFlags ++ | |
[ "--disable-werror" ]; | |
})).override { | |
langFortran = false; | |
langCC = false; | |
langC = false; | |
profiledCompiler = false; | |
langJit = true; | |
enableLTO = false; | |
# noSysDirs = false; | |
}; | |
in | |
runCommand "dummy" rec { | |
buildInputs = [ | |
gccjit | |
]; | |
GCC_PATH = "${gccjit}/lib"; | |
} "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment