forked from auxolotl/labs
feat: unpack, configure, make capabilities
This commit is contained in:
parent
c46d759e87
commit
ec3ceb8768
5 changed files with 126 additions and 42 deletions
55
tidepool/src/capabilities/configure.nix
Normal file
55
tidepool/src/capabilities/configure.nix
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
config.capabilities.configure =
|
||||
{ config, global, ... }:
|
||||
let
|
||||
inherit (global)
|
||||
lib
|
||||
;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.configure = {
|
||||
flags = lib.options.create {
|
||||
description = "List of flags to pass to configure.";
|
||||
type = lib.types.list.of lib.types.string;
|
||||
default.value = [ ];
|
||||
};
|
||||
prefix = lib.options.create {
|
||||
description = "Include prefix configure flag.";
|
||||
type = lib.types.bool;
|
||||
default.value = true;
|
||||
};
|
||||
platforms = lib.options.create {
|
||||
description = "Include platform configure flags.";
|
||||
type = lib.types.bool;
|
||||
default.value = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
phases =
|
||||
let
|
||||
configureFlags = builtins.concatStringsSep " " (
|
||||
lib.lists.when config.configure.prefix [ "--prefix=$out" ]
|
||||
++ lib.lists.when config.configure.platforms [
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
]
|
||||
++ config.configure.flags
|
||||
);
|
||||
in
|
||||
{
|
||||
configureConfigure = lib.dag.entry.between [ "unpack" ] [ "configure" ] ''
|
||||
pwd
|
||||
# Configure
|
||||
bash ./configure \
|
||||
${configureFlags}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -4,7 +4,9 @@ let
|
|||
in
|
||||
{
|
||||
includes = [
|
||||
./unpack.nix
|
||||
./make.nix
|
||||
./configure.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
|
|
|
|||
|
|
@ -14,12 +14,17 @@
|
|||
type = lib.types.list.of lib.types.string;
|
||||
default.value = [ ];
|
||||
};
|
||||
bootstrap = lib.options.create {
|
||||
description = "Whether to use the bootstrap tools for i686-linux builds.";
|
||||
type = lib.types.bool;
|
||||
default.value = false;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
deps.build.build = {
|
||||
deps.build = {
|
||||
gnumake =
|
||||
if (config.platform.build == "i686-linux") then
|
||||
if (config.make.bootstrap && config.platform.build == "i686-linux") then
|
||||
packages.foundation.gnumake.versions."4.4.1-bootstrap"
|
||||
else
|
||||
packages.foundation.gnumake.versions."4.4.1-stage1-passthrough";
|
||||
|
|
@ -30,10 +35,10 @@
|
|||
makeFlags = builtins.concatStringsSep " " config.make.flags;
|
||||
in
|
||||
{
|
||||
makeBuild = lib.dag.entry.before [ "build" ] ''
|
||||
makeBuild = lib.dag.entry.between [ "configure" ] [ "build" ] ''
|
||||
make -j $NIX_BUILD_CORES ${makeFlags}
|
||||
'';
|
||||
makeInstall = lib.dag.entry.before [ "install" ] ''
|
||||
makeInstall = lib.dag.entry.between [ "build" ] [ "install" ] ''
|
||||
make -j $NIX_BUILD_CORES install ${makeFlags}
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
46
tidepool/src/capabilities/unpack.nix
Normal file
46
tidepool/src/capabilities/unpack.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
config.capabilities.unpack =
|
||||
{ config, global, ... }:
|
||||
let
|
||||
inherit (global)
|
||||
lib
|
||||
packages
|
||||
;
|
||||
in
|
||||
{
|
||||
options.unpack = {
|
||||
bootstrap = lib.options.create {
|
||||
description = "Whether to use the bootstrap tools for i686-linux builds.";
|
||||
type = lib.types.bool;
|
||||
default.value = false;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
deps.build =
|
||||
if (config.make.bootstrap && config.platform.build == "i686-linux") then
|
||||
{
|
||||
bzip2 = packages.foundation.bzip2.versions."1.0.8-bootstrap";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-bootstrap";
|
||||
gzip = packages.foundation.gzip.versions."1.13-bootstrap";
|
||||
xz = packages.foundation.xz.versions."5.4.3-bootstrap";
|
||||
}
|
||||
else
|
||||
{
|
||||
bzip2 = packages.foundation.bzip2.versions."1.0.8-stage1-passthrough";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-stage1-passthrough";
|
||||
gzip = packages.foundation.gzip.versions."1.13-stage1-passthrough";
|
||||
xz = packages.foundation.xz.versions."5.4.3-stage1-passthrough";
|
||||
};
|
||||
|
||||
phases = {
|
||||
unpackUnpack = lib.dag.entry.before [ "unpack" ] ''
|
||||
before=$(ls -d */ 2>/dev/null | sort)
|
||||
tar xzf ${config.src}
|
||||
after=$(ls -d */ 2>/dev/null | sort)
|
||||
cd $(comm -13 <(echo "$before") <(echo "$after") | head -1)
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -10,15 +10,12 @@ let
|
|||
;
|
||||
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
};
|
||||
in
|
||||
{
|
||||
includes = [
|
||||
capabilities.make
|
||||
includes = with capabilities; [
|
||||
unpack
|
||||
make
|
||||
configure
|
||||
];
|
||||
|
||||
config = {
|
||||
|
|
@ -57,10 +54,8 @@ in
|
|||
{
|
||||
gnupatch = packages.foundation.gnupatch.versions."2.7-bootstrap";
|
||||
gnused = packages.foundation.gnused.versions."4.9-bootstrap";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-bootstrap";
|
||||
gnugrep = packages.foundation.gnugrep.versions."3.11-bootstrap";
|
||||
gawk = packages.foundation.gawk.versions."5.2.2-bootstrap";
|
||||
gzip = packages.foundation.gzip.versions."1.13-bootstrap";
|
||||
diffutils = packages.foundation.diffutils.versions."3.10-bootstrap";
|
||||
findutils = packages.foundation.findutils.versions."4.9.0-bootstrap";
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-bootstrap";
|
||||
|
|
@ -70,10 +65,8 @@ in
|
|||
{
|
||||
gnupatch = packages.foundation.gnupatch.versions."2.7-stage1-passthrough";
|
||||
gnused = packages.foundation.gnused.versions."4.9-stage1-passthrough";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-stage1-passthrough";
|
||||
gnugrep = packages.foundation.gnugrep.versions."3.11-stage1-passthrough";
|
||||
gawk = packages.foundation.gawk.versions."5.2.2-stage1-passthrough";
|
||||
gzip = packages.foundation.gzip.versions."1.13-stage1-passthrough";
|
||||
diffutils = packages.foundation.diffutils.versions."3.10-stage1-passthrough";
|
||||
findutils = packages.foundation.findutils.versions."4.9.0-stage1-passthrough";
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-stage4";
|
||||
|
|
@ -86,34 +79,17 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
unpack.bootstrap = true;
|
||||
make.bootstrap = true;
|
||||
configure.flags = [
|
||||
"--enable-static-link"
|
||||
"bash_cv_func_strtoimax=y"
|
||||
]
|
||||
++ lib.lists.when (config.platform.host == "i686-linux") [
|
||||
"--without-bash-malloc"
|
||||
];
|
||||
|
||||
phases = {
|
||||
unpack = ''
|
||||
# Unpack
|
||||
tar xf ${config.src}
|
||||
cd bash-${version}
|
||||
'';
|
||||
|
||||
configure =
|
||||
let
|
||||
flags = builtins.concatStringsSep " " (
|
||||
[
|
||||
"--prefix=$out"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--enable-static-link"
|
||||
]
|
||||
++ lib.lists.when (config.platform.host == "i686-linux") [
|
||||
"--without-bash-malloc"
|
||||
]
|
||||
);
|
||||
in
|
||||
''
|
||||
# Configure
|
||||
bash ./configure \
|
||||
${flags} \
|
||||
bash_cv_func_strtoimax=y
|
||||
'';
|
||||
|
||||
install = ''
|
||||
# Install
|
||||
rm $out/bin/bashbug
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue