-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(toolchain): add recipe to build riscv64 toolchain
Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com>
- Loading branch information
1 parent
4d83e97
commit 1c2fe06
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (c) Bao Project and Contributors. All rights reserved. | ||
|
||
{ lib | ||
, stdenv | ||
, fetchurl | ||
, ncurses5 | ||
, python38 | ||
, zlib | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "riscv64-unknown-elf"; | ||
version = "1.0.0"; | ||
arch = "x86_64"; | ||
|
||
src = fetchurl { | ||
url = "https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-${arch}-linux-ubuntu14.tar.gz"; | ||
sha256 = "sha256-vYVyQrfGSxqYxWs1vIAYZKxCBdA/ODxwEKkMXQu5VJo="; | ||
}; | ||
|
||
nativeBuildInputs = [ zlib ]; #build time dependencies | ||
|
||
|
||
dontConfigure = true; | ||
dontBuild = true; | ||
dontPatchELF = true; | ||
dontStrip = true; | ||
|
||
installPhase = '' | ||
mkdir -p $out | ||
cp -r * $out | ||
''; | ||
|
||
# Package -> put the binaries with nix store paths | ||
preFixup = '' | ||
find $out -type f | while read f; do | ||
patchelf "$f" > /dev/null 2>&1 || continue | ||
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true | ||
patchelf --set-rpath ${lib.makeLibraryPath [ "$out" stdenv.cc.cc ncurses5 python38 zlib]} "$f" || true | ||
done | ||
''; | ||
|
||
} | ||
|
||
|