push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
{
lib,
stdenv,
build2,
fetchurl,
libbpkg,
libbutl,
libodb,
libodb-sqlite,
enableShared ? !stdenv.hostPlatform.isStatic,
enableStatic ? !enableShared,
}:
stdenv.mkDerivation rec {
pname = "bdep";
version = "0.17.0";
outputs = [
"out"
"doc"
"man"
];
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/bdep-${version}.tar.gz";
hash = "sha256-+2Hl5kanxWJmOpfePAvvSBSmG3kZLQv/kYIkT4J+kaQ=";
};
strictDeps = true;
nativeBuildInputs = [
build2
];
buildInputs = [
libbpkg
libbutl
libodb
libodb-sqlite
];
build2ConfigureFlags = [
"config.bin.lib=${build2.configSharedStatic enableShared enableStatic}"
];
meta = with lib; {
description = "Build2 project dependency manager";
mainProgram = "bdep";
# https://build2.org/bdep/doc/bdep.xhtml
longDescription = ''
The build2 project dependency manager is used to manage the dependencies
of a project during development.
'';
homepage = "https://build2.org/";
changelog = "https://git.build2.org/cgit/bdep/tree/NEWS";
license = licenses.mit;
maintainers = with maintainers; [ r-burns ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,56 @@
{
lib,
stdenv,
fetchurl,
pkgs,
buildPackages,
fixDarwinDylibNames,
}:
stdenv.mkDerivation rec {
pname = "build2-bootstrap";
version = "0.17.0";
src = fetchurl {
url = "https://download.build2.org/${version}/build2-toolchain-${version}.tar.xz";
hash = "sha256-NyKonqht90JTnQ+Ru0Qp/Ua79mhVOjUHgKY0EbZIv10=";
};
patches = [
# Pick up sysdirs from NIX_LDFLAGS
./nix-ldflags-sysdirs.patch
];
sourceRoot = "build2-toolchain-${version}/build2";
makefile = "bootstrap.gmake";
enableParallelBuilding = true;
setupHook = ./setup-hook.sh;
strictDeps = true;
propagatedBuildInputs = lib.optionals stdenv.targetPlatform.isDarwin [
fixDarwinDylibNames
# Build2 needs to use lld on Darwin because it creates thin archives when it detects `llvm-ar`,
# which ld64 does not support.
(lib.getBin buildPackages.llvmPackages.lld)
];
doCheck = true;
checkPhase = ''
runHook preCheck
build2/b-boot --version
runHook postCheck
'';
installPhase = ''
runHook preInstall
install -D build2/b-boot $out/bin/b
runHook postInstall
'';
postFixup = ''
substituteInPlace $out/nix-support/setup-hook \
--subst-var-by isTargetDarwin '${toString stdenv.targetPlatform.isDarwin}'
'';
inherit (pkgs.build2) passthru;
}

View File

@@ -0,0 +1,76 @@
{
lib,
stdenv,
build2,
fetchurl,
git,
libbpkg,
libbutl,
libodb,
libodb-sqlite,
openssl,
enableShared ? !stdenv.hostPlatform.isStatic,
enableStatic ? !enableShared,
}:
stdenv.mkDerivation rec {
pname = "bpkg";
version = "0.17.0";
outputs = [
"out"
"doc"
"man"
];
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/bpkg-${version}.tar.gz";
hash = "sha256-Yw6wvTqO+VfCo91B2BUT0A8OIN0MVhGK1USYM7hgGMs=";
};
strictDeps = true;
nativeBuildInputs = [
build2
];
buildInputs = [
build2
libbpkg
libbutl
libodb
libodb-sqlite
];
nativeCheckInputs = [
git
openssl
];
doCheck = true;
# Failing test
postPatch = ''
rm tests/rep-create.testscript
'';
build2ConfigureFlags = [
"config.bin.lib=${build2.configSharedStatic enableShared enableStatic}"
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -add_rpath '${lib.getLib build2}/lib' "''${!outputBin}/bin/bpkg"
'';
meta = with lib; {
description = "Build2 package dependency manager";
mainProgram = "bpkg";
# https://build2.org/bpkg/doc/bpkg.xhtml
longDescription = ''
The build2 package dependency manager is used to manipulate build
configurations, packages, and repositories.
'';
homepage = "https://build2.org/";
changelog = "https://git.build2.org/cgit/bpkg/tree/NEWS";
license = licenses.mit;
maintainers = with maintainers; [ r-burns ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,125 @@
{
stdenv,
lib,
build2,
fetchurl,
fixDarwinDylibNames,
libbutl,
libpkgconf,
buildPackages,
enableShared ? !stdenv.hostPlatform.isStatic,
enableStatic ? !enableShared,
}:
let
configSharedStatic =
enableShared: enableStatic:
if enableShared && enableStatic then
"both"
else if enableShared then
"shared"
else if enableStatic then
"static"
else
throw "neither shared nor static libraries requested";
in
stdenv.mkDerivation rec {
pname = "build2";
version = "0.17.0";
outputs = [
"out"
"dev"
"doc"
"man"
];
setupHook = ./setup-hook.sh;
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/build2-${version}.tar.gz";
hash = "sha256-Kx5X/GV3GjFSbjo1mzteiHnnm4mr6+NAKIR/mEE+IdA=";
};
patches = [
# Remove any build/host config entries which refer to nix store paths
./remove-config-store-paths.patch
# Pick up sysdirs from NIX_LDFLAGS
./nix-ldflags-sysdirs.patch
];
strictDeps = true;
nativeBuildInputs = [
build2
];
disallowedReferences = [
build2
libbutl.dev
libpkgconf.dev
];
buildInputs = [
libbutl
libpkgconf
];
# Build2 uses @rpath on darwin
# https://github.com/build2/build2/issues/166
# N.B. this only adjusts the install_name after all libraries are installed;
# packages containing multiple interdependent libraries may have
# LC_LOAD_DYLIB entries containing @rpath, requiring manual fixup
propagatedBuildInputs = lib.optionals stdenv.targetPlatform.isDarwin [
fixDarwinDylibNames
# Build2 needs to use lld on Darwin because it creates thin archives when it detects `llvm-ar`,
# which ld64 does not support.
(lib.getBin buildPackages.llvmPackages.lld)
];
postPatch = ''
patchShebangs --build tests/bash/testscript
'';
build2ConfigureFlags = [
"config.bin.lib=${configSharedStatic enableShared enableStatic}"
"config.cc.poptions+=-I${lib.getDev libpkgconf}/include/pkgconf"
"config.build2.libpkgconf=true"
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -add_rpath "''${!outputLib}/lib" "''${!outputBin}/bin/b"
'';
postFixup = ''
substituteInPlace $dev/nix-support/setup-hook \
--subst-var-by isTargetDarwin '${toString stdenv.targetPlatform.isDarwin}'
'';
passthru = {
bootstrap = build2;
inherit configSharedStatic;
};
meta = with lib; {
homepage = "https://www.build2.org/";
description = "Build2 build system";
license = licenses.mit;
longDescription = ''
build2 is an open source (MIT), cross-platform build toolchain
that aims to approximate Rust Cargo's convenience for developing
and packaging C/C++ projects while providing more depth and
flexibility, especially in the build system.
build2 is a hierarchy of tools consisting of a general-purpose
build system, package manager (for package consumption), and
project manager (for project development). It is primarily aimed
at C/C++ projects as well as mixed-language projects involving
one of these languages (see bash and rust modules, for example).
'';
changelog = "https://git.build2.org/cgit/build2/tree/NEWS";
platforms = platforms.all;
maintainers = with maintainers; [
hiro98
r-burns
];
mainProgram = "b";
};
}

View File

@@ -0,0 +1,42 @@
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index f848003c..0f14f9a5 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -966,6 +966,17 @@ namespace build2
void
msvc_extract_library_search_dirs (const strings&, dir_paths&); // msvc.cxx
+ static strings split (const string& s, const char delim) {
+ stringstream ss (s);
+ string item;
+ strings result;
+
+ while (getline (ss, item, delim)) {
+ result.push_back (item);
+ }
+ return result;
+ }
+
dir_paths common::
extract_library_search_dirs (const scope& bs) const
{
@@ -987,8 +998,19 @@ namespace build2
msvc_extract_library_search_dirs (v, r);
else
gcc_extract_library_search_dirs (v, r);
+
};
+ // NIX_LDFLAGS are implicitly used when linking,
+ // so its -L flags effectively specify system dirs.
+ // However, they are only enabled when actually linking and are thus
+ // not detected by build2, so we need to manually pick them up here.
+ if (auto s = getenv ("NIX_LDFLAGS")) {
+ // TODO: do we need more robust args splitting here? e.g. shlex.split
+ auto args = split (s.value (), ' ');
+ gcc_extract_library_search_dirs (args, r);
+ }
+
// Note that the compiler mode options are in sys_lib_dirs.
//
if (auto l = bs[c_loptions]) extract (*l, c_loptions);

View File

@@ -0,0 +1,14 @@
--- a/libbuild2/buildfile
+++ b/libbuild2/buildfile
@@ -86,8 +86,11 @@ build2_config_lines = [strings]
host_config_lines = [strings]
for l: $regex.replace_lines( \
+ $regex.replace_lines( \
$config.save(), \
'^( *(#|(config\.(test[. ]|dist\.|install\.chroot|config\.hermetic))).*|)$', \
+ [null], return_lines), \
+ '^.*'$getenv(NIX_STORE)'/[a-z0-9]{32}-.*$', \
[null])
{
build2_config_lines += $l

View File

@@ -0,0 +1,91 @@
# shellcheck shell=bash
build2ConfigurePhase() {
runHook preConfigure
local flagsArray=(
"config.c=$CC"
"config.cxx=$CXX"
"config.cc.coptions+=-O2"
"config.cc.poptions+=-DNDEBUG"
"config.install.root=$prefix"
"config.install.bin=${!outputBin}/bin"
"config.install.doc=${!outputDoc}/share/doc/${shareDocName}"
"config.install.exec_root=${!outputBin}"
"config.install.include=${!outputInclude}/include"
"config.install.lib=${!outputLib}/lib"
"config.install.libexec=${!outputLib}/libexec"
"config.install.man=${!outputDoc}/share/man"
"config.install.sbin=${!outputBin}/sbin"
"config.install.bin.mode=755"
)
concatTo flagsArray build2ConfigureFlags build2ConfigureFlagsArray
# shellcheck disable=SC2157
if [ -n "@isTargetDarwin@" ]; then
flagsArray+=("config.bin.ld=ld64-lld")
flagsArray+=("config.cc.loptions+=-fuse-ld=lld")
flagsArray+=("config.cc.loptions+=-headerpad_max_install_names")
fi
echo 'configure flags' "${flagsArray[@]}"
b configure "${flagsArray[@]}"
runHook postConfigure
}
build2BuildPhase() {
runHook preBuild
local flagsArray=()
concatTo flagsArray build2BuildFlags build2BuildFlagsArray
echo 'build flags' "${flagsArray[@]}"
b "${flagsArray[@]}"
runHook postBuild
}
build2CheckPhase() {
runHook preCheck
local flagsArray=()
concatTo flagsArray build2CheckFlags build2CheckFlags
echo 'check flags' "${flagsArray[@]}"
b test "${build2Dir:-.}" "${flagsArray[@]}"
runHook postCheck
}
build2InstallPhase() {
runHook preInstall
local flagsArray=()
concatTo flagsArray build2InstallFlags build2InstallFlagsArray installTargets
echo 'install flags' "${flagsArray[@]}"
b install "${flagsArray[@]}"
runHook postInstall
}
if [ -z "${dontUseBuild2Configure-}" ] && [ -z "${configurePhase-}" ]; then
# shellcheck disable=SC2034
setOutputFlags=
configurePhase=build2ConfigurePhase
fi
if [ -z "${dontUseBuild2Build-}" ] && [ -z "${buildPhase-}" ]; then
buildPhase=build2BuildPhase
fi
if [ -z "${dontUseBuild2Check-}" ] && [ -z "${checkPhase-}" ]; then
checkPhase=build2CheckPhase
fi
if [ -z "${dontUseBuild2Install-}" ] && [ -z "${installPhase-}" ]; then
installPhase=build2InstallPhase
fi