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,139 @@
{ lib, stdenv
, fetchurl
, fetchpatch
, autoconf213
, pkg-config
, perl
, python3
, zip
, buildPackages
, which
, readline
, zlib
, icu67
, cargo
, rustc
, rust-cbindgen
, yasm
, nspr
}:
stdenv.mkDerivation rec {
pname = "spidermonkey";
version = "78.15.0";
src = fetchurl {
url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
sha256 = "0l91cxdc5v9fps79ckb1kid4gw6v5qng1jd9zvaacwaiv628shx4";
};
patches = [
# Fix build failure on armv7l using Debian patch
# Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1526653
(fetchpatch {
url = "https://salsa.debian.org/mozilla-team/firefox/commit/fd6847c9416f9eebde636e21d794d25d1be8791d.patch";
sha256 = "02b7zwm6vxmk61aj79a6m32s1k5sr0hwm3q1j4v6np9jfyd10g1j";
})
# Remove this when updating to 79 - The patches are already applied upstream
# https://bugzilla.mozilla.org/show_bug.cgi?id=1318905
# Combination of 3 changesets, modified to apply on 78:
# - https://hg.mozilla.org/mozilla-central/rev/06d7e1b6b7e7
# - https://hg.mozilla.org/mozilla-central/rev/ec48f15d085c
# - https://hg.mozilla.org/mozilla-central/rev/6803dda74d33
./add-riscv64-support.patch
];
outputs = [ "out" "dev" ];
setOutputFlags = false; # Configure script only understands --includedir
nativeBuildInputs = [
autoconf213
cargo
rustc.llvmPackages.llvm # for llvm-objdump
perl
pkg-config
python3
rust-cbindgen
rustc
which
yasm # to buid icu? seems weird
zip
];
buildInputs = [
icu67
nspr
readline
zlib
];
preConfigure = ''
export CXXFLAGS="-fpermissive"
export LIBXUL_DIST=$out
export PYTHON="${buildPackages.python3.interpreter}"
# We can't build in js/src/, so create a build dir
mkdir obj
cd obj/
configureScript=../js/src/configure
'';
configureFlags = [
"--with-system-zlib"
"--with-system-nspr"
"--with-system-icu"
"--with-intl-api"
"--enable-readline"
"--enable-shared-js"
"--disable-jemalloc"
# Fedora and Arch disable optimize, but it doesn't seme to be necessary
# It turns on -O3 which some gcc version had a problem with:
# https://src.fedoraproject.org/rpms/mozjs38/c/761399aba092bcb1299bb4fccfd60f370ab4216e
"--enable-optimize"
"--enable-release"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# Spidermonkey seems to use different host/build terminology for cross
# compilation here.
"--host=${stdenv.buildPlatform.config}"
"--target=${stdenv.hostPlatform.config}"
];
# mkDerivation by default appends --build/--host to configureFlags when cross compiling
# These defaults are bogus for Spidermonkey - avoid passing them by providing an empty list
configurePlatforms = [ ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
# cc-rs insists on using -mabi=lp64 (soft-float) for riscv64,
# while we have a double-float toolchain
NIX_CFLAGS_COMPILE = lib.optionalString (with stdenv.hostPlatform; isRiscV && is64bit) "-mabi=lp64d";
# Remove unnecessary static lib
preFixup = ''
moveToOutput bin/js78-config "$dev"
rm $out/lib/libjs_static.ajs
ln -s $out/bin/js78 $out/bin/js
'';
enableParallelBuilding = true;
postPatch = ''
# This patch is a manually applied fix of
# https://bugzilla.mozilla.org/show_bug.cgi?id=1644600
# Once that bug is fixed, this can be removed.
# This is needed in, for example, `zeroad`.
substituteInPlace js/public/StructuredClone.h \
--replace "class SharedArrayRawBufferRefs {" \
"class JS_PUBLIC_API SharedArrayRawBufferRefs {"
'';
meta = with lib; {
description = "Mozilla's JavaScript engine written in C/C++";
homepage = "https://spidermonkey.dev/";
license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license.
maintainers = with maintainers; [ abbradar lostnet ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,125 @@
{ lib
, stdenv
, fetchurl
# build time
, buildPackages
, cargo
, m4
, perl
, pkg-config
, python3
, rust-cbindgen
, rustc
, which
, zip
# runtime
, icu
, nspr
, readline
, zlib
}:
stdenv.mkDerivation rec {
pname = "spidermonkey";
version = "91.10.0";
src = fetchurl {
url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
sha512 = "8344b829d7bd86250afdd4cb582e27ed5705b3ef48aec50b9a39abc17deba86c9fd721f4667f5c2155e3d7cd1d6e1f82ff8e218ced3a16a4e06bb414ee0690f8";
};
outputs = [ "out" "dev" ];
setOutputFlags = false; # Configure script only understands --includedir
nativeBuildInputs = [
cargo
m4
perl
pkg-config
python3
rust-cbindgen
rustc
rustc.llvmPackages.llvm # for llvm-objdump
which
zip
];
buildInputs = [
icu
nspr
readline
zlib
];
preConfigure = ''
export LIBXUL_DIST=$out
export PYTHON="${buildPackages.python3.interpreter}"
export M4=m4
export AWK=awk
export AC_MACRODIR=$PWD/build/autoconf/
pushd js/src
sh ../../build/autoconf/autoconf.sh --localdir=$PWD configure.in > configure
chmod +x configure
popd
# We can't build in js/src/, so create a build dir
mkdir obj
cd obj/
configureScript=../js/src/configure
'';
configureFlags = [
"--with-intl-api"
"--with-system-icu"
"--with-system-nspr"
"--with-system-zlib"
"--enable-optimize"
"--enable-readline"
"--enable-release"
"--enable-shared-js"
"--disable-debug"
"--disable-jemalloc"
"--disable-strip"
"--disable-tests"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# Spidermonkey seems to use different host/build terminology for cross
# compilation here.
"--host=${stdenv.buildPlatform.config}"
"--target=${stdenv.hostPlatform.config}"
];
# mkDerivation by default appends --build/--host to configureFlags when cross compiling
# These defaults are bogus for Spidermonkey - avoid passing them by providing an empty list
configurePlatforms = [ ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
# Remove unnecessary static lib
preFixup = ''
moveToOutput bin/js91-config "$dev"
rm $out/lib/libjs_static.ajs
ln -s $out/bin/js91 $out/bin/js
'';
enableParallelBuilding = true;
postPatch = ''
# This patch is a manually applied fix of
# https://bugzilla.mozilla.org/show_bug.cgi?id=1644600
# Once that bug is fixed, this can be removed.
# This is needed in, for example, `zeroad`.
substituteInPlace js/public/StructuredClone.h \
--replace "class SharedArrayRawBufferRefs {" \
"class JS_PUBLIC_API SharedArrayRawBufferRefs {"
'';
meta = with lib; {
description = "Mozilla's JavaScript engine written in C/C++";
homepage = "https://spidermonkey.dev/";
license = licenses.mpl20;
maintainers = with maintainers; [ lostnet ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,123 @@
# HG changeset patch
# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
# Date 1592464269 0
# Thu Jun 18 07:11:09 2020 +0000
# Node ID 5de7d747a962df5f8aefc016a62d7270ac18879e
# Parent e4b11f027efc1f8c2710ae3f52487a8f10a8fb39
Bug 1318905 - build: Add riscv64 as target architecture to mozbuild r=glandium
Adds the basic definitions for riscv64 to mozbuild, allowing to build Spidermonkey.
Differential Revision: https://phabricator.services.mozilla.com/D78623
diff -r e4b11f027efc -r 5de7d747a962 build/moz.configure/init.configure
--- a/build/moz.configure/init.configure Sun May 31 17:11:57 2020 +0000
+++ b/build/moz.configure/init.configure Thu Jun 18 07:11:09 2020 +0000
@@ -741,6 +741,9 @@
elif cpu.startswith('aarch64'):
canonical_cpu = 'aarch64'
endianness = 'little'
+ elif cpu in ('riscv64', 'riscv64gc'):
+ canonical_cpu = 'riscv64'
+ endianness = 'little'
elif cpu == 'sh4':
canonical_cpu = 'sh4'
endianness = 'little'
diff -r e4b11f027efc -r 5de7d747a962 python/mozbuild/mozbuild/configure/constants.py
--- a/python/mozbuild/mozbuild/configure/constants.py Sun May 31 17:11:57 2020 +0000
+++ b/python/mozbuild/mozbuild/configure/constants.py Thu Jun 18 07:11:09 2020 +0000
@@ -49,6 +49,7 @@
'mips64': 64,
'ppc': 32,
'ppc64': 64,
+ 'riscv64': 64,
's390': 32,
's390x': 64,
'sh4': 32,
@@ -87,6 +88,7 @@
('sparc', '__sparc__'),
('mips64', '__mips64'),
('mips32', '__mips__'),
+ ('riscv64', '__riscv && __riscv_xlen == 64'),
('sh4', '__sh__'),
))
diff -r e4b11f027efc -r 5de7d747a962 python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py Sun May 31 17:11:57 2020 +0000
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py Thu Jun 18 07:11:09 2020 +0000
@@ -1208,6 +1208,10 @@
'mips-unknown-linux-gnu': big_endian + {
'__mips__': 1,
},
+ 'riscv64-unknown-linux-gnu': little_endian + {
+ '__riscv': 1,
+ '__riscv_xlen': 64,
+ },
'sh4-unknown-linux-gnu': little_endian + {
'__sh__': 1,
},
# HG changeset patch
# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
# Date 1592464269 0
# Thu Jun 18 07:11:09 2020 +0000
# Node ID e3d924797cb2d508ff938414168e98ccf66f07fe
# Parent 5de7d747a962df5f8aefc016a62d7270ac18879e
Bug 1318905 - js:jit: Enable AtomicOperations-feeling-lucky.h on riscv64 r=lth
This allows the build on riscv64 to use the atomic operations provided by GCC.
Differential Revision: https://phabricator.services.mozilla.com/D78624
diff -r 5de7d747a962 -r e3d924797cb2 js/src/jit/AtomicOperations.h
--- a/js/src/jit/AtomicOperations.h Thu Jun 18 07:11:09 2020 +0000
+++ b/js/src/jit/AtomicOperations.h Thu Jun 18 07:11:09 2020 +0000
@@ -391,7 +391,7 @@
#elif defined(__ppc__) || defined(__PPC__) || defined(__sparc__) || \
defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \
defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) || \
- defined(__sh__) || defined(__s390__) || defined(__s390x__)
+ defined(__sh__) || defined(__s390__) || defined(__s390x__) || defined(__riscv)
# include "jit/shared/AtomicOperations-feeling-lucky.h"
#else
# error "No AtomicOperations support provided for this platform"
diff -r 5de7d747a962 -r e3d924797cb2 js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
--- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h Thu Jun 18 07:11:09 2020 +0000
+++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h Thu Jun 18 07:11:09 2020 +0000
@@ -63,6 +63,11 @@
# define HAS_64BIT_LOCKFREE
#endif
+#if defined(__riscv) && __riscv_xlen == 64
+# define HAS_64BIT_ATOMICS
+# define HAS_64BIT_LOCKFREE
+#endif
+
#ifdef __sparc__
# ifdef __LP64__
# define HAS_64BIT_ATOMICS
# HG changeset patch
# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
# Date 1592464269 0
# Thu Jun 18 07:11:09 2020 +0000
# Node ID 3f652d12b8bc0bd213020d488ecb4d3710bb11fa
# Parent e3d924797cb2d508ff938414168e98ccf66f07fe
Bug 1318905 - mfbt:tests: Define RETURN_INSTR for riscv64 in TestPoisonArea r=glandium
Define RETURN_INSTR for riscv64 in TestPoisonArea, i.e. the riscv64 assembly
opcodes for "ret ; ret".
Differential Revision: https://phabricator.services.mozilla.com/D78625
diff -r e3d924797cb2 -r 3f652d12b8bc mfbt/tests/TestPoisonArea.cpp
--- a/mfbt/tests/TestPoisonArea.cpp Thu Jun 18 07:11:09 2020 +0000
+++ b/mfbt/tests/TestPoisonArea.cpp Thu Jun 18 07:11:09 2020 +0000
@@ -132,6 +132,9 @@
#elif defined _ARCH_PPC || defined _ARCH_PWR || defined _ARCH_PWR2
# define RETURN_INSTR 0x4E800020 /* blr */
+#elif defined __riscv
+# define RETURN_INSTR 0x80828082 /* ret; ret */
+
#elif defined __sparc || defined __sparcv9
# define RETURN_INSTR 0x81c3e008 /* retl */