refactor: minor cleanup

This commit is contained in:
Jake Hamilton 2024-07-04 17:36:31 -07:00
parent fd9b85f29e
commit 7774f65079
Signed by untrusted user: 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,83 +3,79 @@
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 = { }: {
src = lib.options.create { options = {
type = lib.types.derivation; src = lib.options.create {
description = "Source for the package."; type = lib.types.derivation;
}; description = "Source for the package.";
};
config = {
meta = {
platforms = [ "i686-linux" ];
};
pname = "linux-headers";
version = "6.5.6";
builder = builders.basic;
env = {
PATH = lib.paths.bin [
foundation.stage2-gcc
foundation.stage1-musl
foundation.stage2-binutils
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
];
};
phases = {
unpack = lib.dag.entry.before [ "patch" ] ''
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" ] ''
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.host.linux.arch} headers
'';
install = lib.dag.entry.after [ "build" ] ''
find usr/include -name '.*' -exec rm {} +
mkdir -p $out
cp -rv usr/include $out/
'';
};
src = builtins.fetchurl {
url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major config.version}.x/linux-${config.version}.tar.xz";
sha256 = "eONtQhRUcFHCTfIUD0zglCjWxRWtmnGziyjoCUqV0vY=";
};
}; };
}; };
config = {
meta = {
platforms = ["i686-linux"];
};
pname = "linux-headers";
version = "6.5.6";
builder = builders.basic;
env = {
PATH = lib.paths.bin [
foundation.stage2-gcc
foundation.stage1-musl
foundation.stage2-binutils
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
];
};
phases = {
unpack = ''
tar xf ${config.src}
cd linux-${config.version}
'';
build = ''
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.host.linux.arch} headers
'';
install = ''
find usr/include -name '.*' -exec rm {} +
mkdir -p $out
cp -rv usr/include $out/
'';
};
src = builtins.fetchurl {
url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major config.version}.x/linux-${config.version}.tar.xz";
sha256 = "eONtQhRUcFHCTfIUD0zglCjWxRWtmnGziyjoCUqV0vY=";
};
};
};
}; };
}; };
} }