-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
riscv-gnu-toolchain-*: init at 2023.01.04 #214185
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ stdenv | ||
, lib | ||
, fetchFromGitHub | ||
, fetchurl | ||
|
||
, gcc12 | ||
, glibc | ||
, newlib | ||
, gdb | ||
, qemu | ||
, musl | ||
, spike | ||
, riscv-pk | ||
|
||
, autoconf | ||
, curl | ||
, automake | ||
, python3 | ||
, libmpc | ||
, gawk | ||
, bison | ||
, flex | ||
, texinfo | ||
, gperf | ||
, libtool | ||
, expat | ||
, gmp | ||
, mpfr | ||
, flock | ||
, zlib | ||
|
||
, srcs ? { | ||
binutils = { | ||
url = "mirror://gnu/binutils/binutils-2.39.tar.bz2"; | ||
hash = "sha256-2iSoT+8iAQLdJAQt8G/eqFHCYUpTd/hu/6KPM7exYUg="; | ||
}; | ||
dejagnu = { | ||
url = "mirror://gnu/dejagnu/dejagnu-1.6.3.tar.gz"; | ||
hash = "sha256-h9rvrNeVi0pp+IxoVtvRY0JhljxBQHnQw3H1ic1mouM="; | ||
}; | ||
gcc = gcc12.cc.src; | ||
glibc = glibc.src; | ||
newlib = newlib.src; | ||
gdb = gdb.src; | ||
qemu = qemu.src; | ||
musl = musl.src; | ||
spike = spike.src; | ||
pk = riscv-pk.src; | ||
} | ||
|
||
, isa ? "rv64gc" | ||
, withLinux ? false | ||
}: | ||
let | ||
|
||
extract = file: stdenv.mkDerivation { | ||
name = file.name + "-unpacked"; | ||
src = file; | ||
dontPatch = true; | ||
dontConfigure = true; | ||
dontBuild = true; | ||
installPhase = "cp -r . $out"; | ||
dontFixup = true; | ||
}; | ||
|
||
srcs_fetched = lib.mapAttrs (name: value: if value ? outPath then value else fetchurl value) srcs; | ||
srcs_extracted = lib.mapAttrs (name: value: extract value) srcs_fetched; | ||
Comment on lines
+66
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For which src are we doing this? Maybe we can just change that one package to avoid this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. three of them use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we want to use fetchurl for github sources or am I mixing things up? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some use |
||
srcFlags = lib.mapAttrsToList (name: value: "--with-${name}-src=${value}") srcs_extracted; | ||
|
||
in stdenv.mkDerivation rec { | ||
pname = "riscv-gnu-toolchain-" + isa; | ||
version = "2023.01.04"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "riscv-collab"; | ||
repo = "riscv-gnu-toolchain"; | ||
rev = version; | ||
hash = "sha256-PXPQ/ho+fOudZRErnyQZTVFdceWGBF+geo+3y0tkNm4="; | ||
}; | ||
|
||
nativeBuildInputs = [ autoconf automake flock curl python3 gawk bison flex texinfo gperf ]; | ||
buildInputs = [ libmpc libtool expat gmp mpfr zlib ]; | ||
hardeningDisable = [ "format" ]; | ||
|
||
patches = [ ./no-dot-git.patch ]; | ||
configureFlags = [ | ||
"--with-arch=${isa}" | ||
] | ||
++ srcFlags | ||
++ lib.optional withLinux "--enable-linux"; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/riscv-collab/riscv-gnu-toolchain"; | ||
description = "RISC-V C and C++ cross-compiler"; | ||
maintainers = with maintainers; [ genericnerdyusername ]; | ||
license = with licenses; [ bsd3 gpl2 lgpl21 ]; | ||
broken = stdenv.isDarwin; | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/Makefile.in b/Makefile.in | ||
index 71369ab..53f5e0d 100644 | ||
--- a/Makefile.in | ||
+++ b/Makefile.in | ||
@@ -279,9 +279,6 @@ GCCPKGVER := | ||
endif | ||
|
||
$(srcdir)/%/.git: | ||
- cd $(srcdir) && \ | ||
- flock `git rev-parse --git-dir`/config git submodule init $(dir $@) && \ | ||
- flock `git rev-parse --git-dir`/config git submodule update $(dir $@) | ||
|
||
# | ||
# GLIBC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this out of the inputs. It is not really extensible especially when you want to change one variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you not use
pkg.override (old: new: {srcs=old.srcs//{new-pkg=new-pkg-src}})
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit hacky. Normally src and srcs are exclusive and I would rather expect that overwriting gcc and its source would affect it. Generally it is not such a great idea to put big defaults behind
?
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better mechanism, or is the ability to change the sources uneeded?