mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 18:33:00 +00:00
5f134ec6cf
For a long time, we've had `crossLibcStdenv`, `*Cross` libc attributes, and `*bsdCross` pre-libc package sets. This was always bad because having "cross" things is "not declarative": the naming doesn't reflect what packages *need* but rather how we *provide* something. This is ugly, and creates needless friction between cross and native building. Now, almost all of these `*Cross` attributes are gone: just these are kept: - Glibc's and Musl's are kept, because those packages are widely used and I didn't want to risk changing the native builds of those at this time. - generic `libcCross`, `theadsCross`, and friends, because these relate to the convolulted GCC bootstrap which still needs to be redone. The BSD and obscure Linux or freestnanding libcs have conversely all been made to use a new `stdenvNoLibc`, which is like the old `crossLibcStdenv` except: 1. It usable for native and cross alike 2. It named according to what it *is* ("a standard environment without libc but with a C compiler"), rather than some non-compositional jargon ("the stdenv used for building libc when cross compiling", yuck). I should have done this change long ago, but I was stymied because of "infinite recursions". The problem was that in too many cases we are overriding `stdenv` to *remove* things we don't need, and this risks cyles since those more minimal stdenvs are used to build things in the more maximal stdenvs. The solution is to pass `stage.nix` `stdenvNoCC`, so we can override to *build up* rather than *tear down*. For now, the full `stdenv` is also passed, so I don't need to change the native bootstraps, but I can see this changing as we make things more uniform and clean those up. (adapted from commit51f1ecaa59
) (adapted from commit1743662e55
)
37 lines
921 B
Nix
37 lines
921 B
Nix
{ stdenv, fetchFromGitHub, stdenvNoLibc, buildPackages }:
|
|
|
|
stdenvNoLibc.mkDerivation {
|
|
name = "newlib";
|
|
src = fetchFromGitHub {
|
|
owner = "openrisc";
|
|
repo = "newlib";
|
|
rev = "8ac94ca7bbe4ceddafe6583ee4766d3c15b18ac8";
|
|
sha256 = "0hzhijmry5slpp6x12pgng8v7jil3mn18ahrhnw431lqrs1cma0s";
|
|
};
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
# newlib expects CC to build for build platform, not host platform
|
|
preConfigure = ''
|
|
export CC=cc
|
|
'';
|
|
|
|
configurePlatforms = [ "build" "target" ];
|
|
configureFlags = [
|
|
"--host=${stdenv.buildPlatform.config}"
|
|
|
|
"--disable-newlib-supplied-syscalls"
|
|
"--disable-nls"
|
|
"--enable-newlib-io-long-long"
|
|
"--enable-newlib-register-fini"
|
|
"--enable-newlib-retargetable-locking"
|
|
];
|
|
|
|
dontDisableStatic = true;
|
|
|
|
passthru = {
|
|
incdir = "/${stdenv.targetPlatform.config}/include";
|
|
libdir = "/${stdenv.targetPlatform.config}/lib";
|
|
};
|
|
}
|