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 transform = value: let
package = lib'.packages.resolve value; package = lib'.packages.resolve value;
in 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 in
lib.types.attrs.of (lib.types.coerce initial transform lib'.types.package); 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."; description = "Dependencies which are created in the build environment and are executed in the host environment.";
type = lib'.types.dependencies build host target; type = lib'.types.dependencies build host target;
default.value = {}; 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 { target = lib.options.create {

View file

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

View file

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

View file

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