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,42 @@
From 67f54fde2b1683aae3800f7a86a4e507c1125be8 Mon Sep 17 00:00:00 2001
From: Yureka <yuka@yuka.dev>
Date: Sat, 7 Aug 2021 09:16:46 +0200
Subject: [PATCH] emulate clang 'sysroot + /include' logic
Authored-By: Alexander Khovansky <alex@khovansky.me>
Co-Authored-By: Yureka <yuka@yuka.dev>
Clang provided by nix patches out logic that appends 'sysroot + /include'
to the include path as well as automatic inclusion of libcxx includes (/include/c++/v1).
The patch below adds that logic back by introducing cflags emulating this behavior to emcc
invocations directly.
Important note: with non-nix clang, sysroot/include dir ends up being the last
in the include search order, right after the resource root.
Hence usage of -idirafter. Clang also documents an -isystem-after flag
but it doesn't appear to work
---
emcc.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/emcc.py b/emcc.py
index 999314afc..0e23c066c 100755
--- a/emcc.py
+++ b/emcc.py
@@ -759,7 +759,12 @@ def emsdk_ldflags(user_args):
def emsdk_cflags(user_args):
- cflags = ['--sysroot=' + shared.Cache.get_sysroot(absolute=True)]
+ cflags = [
+ '--sysroot=' + shared.Cache.get_sysroot(absolute=True),
+ '-resource-dir=@resourceDir@',
+ '-idirafter' + shared.Cache.get_sysroot(absolute=True) + os.path.join('/include'),
+ '-iwithsysroot' + os.path.join('/include','c++','v1')
+ ]
def array_contains_any_of(hay, needles):
for n in needles:
--
2.32.0

View file

@ -0,0 +1,126 @@
{ lib, stdenv, fetchFromGitHub, python3, nodejs, closurecompiler
, jre, binaryen
, llvmPackages
, symlinkJoin, makeWrapper, substituteAll
, mkYarnModules
}:
stdenv.mkDerivation rec {
pname = "emscripten";
version = "3.0.0";
llvmEnv = symlinkJoin {
name = "emscripten-llvm-${version}";
paths = with llvmPackages; [ clang-unwrapped clang-unwrapped.lib lld llvm ];
};
nodeModules = mkYarnModules {
name = "emscripten-node-modules-${version}";
inherit pname version;
# it is vitally important the the package.json has name and version fields
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
};
src = fetchFromGitHub {
owner = "emscripten-core";
repo = "emscripten";
sha256 = "sha256-HlXcPKlmBTwEKgTfeMg6QoMKMbK++bpv2fu1DyolrHs=";
rev = version;
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ nodejs python3 ];
patches = [
(substituteAll {
src = ./0001-emulate-clang-sysroot-include-logic.patch;
resourceDir = "${llvmEnv}/lib/clang/${llvmPackages.release_version}/";
})
];
buildPhase = ''
runHook preBuild
patchShebangs .
# fixes cmake support
sed -i -e "s/print \('emcc (Emscript.*\)/sys.stderr.write(\1); sys.stderr.flush()/g" emcc.py
# disables cache in user home, use installation directory instead
sed -i '/^def/!s/root_is_writable()/True/' tools/config.py
sed -i "/^def check_sanity/a\\ return" tools/shared.py
# required for wasm2c
ln -s ${nodeModules}/node_modules .
echo "EMSCRIPTEN_ROOT = '$out/share/emscripten'" > .emscripten
echo "LLVM_ROOT = '${llvmEnv}/bin'" >> .emscripten
echo "NODE_JS = '${nodejs}/bin/node'" >> .emscripten
echo "JS_ENGINES = [NODE_JS]" >> .emscripten
echo "CLOSURE_COMPILER = ['${closurecompiler}/bin/closure-compiler']" >> .emscripten
echo "JAVA = '${jre}/bin/java'" >> .emscripten
# to make the test(s) below work
# echo "SPIDERMONKEY_ENGINE = []" >> .emscripten
echo "BINARYEN_ROOT = '${binaryen}'" >> .emscripten
# make emconfigure/emcmake use the correct (wrapped) binaries
sed -i "s|^EMCC =.*|EMCC='$out/bin/emcc'|" tools/shared.py
sed -i "s|^EMXX =.*|EMXX='$out/bin/em++'|" tools/shared.py
sed -i "s|^EMAR =.*|EMAR='$out/bin/emar'|" tools/shared.py
sed -i "s|^EMRANLIB =.*|EMRANLIB='$out/bin/emranlib'|" tools/shared.py
runHook postBuild
'';
installPhase = ''
runHook preInstall
appdir=$out/share/emscripten
mkdir -p $appdir
cp -r . $appdir
chmod -R +w $appdir
mkdir -p $out/bin
for b in em++ em-config emar embuilder.py emcc emcmake emconfigure emmake emranlib emrun emscons emsize; do
makeWrapper $appdir/$b $out/bin/$b \
--set NODE_PATH ${nodeModules}/node_modules \
--set EM_EXCLUSIVE_CACHE_ACCESS 1 \
--set PYTHON ${python3}/bin/python
done
# precompile libc (etc.) in all variants:
pushd $TMPDIR
echo 'int main() { return 42; }' >test.c
for LTO in -flto ""; do
# wasm2c doesn't work with PIC
$out/bin/emcc -s WASM2C -s STANDALONE_WASM $LTO test.c
for BIND in "" "--bind"; do
for MT in "" "-s USE_PTHREADS"; do
for RELOCATABLE in "" "-s RELOCATABLE"; do
$out/bin/emcc $RELOCATABLE $BIND $MT $LTO test.c
done
done
done
done
popd
export PYTHON=${python3}/bin/python
export NODE_PATH=${nodeModules}/node_modules
pushd $appdir
python tests/runner.py test_hello_world
popd
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/emscripten-core/emscripten";
description = "An LLVM-to-JavaScript Compiler";
platforms = platforms.all;
maintainers = with maintainers; [ qknight matthewbauer ];
license = licenses.ncsa;
};
}

View file

@ -0,0 +1,21 @@
{
"name": "emscripten",
"version": "2.0.26",
"private": true,
"devDependencies": {
"es-check": "^5.2.4",
"eslint": "^7.29.0",
"eslint-config-google": "^0.14.0",
"source-map": "0.5.7",
"ws": "~0.4.28"
},
"dependencies": {
"acorn": "8.4.1",
"google-closure-compiler": "20210601.0.0",
"html-minifier-terser": "5.1.1",
"wasm2c": "1.0.0"
},
"scripts": {
"lint": "eslint src/parseTools.js"
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff