freebsd: set BOOTSTRAPPING when building for Linux (#337351)

This commit is contained in:
John Ericson 2024-11-26 17:58:42 -05:00 committed by GitHub
commit ad1320e259
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 48 additions and 53 deletions

View File

@ -23,6 +23,4 @@ mkDerivation {
install
m4
];
BOOTSTRAPPING = !stdenv.hostPlatform.isFreeBSD;
}

View File

@ -9,31 +9,28 @@
makeMinimal,
install,
}:
mkDerivation (
{
path = "usr.bin/localedef";
mkDerivation ({
path = "usr.bin/localedef";
extraPaths = [
"lib/libc/locale"
"lib/libc/stdtime"
] ++ lib.optionals (!stdenv.hostPlatform.isFreeBSD) [ "." ];
extraPaths = [
"lib/libc/locale"
"lib/libc/stdtime"
] ++ lib.optionals (!stdenv.hostPlatform.isFreeBSD) [ "." ];
nativeBuildInputs = [
bsdSetupHook
byacc
freebsdSetupHook
makeMinimal
install
];
nativeBuildInputs = [
bsdSetupHook
byacc
freebsdSetupHook
makeMinimal
install
];
buildInputs = [ ];
buildInputs = [ ];
preBuild = lib.optionalString (!stdenv.hostPlatform.isFreeBSD) ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${compat}/include -D__unused= -D__pure= -Wno-strict-aliasing"
export NIX_LDFLAGS="$NIX_LDFLAGS -L${compat}/lib"
'';
preBuild = lib.optionalString (!stdenv.hostPlatform.isFreeBSD) ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${compat}/include -D__unused= -D__pure= -Wno-strict-aliasing"
export NIX_LDFLAGS="$NIX_LDFLAGS -L${compat}/lib"
'';
MK_TESTS = "no";
}
// lib.optionalAttrs (!stdenv.hostPlatform.isFreeBSD) { BOOTSTRAPPING = 1; }
)
MK_TESTS = "no";
})

View File

@ -56,8 +56,6 @@ lib.makeOverridable (
] ++ attrs.extraNativeBuildInputs or [ ];
buildInputs = compatIfNeeded;
HOST_SH = stdenv'.shell;
makeFlags =
[
"STRIP=-s" # flag to install, not command
@ -65,14 +63,36 @@ lib.makeOverridable (
++ lib.optional (!stdenv'.hostPlatform.isFreeBSD) "MK_WERROR=no"
++ lib.optional stdenv.hostPlatform.isStatic "SHLIB_NAME=";
# amd64 not x86_64 for this on unlike NetBSD
MACHINE_ARCH = freebsd-lib.mkBsdArch stdenv';
env =
{
HOST_SH = stdenv'.shell;
MACHINE = freebsd-lib.mkBsdMachine stdenv';
# amd64 not x86_64 for this on unlike NetBSD
MACHINE_ARCH = freebsd-lib.mkBsdArch stdenv';
MACHINE_CPUARCH = freebsd-lib.mkBsdCpuArch stdenv';
MACHINE = freebsd-lib.mkBsdMachine stdenv';
COMPONENT_PATH = attrs.path or null;
MACHINE_CPUARCH = freebsd-lib.mkBsdCpuArch stdenv';
COMPONENT_PATH = attrs.path or null;
}
// lib.optionalAttrs stdenv'.hasCC {
# TODO should CC wrapper set this?
CPP = "${stdenv'.cc.targetPrefix}cpp";
# Since STRIP in `makeFlags` has to be a flag, not the binary itself
STRIPBIN = "${stdenv'.cc.bintools.targetPrefix}strip";
}
// lib.optionalAttrs (!stdenv.hostPlatform.isFreeBSD) { BOOTSTRAPPING = true; }
// lib.optionalAttrs stdenv'.hostPlatform.isDarwin { MKRELRO = "no"; }
// lib.optionalAttrs (stdenv'.cc.isClang or false) {
HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc);
}
// lib.optionalAttrs (stdenv'.cc.isGNU or false) {
HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc);
}
// lib.optionalAttrs (stdenv'.hostPlatform.isx86_32) { USE_SSP = "no"; }
// (attrs.env or { });
strictDeps = true;
@ -85,26 +105,11 @@ lib.makeOverridable (
license = lib.licenses.bsd2;
} // attrs.meta or { };
}
// lib.optionalAttrs stdenv'.hasCC {
# TODO should CC wrapper set this?
CPP = "${stdenv'.cc.targetPrefix}cpp";
# Since STRIP in `makeFlags` has to be a flag, not the binary itself
STRIPBIN = "${stdenv'.cc.bintools.targetPrefix}strip";
}
// lib.optionalAttrs stdenv'.hostPlatform.isDarwin { MKRELRO = "no"; }
// lib.optionalAttrs (stdenv'.cc.isClang or false) {
HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc);
}
// lib.optionalAttrs (stdenv'.cc.isGNU or false) {
HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc);
}
// lib.optionalAttrs (stdenv'.hostPlatform.isx86_32) { USE_SSP = "no"; }
// lib.optionalAttrs (attrs.headersOnly or false) {
installPhase = "includesPhase";
dontBuild = true;
}
// attrs
// (builtins.removeAttrs attrs [ "env" ])
// lib.optionalAttrs (stdenv'.hasCC && stdenv'.cc.isClang or false && attrs.clangFixup or true) {
preBuild =
''

View File

@ -13,8 +13,6 @@ mkDerivation {
"lib/libiconv_modules/mapper_std"
];
BOOTSTRAPPING = !stdenv.hostPlatform.isFreeBSD;
extraNativeBuildInputs = [
byacc
flex

View File

@ -1,5 +1,4 @@
{
stdenv,
mkDerivation,
byacc,
flex,
@ -10,8 +9,6 @@ mkDerivation {
extraPaths = [ "lib/libc/iconv" ];
BOOTSTRAPPING = !stdenv.hostPlatform.isFreeBSD;
extraNativeBuildInputs = [
byacc
flex