mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Lib/Optimizations] debug optimizations being set + fix merging of options (!)
Previously, any attribute override occuring after a previous one would overwrite it.
This commit is contained in:
parent
73b3014fb8
commit
4a22e21f65
1 changed files with 13 additions and 12 deletions
|
|
@ -349,8 +349,8 @@ rec {
|
||||||
if (! isNull cpuTune) then cpuTune
|
if (! isNull cpuTune) then cpuTune
|
||||||
else if (! isNull cpuArch) then cpuArch
|
else if (! isNull cpuArch) then cpuArch
|
||||||
else "generic";
|
else "generic";
|
||||||
in
|
in myLib.debug.traceValWithPrefix "optimizations" (foldl' myLib.attrsets.mergeAttrsRecursive {} [
|
||||||
rec {
|
(rec {
|
||||||
CFLAGS = unique
|
CFLAGS = unique
|
||||||
([ ]
|
([ ]
|
||||||
++ requiredFlags
|
++ requiredFlags
|
||||||
|
|
@ -384,8 +384,8 @@ rec {
|
||||||
makeFlagsArray+=("-l''${_maxLoad}")
|
makeFlagsArray+=("-l''${_maxLoad}")
|
||||||
|
|
||||||
'';
|
'';
|
||||||
}
|
})
|
||||||
// (optionalAttrs cmake {
|
(optionalAttrs cmake {
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
|
|
||||||
cmakeFlagsArray+=(
|
cmakeFlagsArray+=(
|
||||||
|
|
@ -396,7 +396,7 @@ rec {
|
||||||
''
|
''
|
||||||
;
|
;
|
||||||
})
|
})
|
||||||
// (optionalAttrs ninja {
|
(optionalAttrs ninja {
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
|
|
||||||
_maxLoad=$(($NIX_BUILD_CORES * 2))
|
_maxLoad=$(($NIX_BUILD_CORES * 2))
|
||||||
|
|
@ -404,7 +404,7 @@ rec {
|
||||||
|
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
// (optionalAttrs rust {
|
(optionalAttrs rust {
|
||||||
RUSTFLAGS = [ ]
|
RUSTFLAGS = [ ]
|
||||||
++ optionals (levelN >= 2) [ "-C opt-level=3" ]
|
++ optionals (levelN >= 2) [ "-C opt-level=3" ]
|
||||||
++ optionals lto [ "-C lto=fat" "-C embed-bitcode=on" ]
|
++ optionals lto [ "-C lto=fat" "-C embed-bitcode=on" ]
|
||||||
|
|
@ -413,26 +413,27 @@ rec {
|
||||||
#++ optionals lto [ "-Clinker-plugin-lto" "-Clto" ]
|
#++ optionals lto [ "-Clinker-plugin-lto" "-Clto" ]
|
||||||
;
|
;
|
||||||
})
|
})
|
||||||
// (optionalAttrs (!check) {
|
(optionalAttrs (!check) {
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
doInstallCheck = false;
|
doInstallCheck = false;
|
||||||
})
|
})
|
||||||
// (optionalAttrs (go && ISA == "amd64") {
|
(optionalAttrs (go && ISA == "amd64") {
|
||||||
GOAMD64 = "v${toString x86Level}";
|
GOAMD64 = "v${toString x86Level}";
|
||||||
})
|
})
|
||||||
// (optionalAttrs (go && ISA == "arm") {
|
(optionalAttrs (go && ISA == "arm") {
|
||||||
GOARM = toString (getGOARM armLevel);
|
GOARM = toString (getGOARM armLevel);
|
||||||
})
|
})
|
||||||
// (optionalAttrs (go && ISA == "i686") {
|
(optionalAttrs (go && ISA == "i686") {
|
||||||
GO386 = "sse2";
|
GO386 = "sse2";
|
||||||
})
|
})
|
||||||
// (optionalAttrs go {
|
(optionalAttrs go {
|
||||||
GCCGO = "gccgo";
|
GCCGO = "gccgo";
|
||||||
CGO_CFLAGS_ALLOW = "-f.*";
|
CGO_CFLAGS_ALLOW = "-f.*";
|
||||||
CGO_CXXFLAGS_ALLOW = "-f.*";
|
CGO_CXXFLAGS_ALLOW = "-f.*";
|
||||||
CGO_CPPFLAGS_ALLOW = "-D.*";
|
CGO_CPPFLAGS_ALLOW = "-D.*";
|
||||||
CGO_LDFLAGS_ALLOW = "-Wl.*";
|
CGO_LDFLAGS_ALLOW = "-Wl.*";
|
||||||
})
|
})
|
||||||
// (addMarchSpecific march)
|
(addMarchSpecific march)
|
||||||
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue