refactor: stable reference package platforms to improve eval time
This commit is contained in:
parent
5a222fa399
commit
01db12d713
28 changed files with 313 additions and 292 deletions
|
|
@ -15,7 +15,7 @@ in
|
|||
build =
|
||||
package:
|
||||
let
|
||||
system = package.platform.build.double;
|
||||
system = package.platform.build;
|
||||
|
||||
dependencies = lib.packages.dependencies.collect package;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ in
|
|||
builtins.map (dependency: dependency.package) available;
|
||||
|
||||
build = build': host': target':
|
||||
builtins.mapAttrs (name: dep: lib.packages.build dep build' host' target');
|
||||
builtins.mapAttrs (name: dep: dep.packages.${build'}.${host'}.${target'});
|
||||
|
||||
collect =
|
||||
package:
|
||||
|
|
@ -175,13 +175,10 @@ in
|
|||
hooks = builtins.map
|
||||
(
|
||||
dependency:
|
||||
let
|
||||
getHooks =
|
||||
(builtins.trace dependency.name)
|
||||
(builtins.trace dependency.hooks)
|
||||
dependency.hooks or (lib.fp.const { });
|
||||
in
|
||||
dependency.hooks ctx
|
||||
if builtins.isFunction dependency.hooks then
|
||||
dependency.hooks ctx
|
||||
else
|
||||
dependency.hooks
|
||||
)
|
||||
dependencies;
|
||||
in
|
||||
|
|
@ -250,105 +247,21 @@ in
|
|||
package.version
|
||||
];
|
||||
|
||||
buildSystem = lib.systems.withBuildInfo build;
|
||||
hostSystem = lib.systems.withBuildInfo host;
|
||||
targetSystem = lib.systems.withBuildInfo target;
|
||||
|
||||
platform = {
|
||||
build = lib.modules.override 75 build;
|
||||
host = lib.modules.override 75 host;
|
||||
target = lib.modules.override 75 target;
|
||||
};
|
||||
|
||||
withDependencyErrorContext = prefix: deps:
|
||||
builtins.mapAttrs
|
||||
(name: value:
|
||||
builtins.addErrorContext
|
||||
"📦 [Aux Tidepool] while resolving dependency `${lib.options.getIdentifier (["deps"] ++ prefix ++ [name])}` for `${identifier}`."
|
||||
value
|
||||
)
|
||||
deps;
|
||||
|
||||
withPlatform = lib.modules.run {
|
||||
args = {
|
||||
global = global.config;
|
||||
};
|
||||
|
||||
modules = package.__modules__ ++ [
|
||||
lib.types.package.children.submodule
|
||||
(
|
||||
{ config }:
|
||||
{
|
||||
config = {
|
||||
__modules__ = package.__modules__;
|
||||
|
||||
inherit platform;
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
built = package.extendTemporarily {
|
||||
inherit platform;
|
||||
};
|
||||
|
||||
# Not all platform information can be effectively handled via submodules. To handle
|
||||
# the case where a user copies the resolved config over we need to ensure that
|
||||
# dependencies are appropriately updated.
|
||||
withDeps = withPlatform.config // {
|
||||
deps = {
|
||||
build = {
|
||||
build =
|
||||
lib.packages.dependencies.build build build build
|
||||
(withDependencyErrorContext [ "build" "build" ] withPlatform.config.deps.build.build);
|
||||
host =
|
||||
lib.packages.dependencies.build build build host
|
||||
(withDependencyErrorContext [ "build" "host" ] withPlatform.config.deps.build.host);
|
||||
target =
|
||||
lib.packages.dependencies.build build build target
|
||||
(withDependencyErrorContext [ "build" "target" ] withPlatform.config.deps.build.target);
|
||||
};
|
||||
host = {
|
||||
host =
|
||||
lib.packages.dependencies.build build host host
|
||||
(withDependencyErrorContext [ "host" "host" ] withPlatform.config.deps.host.host);
|
||||
target =
|
||||
lib.packages.dependencies.build build host target
|
||||
(withDependencyErrorContext [ "host" "target" ] withPlatform.config.deps.host.target);
|
||||
};
|
||||
target = {
|
||||
target =
|
||||
lib.packages.dependencies.build build target target
|
||||
(withDependencyErrorContext [ "target" "target" ] withPlatform.config.deps.target.target);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
withPackage = lib.modules.run {
|
||||
args = {
|
||||
global = global.config;
|
||||
};
|
||||
|
||||
modules = package.__modules__ ++ [
|
||||
lib.types.package.children.submodule
|
||||
(
|
||||
{ config }:
|
||||
{
|
||||
config = {
|
||||
__modules__ = package.__modules__;
|
||||
|
||||
inherit platform;
|
||||
|
||||
deps =
|
||||
lib.modules.overrides.force withDeps.deps;
|
||||
|
||||
package =
|
||||
(builtins.addErrorContext "📦 [Aux Tidepool] while building package ${package.name}")
|
||||
(lib.modules.override 0 (withDeps.builder.build withDeps));
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
buildSystem = withPlatform.config.platform.build;
|
||||
hostSystem = withPlatform.config.platform.host;
|
||||
targetSystem = withPlatform.config.platform.target;
|
||||
|
||||
support = lib.packages.supports withPlatform.config buildSystem.double hostSystem.double targetSystem.double;
|
||||
support = lib.packages.supports package buildSystem.double hostSystem.double targetSystem.double;
|
||||
|
||||
result =
|
||||
if !support.compatible then
|
||||
|
|
@ -356,10 +269,9 @@ in
|
|||
else if support.broken then
|
||||
builtins.throw "📦 [Aux Tidepool] Package `${identifier}` is marked as broken and cannot be built."
|
||||
else
|
||||
withPackage.config;
|
||||
built;
|
||||
in
|
||||
builtins.addErrorContext "📦 [Aux Tidepool] while building package `${identifier}` for platform build=${buildSystem.double}, host=${hostSystem.double}, target=${targetSystem.double}."
|
||||
(builtins.trace "(lib) Building package ${result.name}")
|
||||
result;
|
||||
|
||||
supports = alias: build: host: target:
|
||||
|
|
@ -367,11 +279,12 @@ in
|
|||
package = lib.packages.resolve alias;
|
||||
matches = builtins.filter
|
||||
(platform:
|
||||
platform.build.double == build &&
|
||||
platform.host.double == host &&
|
||||
platform.target.double == target)
|
||||
platform.build == build &&
|
||||
platform.host == host &&
|
||||
platform.target == target)
|
||||
package.platforms;
|
||||
in {
|
||||
in
|
||||
{
|
||||
compatible =
|
||||
(config.preferences.packages.allow.incompatible && builtins.length matches == 0)
|
||||
|| builtins.length matches > 0;
|
||||
|
|
|
|||
|
|
@ -2797,16 +2797,16 @@ in
|
|||
) lib.systems.validate.architecture
|
||||
// (builtins.removeAttrs settings [ "system" ]);
|
||||
|
||||
assertions = builtins.foldl' (
|
||||
result:
|
||||
{ assertion, message }:
|
||||
if assertion resolved then
|
||||
result
|
||||
else builtins.throw message
|
||||
) true (resolved.system.abi.assertions or [ ]);
|
||||
# assertions = builtins.foldl' (
|
||||
# result:
|
||||
# { assertion, message }:
|
||||
# if assertion resolved then
|
||||
# result
|
||||
# else builtins.throw message
|
||||
# ) true (resolved.system.abi.assertions or [ ]);
|
||||
in
|
||||
assert resolved.useAndroidPrebuilt -> resolved.isAndroid;
|
||||
assert assertions;
|
||||
# assert assertions;
|
||||
# And finally, return the generated system info.
|
||||
lib.types.set "systemWithBuildInfo" resolved;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -194,16 +194,9 @@ in
|
|||
dependencies =
|
||||
build: host: target:
|
||||
let
|
||||
initial = lib.types.raw;
|
||||
|
||||
transform =
|
||||
value:
|
||||
let
|
||||
package = lib.packages.resolve value;
|
||||
in
|
||||
lib.packages.build package build host target;
|
||||
entries = lib.types.raw;
|
||||
in
|
||||
lib.types.attrs.lazy (lib.types.coerce initial transform lib.types.package);
|
||||
lib.types.attrs.of entries;
|
||||
|
||||
alias = lib.types.submodule (
|
||||
{ config, name }:
|
||||
|
|
@ -387,8 +380,6 @@ in
|
|||
extend = lib.options.create {
|
||||
description = "Extend the package definition.";
|
||||
type = lib.types.function lib.types.raw;
|
||||
internal = true;
|
||||
writable = false;
|
||||
default.value =
|
||||
module:
|
||||
let
|
||||
|
|
@ -423,6 +414,53 @@ in
|
|||
result.config;
|
||||
};
|
||||
|
||||
extendTemporarily = lib.options.create {
|
||||
description = "Extend the package definition.";
|
||||
type = lib.types.function lib.types.raw;
|
||||
default.value =
|
||||
module:
|
||||
let
|
||||
normalized =
|
||||
if builtins.isList module then
|
||||
module
|
||||
else if builtins.isFunction module || module ? config then
|
||||
[ module ]
|
||||
else
|
||||
[
|
||||
{
|
||||
config = module;
|
||||
}
|
||||
];
|
||||
|
||||
modules = config.__modules__;
|
||||
|
||||
result = lib.modules.run {
|
||||
prefix = meta.prefix;
|
||||
|
||||
args = {
|
||||
global = global.config;
|
||||
};
|
||||
|
||||
modules = [
|
||||
submodule
|
||||
{ config.__modules__ = modules; }
|
||||
{
|
||||
config = {
|
||||
packages = lib.modules.override 0 config.packages;
|
||||
extend = lib.modules.override 0 config.extend;
|
||||
extendTemporarily = lib.modules.override 0 config.extendTemporarily;
|
||||
};
|
||||
}
|
||||
]
|
||||
++ modules
|
||||
++ normalized;
|
||||
};
|
||||
in
|
||||
result.config // {
|
||||
inherit (config) extend extendTemporarily packages;
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
description = "The description for the package.";
|
||||
|
|
@ -482,17 +520,17 @@ in
|
|||
options = {
|
||||
build = lib.options.create {
|
||||
description = "The build platform for the package.";
|
||||
type = lib.types.platform;
|
||||
type = lib.types.string;
|
||||
};
|
||||
|
||||
host = lib.options.create {
|
||||
description = "The host platform for the package.";
|
||||
type = lib.types.platform;
|
||||
type = lib.types.string;
|
||||
};
|
||||
|
||||
target = lib.options.create {
|
||||
description = "The target platform for the package.";
|
||||
type = lib.types.platform;
|
||||
type = lib.types.string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -504,20 +542,20 @@ in
|
|||
platform = {
|
||||
build = lib.options.create {
|
||||
description = "The build platform for the package.";
|
||||
type = lib.types.platform;
|
||||
default.value = lib.systems.withBuildInfo "x86_64-linux";
|
||||
type = lib.types.string;
|
||||
default.value = "x86_64-linux";
|
||||
};
|
||||
|
||||
host = lib.options.create {
|
||||
description = "The host platform for the package.";
|
||||
type = lib.types.platform;
|
||||
default.value = lib.systems.withBuildInfo "x86_64-linux";
|
||||
type = lib.types.string;
|
||||
default.value = "x86_64-linux";
|
||||
};
|
||||
|
||||
target = lib.options.create {
|
||||
description = "The target platform for the package.";
|
||||
type = lib.types.platform;
|
||||
default.value = lib.systems.withBuildInfo "x86_64-linux";
|
||||
type = lib.types.string;
|
||||
default.value = "x86_64-linux";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -640,10 +678,23 @@ in
|
|||
description = "The built derivation.";
|
||||
type = lib.types.derivation;
|
||||
default.value =
|
||||
(builtins.trace "(internal) Building package ${config.name}")
|
||||
config.builder.build config;
|
||||
};
|
||||
|
||||
packages = lib.options.create {
|
||||
description = "The built derivations for all platforms.";
|
||||
type = lib.types.raw;
|
||||
writable = false;
|
||||
default.value =
|
||||
lib.attrs.generate lib.systems.doubles.all (build:
|
||||
lib.attrs.generate lib.systems.doubles.all (host:
|
||||
lib.attrs.generate lib.systems.doubles.all (target:
|
||||
lib.packages.build config build host target
|
||||
)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
phases = lib.options.create {
|
||||
description = "The phases for the package.";
|
||||
type = lib.types.either (lib.types.dag.of lib.types.string) (lib.types.function lib.types.dag.of lib.types.string);
|
||||
|
|
@ -673,13 +724,7 @@ in
|
|||
type = deps build host target;
|
||||
default.value = { };
|
||||
apply = value:
|
||||
if value ? __done__ then
|
||||
value
|
||||
else
|
||||
(builtins.trace "(internal) building dependencies for package ${config.name}")
|
||||
{
|
||||
__done__ = true;
|
||||
|
||||
build = {
|
||||
build = lib.packages.dependencies.build build build build value.build.build;
|
||||
host = lib.packages.dependencies.build build build host value.build.host;
|
||||
|
|
@ -692,7 +737,7 @@ in
|
|||
target = {
|
||||
target = lib.packages.dependencies.build build target target value.target.target;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,62 +1,6 @@
|
|||
{ config }:
|
||||
let
|
||||
inherit (config) lib;
|
||||
|
||||
doubles = lib.systems.doubles.all;
|
||||
|
||||
packages = lib.attrs.filter
|
||||
(name: value:
|
||||
!(builtins.elem name doubles)
|
||||
&& name != "context"
|
||||
&& name != "platforms")
|
||||
config.packages;
|
||||
|
||||
builtPlatforms = lib.attrs.generate doubles (build:
|
||||
lib.attrs.generate doubles (host:
|
||||
lib.attrs.generate doubles (target:
|
||||
builtins.mapAttrs (namespace: aliases:
|
||||
builtins.mapAttrs (id: alias: {
|
||||
stable = (lib.packages.build alias.stable build host target).package;
|
||||
latest = (lib.packages.build alias.latest build host target).package;
|
||||
|
||||
versions = builtins.mapAttrs (version: entry:
|
||||
(lib.packages.build entry build host target).package
|
||||
) alias.versions;
|
||||
}) aliases
|
||||
) packages
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
allPlatformOptions = lib.attrs.generate doubles (
|
||||
build:
|
||||
lib.options.create {
|
||||
description = "Packages which are built on the ${build} system.";
|
||||
default.value = {};
|
||||
type = lib.types.submodule {
|
||||
freeform = lib.types.platforms.build;
|
||||
|
||||
options = lib.attrs.generate doubles (
|
||||
host:
|
||||
lib.options.create {
|
||||
description = "Packages which are run on the ${host} system.";
|
||||
default.value = { };
|
||||
type = lib.types.submodule {
|
||||
freeform = lib.types.platforms.host;
|
||||
|
||||
options = lib.attrs.generate doubles (
|
||||
target:
|
||||
lib.options.create {
|
||||
description = "Packages which are cross-compiled for the ${target} system.";
|
||||
type = lib.types.platforms.target;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
includes = [
|
||||
|
|
@ -65,15 +9,6 @@ in
|
|||
];
|
||||
|
||||
options = {
|
||||
internal.packages.platforms = lib.options.create {
|
||||
description = "The built versions of packages for each platform.";
|
||||
internal = true;
|
||||
default.value = { };
|
||||
type = lib.types.submodule {
|
||||
options = allPlatformOptions;
|
||||
};
|
||||
};
|
||||
|
||||
packages = lib.options.create {
|
||||
description = "The package set.";
|
||||
default.value = { };
|
||||
|
|
@ -81,12 +16,6 @@ in
|
|||
freeform = lib.types.aliases;
|
||||
|
||||
options = {
|
||||
platforms = lib.options.create {
|
||||
description = "The built versions of packages which are available.";
|
||||
default.value = config.internal.packages.platforms;
|
||||
type = lib.types.attrs.of lib.types.platforms.build;
|
||||
};
|
||||
|
||||
# NOTE: We may offer a way to set default context values. For this reason we have
|
||||
# nested `options` under `context` rather than using a plain option directly under `packages`.
|
||||
context.options = lib.options.create {
|
||||
|
|
@ -123,8 +52,4 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
internal.packages.platforms = builtPlatforms;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -63,8 +69,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple} \
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple} \
|
||||
--enable-static-link \
|
||||
bash_cv_func_strtoimax=y \
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -4,14 +4,20 @@ let
|
|||
inherit (global) lib packages builders mirrors;
|
||||
inherit (global.internal.packages) foundation;
|
||||
|
||||
isBuildBootstrapped = config.platform.build.double == "i686-linux";
|
||||
isHostBootstrapped = config.platform.host.double == "i686-linux";
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
|
||||
isBuildBootstrapped = platform.build.double == "i686-linux";
|
||||
isHostBootstrapped = platform.host.double == "i686-linux";
|
||||
|
||||
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
|
||||
|
||||
isCross =
|
||||
config.platform.build.double != config.platform.host.double
|
||||
&& config.platform.host.double == config.platform.target.double;
|
||||
platform.build.double != platform.host.double
|
||||
&& platform.host.double == platform.target.double;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
|
|
@ -23,9 +29,9 @@ let
|
|||
"LDFLAGS=--static"
|
||||
] ++ [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${config.platform.build.triple}"
|
||||
"--host=${config.platform.host.triple}"
|
||||
"--target=${config.platform.target.triple}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${platform.target.triple}"
|
||||
|
||||
"--with-sysroot=/"
|
||||
"--enable-deterministic-archives"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -63,8 +69,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -6,9 +6,15 @@ let
|
|||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
|
||||
prefix = lib.strings.when
|
||||
(config.platform.build.triple != config.platform.host.triple)
|
||||
"${config.platform.host.triple}-";
|
||||
(platform.build.triple != platform.host.triple)
|
||||
"${platform.host.triple}-";
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
|
|||
|
|
@ -6,14 +6,20 @@ let
|
|||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
|
||||
prefix = lib.strings.when
|
||||
(config.platform.build.triple != config.platform.host.triple)
|
||||
"${config.platform.host.triple}-";
|
||||
(platform.build.triple != platform.host.triple)
|
||||
"${platform.host.triple}-";
|
||||
|
||||
configureFlags = [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${config.platform.build.triple}"
|
||||
"--host=${config.platform.host.triple}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--enable-single-binary=symlinks"
|
||||
];
|
||||
in
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -58,8 +64,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -58,8 +64,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -58,8 +64,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -7,9 +7,15 @@ let
|
|||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
|
||||
prefix = lib.strings.when
|
||||
(config.platform.build.triple != config.platform.target.triple)
|
||||
"${config.platform.target.triple}-";
|
||||
(platform.build.triple != platform.target.triple)
|
||||
"${platform.target.triple}-";
|
||||
|
||||
patches = [
|
||||
../patches/libstdc++-target.patch
|
||||
|
|
@ -18,9 +24,9 @@ let
|
|||
configureFlags = [
|
||||
"LDFLAGS=--static"
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${config.platform.build.triple}"
|
||||
"--host=${config.platform.host.triple}"
|
||||
"--target=${config.platform.target.triple}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${platform.target.triple}"
|
||||
"--with-as=${config.deps.build.target.binutils.package}/bin/${prefix}as"
|
||||
"--with-ld=${config.deps.build.target.binutils.package}/bin/${prefix}ld"
|
||||
"--enable-languages=c,c++"
|
||||
|
|
@ -226,7 +232,7 @@ in
|
|||
|
||||
install = ''
|
||||
# Install
|
||||
${lib.strings.when (config.platform.host.is64bit) ''
|
||||
${lib.strings.when (platform.host.is64bit) ''
|
||||
mkdir -p $out/lib
|
||||
ln -s lib $out/lib64
|
||||
''}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,15 @@ let
|
|||
|
||||
version = lib.strings.removeSuffix "-stage2" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
|
||||
prefix = lib.strings.when
|
||||
(config.platform.build.triple != config.platform.target.triple)
|
||||
"${config.platform.target.triple}-";
|
||||
(platform.build.triple != platform.target.triple)
|
||||
"${platform.target.triple}-";
|
||||
|
||||
patches = [
|
||||
../patches/libstdc++-target.patch
|
||||
|
|
@ -19,7 +25,7 @@ let
|
|||
"-Wl,-dynamic-linker"
|
||||
"-Wl,${config.deps.target.target.glibc.package}/lib/ld-linux${
|
||||
lib.strings.when
|
||||
(config.platform.target.isx86 && config.platform.target.is64bit)
|
||||
(platform.target.isx86 && platform.target.is64bit)
|
||||
"-x86-64"
|
||||
}.so.2"
|
||||
"-B${config.deps.target.target.glibc.package}/lib"
|
||||
|
|
@ -27,9 +33,9 @@ let
|
|||
|
||||
configureFlags = [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${config.platform.build.triple}"
|
||||
"--host=${config.platform.host.triple}"
|
||||
"--target=${config.platform.target.triple}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${platform.target.triple}"
|
||||
"--with-as=${config.deps.build.target.binutils.package}/bin/${prefix}as"
|
||||
"--with-ld=${config.deps.build.target.binutils.package}/bin/${prefix}ld"
|
||||
"--enable-languages=c,c++"
|
||||
|
|
@ -184,7 +190,7 @@ in
|
|||
CC = "gcc -Wl,-dynamic-linker";
|
||||
CXX = "g++ -Wl,-dynamic-linker";
|
||||
CFLAGS_FOR_TARGET = "-Wl,-dynamic-linker -Wl,${config.deps.target.target.glibc.package}/lib/ld-linux-x86-64.so.2 -B${config.deps.target.target.glibc.package}/lib";
|
||||
LDFLAGS_FOR_TARGET = "-L$(pwd)/${config.platform.target.triple}/libgcc -L${config.deps.target.target.glibc.package}/lib";
|
||||
LDFLAGS_FOR_TARGET = "-L$(pwd)/${platform.target.triple}/libgcc -L${config.deps.target.target.glibc.package}/lib";
|
||||
};
|
||||
|
||||
hooks = ctx: {
|
||||
|
|
@ -243,7 +249,7 @@ in
|
|||
|
||||
install = ''
|
||||
# Install
|
||||
${lib.strings.when (config.platform.host.is64bit) ''
|
||||
${lib.strings.when (platform.host.is64bit) ''
|
||||
mkdir -p $out/lib
|
||||
ln -s lib $out/lib64
|
||||
''}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,15 @@ let
|
|||
|
||||
version = lib.strings.removeSuffix "-stage3" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
|
||||
prefix = lib.strings.when
|
||||
(config.platform.build.triple != config.platform.target.triple)
|
||||
"${config.platform.target.triple}-";
|
||||
(platform.build.triple != platform.target.triple)
|
||||
"${platform.target.triple}-";
|
||||
|
||||
patches = [
|
||||
../patches/libstdc++-target.patch
|
||||
|
|
@ -19,8 +25,8 @@ let
|
|||
"-Wl,-dynamic-linker"
|
||||
"-Wl,${config.deps.host.host.glibc.package}/lib/ld-linux${
|
||||
lib.strings.when (
|
||||
config.platform.target.isx86
|
||||
&& config.platform.target.is64bit
|
||||
platform.target.isx86
|
||||
&& platform.target.is64bit
|
||||
) "-x86-64"
|
||||
}.so.2"
|
||||
"-B${config.deps.host.host.glibc.package}/lib"
|
||||
|
|
@ -29,9 +35,9 @@ let
|
|||
configureFlags = [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
# Pretend we're native even though we're not
|
||||
"--build=${config.platform.target.triple}"
|
||||
"--host=${config.platform.host.triple}"
|
||||
"--target=${config.platform.target.triple}"
|
||||
"--build=${platform.target.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${platform.target.triple}"
|
||||
"--with-as=${config.deps.build.target.binutils.package}/bin/${prefix}as"
|
||||
"--with-ld=${config.deps.build.target.binutils.package}/bin/${prefix}ld"
|
||||
"--enable-languages=c,c++"
|
||||
|
|
@ -187,7 +193,7 @@ in
|
|||
env = {
|
||||
CFLAGS_FOR_TARGET = "-Wl,-dynamic-linker -Wl,${config.deps.host.host.glibc.package}/lib/ld-linux-x86-64.so.2";
|
||||
LIBRARY_PATH = "${config.deps.host.host.glibc.package}/lib";
|
||||
LDFLAGS_FOR_TARGET = "-L$(pwd)/${config.platform.target.triple}/libgcc -L${config.deps.host.host.glibc.package}/lib";
|
||||
LDFLAGS_FOR_TARGET = "-L$(pwd)/${platform.target.triple}/libgcc -L${config.deps.host.host.glibc.package}/lib";
|
||||
};
|
||||
|
||||
hooks = ctx: {
|
||||
|
|
@ -238,7 +244,7 @@ in
|
|||
|
||||
install = ''
|
||||
# Install
|
||||
${lib.strings.when (config.platform.host.is64bit) ''
|
||||
${lib.strings.when (platform.host.is64bit) ''
|
||||
mkdir -p $out/lib
|
||||
ln -s lib $out/lib64
|
||||
''}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@ let
|
|||
|
||||
version = lib.strings.removeSuffix "-stage4" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
|
||||
patches = [
|
||||
../patches/libstdc++-target.patch
|
||||
];
|
||||
|
|
@ -15,8 +21,8 @@ let
|
|||
"-Wl,-dynamic-linker"
|
||||
"-Wl,${config.deps.host.host.glibc.package}/lib/ld-linux${
|
||||
lib.strings.when (
|
||||
config.platform.target.isx86
|
||||
&& config.platform.target.is64bit
|
||||
platform.target.isx86
|
||||
&& platform.target.is64bit
|
||||
) "-x86-64"
|
||||
}.so.2"
|
||||
"-B${config.deps.host.host.glibc.package}/lib"
|
||||
|
|
@ -24,9 +30,9 @@ let
|
|||
|
||||
configureFlags = [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${config.platform.build.triple}"
|
||||
"--host=${config.platform.host.triple}"
|
||||
"--target=${config.platform.target.triple}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${platform.target.triple}"
|
||||
"--enable-languages=c,c++"
|
||||
"--disable-lto"
|
||||
"--disable-bootstrap"
|
||||
|
|
@ -179,7 +185,7 @@ in
|
|||
env = {
|
||||
CFLAGS_FOR_TARGET = "-Wl,-dynamic-linker -Wl,${
|
||||
"${config.deps.host.host.glibc.package}/lib/ld-linux${
|
||||
lib.strings.when (config.platform.target.isx86 && config.platform.target.is64bit) "-x86-64"
|
||||
lib.strings.when (platform.target.isx86 && platform.target.is64bit) "-x86-64"
|
||||
}.so.2"
|
||||
}";
|
||||
LIBRARY_PATH = "${config.deps.host.host.glibc.package}/lib";
|
||||
|
|
@ -233,7 +239,7 @@ in
|
|||
|
||||
install = ''
|
||||
# Install
|
||||
${lib.strings.when (config.platform.host.is64bit) ''
|
||||
${lib.strings.when (platform.host.is64bit) ''
|
||||
mkdir -p $out/lib
|
||||
ln -s lib $out/lib64
|
||||
''}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -62,10 +68,10 @@ in
|
|||
|
||||
bash ../configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple} \
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple} \
|
||||
--with-headers=${config.deps.build.build.linux-headers.package}/include \
|
||||
--with-binutils=${config.deps.build.host.binutils.package}/${config.platform.target.triple}/bin
|
||||
--with-binutils=${config.deps.build.host.binutils.package}/${platform.target.triple}/bin
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -58,8 +64,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -59,8 +65,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -6,6 +6,12 @@ let
|
|||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
|
||||
patches = [
|
||||
../patches/4.4.1-0001-No-impure-bin-sh.patch
|
||||
../patches/4.4.1-0002-remove-impure-dirs.patch
|
||||
|
|
@ -68,8 +74,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -58,8 +64,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -59,8 +65,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -58,8 +64,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -58,8 +64,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -56,7 +62,7 @@ in
|
|||
make -j $NIX_BUILD_CORES V=1 \
|
||||
"CC=$CC" \
|
||||
"HOSTCC=$CC" \
|
||||
ARCH=${config.platform.host.linux.arch} \
|
||||
ARCH=${platform.host.linux.arch} \
|
||||
headers
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@
|
|||
let
|
||||
inherit (global) lib packages builders;
|
||||
inherit (global.internal.packages) foundation;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -67,8 +73,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple} \
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple} \
|
||||
--syslibdir=$out/lib \
|
||||
--enable-wrapper
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
inherit (global.internal.packages) foundation;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.platform.target;
|
||||
};
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -58,8 +64,8 @@ in
|
|||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${config.platform.build.triple} \
|
||||
--host=${config.platform.host.triple}
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple}
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue