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,15 @@
diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl
index 454c54b0ef..2ac0623cf0 100644
--- a/bazel/repository_locations.bzl
+++ b/bazel/repository_locations.bzl
@@ -510,8 +510,8 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_url = "https://brotli.org",
# Use the dev branch of brotli to resolve compilation issues.
# TODO(rojkov): Remove when brotli > 1.0.9 is released.
- version = "0cd2e3926e95e7e2930f57ae3f4885508d462a25",
- sha256 = "93810780e60304b51f2c9645fe313a6e4640711063ed0b860cfa60999dd256c5",
+ version = "27dd7265403d8e8fed99a854b9c3e1db7d79525f",
+ sha256 = "e71238b12e30233bdf25997132b29ae49639a69f33fdef3ae18a47abfc0d5e4c",
strip_prefix = "brotli-{version}",
urls = ["https://github.com/google/brotli/archive/{version}.tar.gz"],
use_category = ["dataplane_ext"],

View file

@ -0,0 +1,161 @@
{ lib
, bazel_4
, buildBazelPackage
, fetchFromGitHub
, fetchpatch
, stdenv
, cmake
, gn
, go
, jdk
, ninja
, python3
, linuxHeaders
, nixosTests
# v8 (upstream default), wavm, wamr, wasmtime, disabled
, wasmRuntime ? "wamr"
}:
let
srcVer = {
# We need the commit hash, since Bazel stamps the build with it.
# However, the version string is more useful for end-users.
# These are contained in a attrset of their own to make it obvious that
# people should update both.
version = "1.21.1";
rev = "af50070ee60866874b0a9383daf9364e884ded22";
};
in
buildBazelPackage rec {
pname = "envoy";
inherit (srcVer) version;
bazel = bazel_4;
src = fetchFromGitHub {
owner = "envoyproxy";
repo = "envoy";
inherit (srcVer) rev;
hash = "sha256:11mm72zmb479ss585jzqzhklyyqmdadnvr91ghzvjxc0j2a1hrr4";
postFetch = ''
chmod -R +w $out
rm $out/.bazelversion
echo ${srcVer.rev} > $out/SOURCE_VERSION
sed -i 's/GO_VERSION = ".*"/GO_VERSION = "host"/g' $out/bazel/dependency_imports.bzl
'';
};
postPatch = ''
sed -i 's,#!/usr/bin/env python3,#!${python3}/bin/python,' bazel/foreign_cc/luajit.patch
sed -i '/javabase=/d' .bazelrc
# Patch paths to build tools, and disable gold because it just segfaults.
substituteInPlace bazel/external/wee8.genrule_cmd \
--replace '"''$$gn"' '"''$$(command -v gn)"' \
--replace '"''$$ninja"' '"''$$(command -v ninja)"' \
--replace '"''$$WEE8_BUILD_ARGS"' '"''$$WEE8_BUILD_ARGS use_gold=false"'
'';
patches = [
# make linux/tcp.h relative. drop when upgrading to >1.21
(fetchpatch {
url = "https://github.com/envoyproxy/envoy/commit/68448aae7a78a3123097b6ea96016b270457e7b8.patch";
sha256 = "123kv3x37p8fgfp29jhw5xg5js5q5ipibs8hsm7gzfd5bcllnpfh";
})
# fix issues with brotli and GCC 11.2.0+ (-Werror=vla-parameter)
./bump-brotli.patch
# fix linux-aarch64 WAMR builds
# (upstream WAMR only detects aarch64 on Darwin, not Linux)
./fix-aarch64-wamr.patch
];
nativeBuildInputs = [
cmake
python3
gn
go
jdk
ninja
];
buildInputs = [
linuxHeaders
];
fetchAttrs = {
sha256 = {
x86_64-linux = "sha256-23Z6SbKnbah/NCrdMrXhrNFFASd/8xRH3fSyIE++heA=";
aarch64-linux = "sha256-dMOu0HYUIUJ+XEtctjaZZ1jGGQq+cHbay8+KwR5XqP0=";
}.${stdenv.system} or (throw "unsupported system ${stdenv.system}");
dontUseCmakeConfigure = true;
dontUseGnConfigure = true;
preInstall = ''
# Strip out the path to the build location (by deleting the comment line).
find $bazelOut/external -name requirements.bzl | while read requirements; do
sed -i '/# Generated from /d' "$requirements"
done
# Remove references to paths in the Nix store.
sed -i \
-e 's,${python3},__NIXPYTHON__,' \
-e 's,${stdenv.shellPackage},__NIXSHELL__,' \
$bazelOut/external/com_github_luajit_luajit/build.py \
$bazelOut/external/local_config_sh/BUILD
rm -r $bazelOut/external/go_sdk
# Remove Unix timestamps from go cache.
rm -rf $bazelOut/external/bazel_gazelle_go_repository_cache/{gocache,pkg/mod/cache,pkg/sumdb}
'';
};
buildAttrs = {
dontUseCmakeConfigure = true;
dontUseGnConfigure = true;
dontUseNinjaInstall = true;
preConfigure = ''
sed -i 's,#!/usr/bin/env bash,#!${stdenv.shell},' $bazelOut/external/rules_foreign_cc/foreign_cc/private/framework/toolchains/linux_commands.bzl
# Add paths to Nix store back.
sed -i \
-e 's,__NIXPYTHON__,${python3},' \
-e 's,__NIXSHELL__,${stdenv.shellPackage},' \
$bazelOut/external/com_github_luajit_luajit/build.py \
$bazelOut/external/local_config_sh/BUILD
'';
installPhase = ''
install -Dm0755 bazel-bin/source/exe/envoy-static $out/bin/envoy
'';
};
removeRulesCC = false;
removeLocalConfigCc = true;
removeLocal = false;
bazelTarget = "//source/exe:envoy-static";
bazelBuildFlags = [
"-c opt"
"--spawn_strategy=standalone"
"--noexperimental_strict_action_env"
"--cxxopt=-Wno-maybe-uninitialized"
"--cxxopt=-Wno-uninitialized"
"--cxxopt=-Wno-error=type-limits"
"--define=wasm=${wasmRuntime}"
];
bazelFetchFlags = [
"--define=wasm=${wasmRuntime}"
];
passthru.tests = {
envoy = nixosTests.envoy;
# tested as a core component of Pomerium
pomerium = nixosTests.pomerium;
};
meta = with lib; {
homepage = "https://envoyproxy.io";
description = "Cloud-native edge and service proxy";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
};
}

View file

@ -0,0 +1,38 @@
diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl
index f48ebe7056..1e5cc5d663 100644
--- a/bazel/envoy_build_system.bzl
+++ b/bazel/envoy_build_system.bzl
@@ -102,6 +102,7 @@ def envoy_cmake(
pdb_name = "",
cmake_files_dir = "$BUILD_TMPDIR/CMakeFiles",
generate_crosstool_file = False,
+ generate_args = [],
**kwargs):
cache_entries.update({"CMAKE_BUILD_TYPE": "Bazel"})
cache_entries_debug = dict(cache_entries)
@@ -131,7 +132,7 @@ def envoy_cmake(
"@envoy//bazel:dbg_build": cache_entries_debug,
"//conditions:default": cache_entries,
}),
- generate_args = ["-GNinja"],
+ generate_args = ["-GNinja"] + generate_args,
targets = ["", "install"],
# TODO: Remove install target and make this work
install = False,
diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD
index 4d3a281669..b4716dfe2e 100644
--- a/bazel/foreign_cc/BUILD
+++ b/bazel/foreign_cc/BUILD
@@ -394,6 +394,12 @@ envoy_cmake(
"WAMR_BUILD_LIBC_WASI": "0",
"WAMR_BUILD_TAIL_CALL": "1",
},
+ generate_args = select({
+ "//conditions:default": [],
+ "@platforms//cpu:aarch64": [
+ "-DWAMR_BUILD_TARGET=AARCH64",
+ ],
+ }),
lib_source = "@com_github_wamr//:all",
out_static_libs = ["libvmlib.a"],
tags = ["skip_on_windows"],