uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,50 @@
{ lib, stdenv
, build2
, fetchurl
, libbpkg
, libbutl
, libodb
, libodb-sqlite
, enableShared ? !stdenv.hostPlatform.isStatic
, enableStatic ? !enableShared
}:
stdenv.mkDerivation rec {
pname = "bdep";
version = "0.14.0";
outputs = [ "out" "doc" "man" ];
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/bdep-${version}.tar.gz";
sha256 = "sha256-sizrGmSixkkJL9nocA4B1I5n9OySxyuZ2bNc1Z4zmPg=";
};
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";
# 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,44 @@
{ lib, stdenv
, fetchurl
, pkgs
, fixDarwinDylibNames
}:
stdenv.mkDerivation rec {
pname = "build2-bootstrap";
version = "0.14.0";
src = fetchurl {
url = "https://download.build2.org/${version}/build2-toolchain-${version}.tar.xz";
sha256 = "sha256-GO/GstQUmPdRbnqKXJECP2GCyGfUI3kjmDkN0MAEz90=";
};
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
];
doCheck = true;
checkPhase = ''
runHook preCheck
build2/b-boot --version
runHook postCheck
'';
installPhase = ''
runHook preInstall
install -D build2/b-boot $out/bin/b
runHook postInstall
'';
inherit (pkgs.build2) passthru;
}

View file

@ -0,0 +1,64 @@
{ lib, stdenv
, build2
, fetchurl
, git
, libbpkg
, libbutl
, libodb
, libodb-sqlite
, openssl
, enableShared ? !stdenv.hostPlatform.isStatic
, enableStatic ? !enableShared
}:
stdenv.mkDerivation rec {
pname = "bpkg";
version = "0.14.0";
outputs = [ "out" "doc" "man" ];
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/bpkg-${version}.tar.gz";
sha256 = "sha256-4WTFm0NYZOujxQ3PR9MyjXEJ4ql4qZ9OM5BePuHIK1M=";
};
strictDeps = true;
nativeBuildInputs = [
build2
];
buildInputs = [
libbpkg
libbutl
libodb
libodb-sqlite
];
checkInputs = [
git
openssl
];
doCheck = !stdenv.isDarwin; # tests hang
# Failing test
postPatch = ''
rm tests/rep-create.testscript
'';
build2ConfigureFlags = [
"config.bin.lib=${build2.configSharedStatic enableShared enableStatic}"
];
meta = with lib; {
description = "build2 package dependency manager";
# 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,99 @@
{ stdenv, lib
, build2
, fetchurl
, fixDarwinDylibNames
, libbutl
, libpkgconf
, 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.14.0";
outputs = [ "out" "dev" "doc" "man" ];
setupHook = ./setup-hook.sh;
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/build2-${version}.tar.gz";
sha256 = "sha256-/pWj68JmBthOJ2CTQHo9Ww3MCv4xBOw0SusJpMfX5Y8=";
};
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
];
postPatch = ''
patchShebangs --build tests/bash/testscript
'';
build2ConfigureFlags = [
"config.bin.lib=${configSharedStatic enableShared enableStatic}"
"config.cc.poptions+=-I${lib.getDev libpkgconf}/include/pkgconf"
];
postInstall = lib.optionalString stdenv.isDarwin ''
install_name_tool -add_rpath "''${!outputLib}/lib" "''${!outputBin}/bin/b"
'';
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
@@ -73,7 +73,11 @@ config/cxx{host-config}: config/in{host-config}
#
build2_config = $regex.replace_lines( \
+ $regex.replace_lines( \
$config.save(), \
'^ *(#|(config\.(dist\.|install\.chroot|config\.hermetic))).*$', \
[null], \
+ return_lines), \
+ '^.*'$getenv(NIX_STORE)'/[a-z0-9]{32}-.*$', \
+ [null], \
return_lines)

View file

@ -0,0 +1,85 @@
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"
$build2ConfigureFlags "${build2ConfigureFlagsArray[@]}"
)
echo 'configure flags' "${flagsArray[@]}"
b configure "${flagsArray[@]}"
runHook postConfigure
}
build2BuildPhase() {
runHook preBuild
local flagsArray=(
$build2BuildFlags "${build2BuildFlagsArray[@]}"
)
echo 'build flags' "${flagsArray[@]}"
b "${flagsArray[@]}"
runHook postBuild
}
build2CheckPhase() {
runHook preCheck
local flagsArray=(
$build2CheckFlags "${build2CheckFlags[@]}"
)
echo 'check flags' "${flagsArray[@]}"
b test ${build2Dir:-.} "${flagsArray[@]}"
runHook postCheck
}
build2InstallPhase() {
runHook preInstall
local flagsArray=(
$build2InstallFlags "${build2InstallFlagsArray[@]}"
${installTargets:-}
)
echo 'install flags' "${flagsArray[@]}"
b install "${flagsArray[@]}"
runHook postInstall
}
if [ -z "${dontUseBuild2Configure-}" -a -z "${configurePhase-}" ]; then
setOutputFlags=
configurePhase=build2ConfigurePhase
fi
if [ -z "${dontUseBuild2Build-}" -a -z "${buildPhase-}" ]; then
buildPhase=build2BuildPhase
fi
if [ -z "${dontUseBuild2Check-}" -a -z "${checkPhase-}" ]; then
checkPhase=build2CheckPhase
fi
if [ -z "${dontUseBuild2Install-}" -a -z "${installPhase-}" ]; then
installPhase=build2InstallPhase
fi