Merge pull request #231309 from emilytrau/minimal-bootstrap-runcommand

minimal-bootstrap.kaem: move runCommand into kaem
This commit is contained in:
John Ericson 2023-05-13 16:25:39 -04:00 committed by GitHub
commit 1de41f9f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 40 additions and 37 deletions

View File

@ -25,6 +25,6 @@ lib.makeScope
tinycc-bootstrappable = callPackage ./tinycc/bootstrappable.nix { };
tinycc-mes = callPackage ./tinycc/mes.nix { };
inherit (callPackage ./utils.nix { }) fetchurl derivationWithMeta writeTextFile writeText runCommand;
inherit (callPackage ./utils.nix { }) fetchurl derivationWithMeta writeTextFile writeText;
})

View File

@ -1,6 +1,6 @@
{ lib
, runCommand
, fetchurl
, kaem
, tinycc
, gnupatch
}:
@ -145,7 +145,7 @@ let
objects = map (x: lib.replaceStrings [".c"] [".o"] (builtins.baseNameOf x)) sources;
in
runCommand "${pname}-${version}" {
kaem.runCommand "${pname}-${version}" {
inherit pname version;
nativeBuildInputs = [ tinycc gnupatch ];

View File

@ -1,6 +1,6 @@
{ lib
, runCommand
, fetchurl
, kaem
, tinycc
}:
let
@ -67,7 +67,7 @@ let
objects = map (x: lib.replaceStrings [".c"] [".o"] (builtins.baseNameOf x)) sources;
in
runCommand "${pname}-${version}" {
kaem.runCommand "${pname}-${version}" {
inherit pname version;
nativeBuildInputs = [ tinycc ];

View File

@ -1,5 +1,5 @@
{ lib
, runCommand
, kaem
, mes
}:
let
@ -8,7 +8,7 @@ let
src = ./ln.c;
in
runCommand "${pname}-${version}" {
kaem.runCommand "${pname}-${version}" {
inherit pname version;
meta = with lib; {

View File

@ -1,8 +1,8 @@
{ lib
, runCommand
, fetchurl
, writeText
, callPackage
, kaem
, m2libc
, mescc-tools
}:
@ -43,7 +43,7 @@ let
sourceArchive = out: sources:
"catm ${out} ${lib.concatMapStringsSep " " (replaceExt ".s") sources}";
in
runCommand "${pname}-${version}" {
kaem.runCommand "${pname}-${version}" {
inherit pname version;
passthru = { inherit src nyacc; };

View File

@ -1,5 +1,5 @@
{ lib
, runCommand
, kaem
, ln-boot
, mes
, mes-libc
@ -21,7 +21,8 @@ let
# the operation in two
firstLibc = lib.take 100 libc_gnu_SOURCES;
lastLibc = lib.drop 100 libc_gnu_SOURCES;
in runCommand "${pname}-${version}" {
in
kaem.runCommand "${pname}-${version}" {
inherit pname version;
nativeBuildInputs = [ ln-boot ];

View File

@ -1,6 +1,6 @@
{ lib
, runCommand
, fetchurl
, kaem
, nyacc
}:
let
@ -15,7 +15,7 @@ let
sha256 = "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk";
};
in
runCommand "${pname}-${version}" {
kaem.runCommand "${pname}-${version}" {
inherit pname version;
passthru.guilePath = "${nyacc}/share/${pname}-${version}/module";

View File

@ -1,6 +1,9 @@
{ lib
, derivationWithMeta
, writeText
, kaem
, kaem-unwrapped
, mescc-tools
, mescc-tools-extra
, version
}:
@ -23,6 +26,21 @@ derivationWithMeta {
];
PATH = lib.makeBinPath [ mescc-tools-extra ];
passthru.runCommand = name: env: buildCommand:
derivationWithMeta ({
inherit name;
builder = "${kaem}/bin/kaem";
args = [
"--verbose"
"--strict"
"--file"
(writeText "${name}-builder" buildCommand)
];
PATH = lib.makeBinPath ((env.nativeBuildInputs or []) ++ [ kaem mescc-tools mescc-tools-extra ]);
} // (builtins.removeAttrs env [ "nativeBuildInputs" ]));
meta = with lib; {
description = "Minimal build tool for running scripts on systems that lack any shell";
homepage = "https://github.com/oriansj/mescc-tools";

View File

@ -8,9 +8,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
{ lib
, runCommand
, callPackage
, fetchurl
, kaem
, mes
, mes-libc
}:
@ -24,7 +24,7 @@ let
url = "https://gitlab.com/janneke/tinycc/-/archive/${rev}/tinycc-${rev}.tar.gz";
sha256 = "1a0cw9a62qc76qqn5sjmp3xrbbvsz2dxrw21lrnx9q0s74mwaxbq";
};
src = (runCommand "tinycc-bootstrappable-${version}-source" {} ''
src = (kaem.runCommand "tinycc-bootstrappable-${version}-source" {} ''
ungz --file ${tarball} --output tinycc.tar
mkdir -p ''${out}
cd ''${out}
@ -39,7 +39,7 @@ let
platforms = [ "i686-linux" ];
};
tinycc-boot-mes = runCommand "tinycc-boot-mes-${version}" {} ''
tinycc-boot-mes = kaem.runCommand "tinycc-boot-mes-${version}" {} ''
catm config.h
${mes}/bin/mes --no-auto-compile -e main ${mes}/bin/mescc.scm -- \
-S \

View File

@ -1,5 +1,5 @@
{ lib
, runCommand
, kaem
, mes-libc
, ln-boot
}:
@ -17,7 +17,7 @@
options = lib.strings.concatStringsSep " " buildOptions;
libtccOptions = lib.strings.concatStringsSep " " libtccBuildOptions;
in
runCommand "${pname}-${version}" {
kaem.runCommand "${pname}-${version}" {
inherit pname version meta;
nativeBuildInputs = [ ln-boot ];
} ''

View File

@ -5,9 +5,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
{ lib
, runCommand
, fetchurl
, callPackage
, kaem
, tinycc-bootstrappable
}:
let
@ -20,7 +20,7 @@ let
url = "https://repo.or.cz/tinycc.git/snapshot/${rev}.tar.gz";
sha256 = "11idrvbwfgj1d03crv994mpbbbyg63j1k64lw1gjy7mkiifw2xap";
};
src = (runCommand "tinycc-${version}-source" {} ''
src = (kaem.runCommand "tinycc-${version}-source" {} ''
ungz --file ${tarball} --output tinycc.tar
mkdir -p ''${out}
cd ''${out}
@ -35,7 +35,7 @@ let
platforms = [ "i686-linux" ];
};
tccdefs = runCommand "tccdefs-${version}" {} ''
tccdefs = kaem.runCommand "tccdefs-${version}" {} ''
mkdir ''${out}
${tinycc-bootstrappable}/bin/tcc -static -DC2STR -o c2str ${src}/conftest.c
./c2str ${src}/include/tccdefs.h ''${out}/tccdefs_.h

View File

@ -2,7 +2,6 @@
, buildPlatform
, callPackage
, kaem
, mescc-tools
, mescc-tools-extra
}:
@ -65,19 +64,4 @@ rec {
writeText = name: text: writeTextFile {inherit name text;};
runCommand = name: env: buildCommand:
derivationWithMeta ({
inherit name;
builder = "${kaem}/bin/kaem";
args = [
"--verbose"
"--strict"
"--file"
(writeText "${name}-builder" buildCommand)
];
PATH = lib.makeBinPath ((env.nativeBuildInputs or []) ++ [ kaem mescc-tools mescc-tools-extra ]);
} // (builtins.removeAttrs env [ "nativeBuildInputs" ]));
}