refactor: minor cleanup

This commit is contained in:
Jake Hamilton 2024-07-04 17:36:31 -07:00
parent fd9b85f29e
commit 7774f65079
Signed by: jakehamilton
GPG key ID: 9762169A1B35EA68
4 changed files with 75 additions and 91 deletions

View file

@ -80,12 +80,7 @@ in {
transform = value: let
package = lib'.packages.resolve value;
in
(builtins.trace "building dependency ${package.name}: build=${build.triple} host=${host.triple} target=${target.triple}")
lib'.packages.build
package
build
host
target;
lib'.packages.build package build host target;
in
lib.types.attrs.of (lib.types.coerce initial transform lib'.types.package);
@ -168,13 +163,6 @@ in {
description = "Dependencies which are created in the build environment and are executed in the host environment.";
type = lib'.types.dependencies build host target;
default.value = {};
# apply = value:
# if value ? b then
# (builtins.trace value.b.platform.build.triple)
# (builtins.trace config.platform.build.triple)
# value
# else
# value;
};
target = lib.options.create {

View file

@ -90,24 +90,24 @@ in {
"--disable-multilib"
];
in {
unpack = lib.dag.entry.before ["patch"] ''
unpack = ''
tar xf ${config.src}
cd binutils-${config.version}
'';
patch = lib.dag.entry.between ["configure"] ["unpack"] ''
patch = ''
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
'';
configure = lib.dag.entry.between ["build"] ["patch"] ''
configure = ''
bash ./configure ${builtins.concatStringsSep " " configureFlags}
'';
build = lib.dag.entry.between ["install"] ["configure"] ''
build = ''
make -j $NIX_BUILD_CORES
'';
install = lib.dag.entry.after ["build"] ''
install = ''
make -j $NIX_BUILD_CORES install-strip
'';
};

View file

@ -118,7 +118,7 @@ in {
else "-m32"
else "";
in {
unpack = lib.dag.entry.before ["patch"] ''
unpack = ''
# Unpack
tar xf ${config.src}
tar xf ${config.gmp.src}
@ -133,13 +133,13 @@ in {
ln -s ../isl-${config.isl.version} isl
'';
patch = lib.dag.entry.between ["configure"] ["unpack"] ''
patch = ''
# Patch
# force musl even if host triple is gnu
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
'';
configure = lib.dag.entry.between ["build"] ["patch"] ''
configure = ''
# Configure
export CC="gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
export CXX="g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
@ -163,12 +163,12 @@ in {
CXXFLAGS=-static
'';
build = lib.dag.entry.between ["install"] ["configure"] ''
build = ''
# Build
make -j $NIX_BUILD_CORES
'';
install = lib.dag.entry.after ["build"] ''
install = ''
# Install
make -j $NIX_BUILD_CORES install-strip
'';

View file

@ -3,22 +3,22 @@
lib',
config,
options,
}:
let
inherit (config)
}: let
inherit
(config)
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
;
in
{
in {
config.packages.foundation.linux-headers = {
versions = {
"latest" =
{ config, meta }:
{
"latest" = {
config,
meta,
}: {
options = {
src = lib.options.create {
type = lib.types.derivation;
@ -54,20 +54,16 @@ in
};
phases = {
unpack = lib.dag.entry.before [ "patch" ] ''
unpack = ''
tar xf ${config.src}
cd linux-${config.version}
'';
patch = lib.dag.entry.between [ "configure" ] [ "unpack" ] '''';
configure = lib.dag.entry.between [ "build" ] [ "patch" ] '''';
build = lib.dag.entry.between [ "install" ] [ "configure" ] ''
build = ''
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.host.linux.arch} headers
'';
install = lib.dag.entry.after [ "build" ] ''
install = ''
find usr/include -name '.*' -exec rm {} +
mkdir -p $out
cp -rv usr/include $out/