Hi Folks,
I’m trying to build a patched version of AVR GCC with a patched version of AVR-LIBC. This is the best derivation I’ve been able to come up with so far.
It build avr-libc with the correct patches, and it builds avr-gcc with the correct patches - it just doesn’t feed the patched avr-libc into the gcc build. Can anyone give me some pointers as to how to feed the patched libc into the gcc build?
Also any other feedback would be welcome.
{ pkgs ? import <nixpkgs> { } }:
let
base = pkgs.pkgsCross.avr.buildPackages.gcc12;
libc = base.bintools.libc.overrideAttrs (final: previous: {
src = pkgs.fetchFromGitHub {
owner = "avrdudes";
repo = "avr-libc";
rev = "55e8cac69935657bcd3e4d938750960c757844c3";
sha256 = "hw93vMdUSS1MXOBvuZptbUexqUuCmMw8TIQcr1HL7wM=";
};
nativeBuildInputs = [
pkgs.autoreconfHook
pkgs.python
];
autoreconfPhase = "./bootstrap";
});
cc = base.cc.overrideAttrs (final: previous: {
patches = [
(pkgs.fetchpatch {
url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=919822adc923b00e995e8a148bdb8115a794b47b";
sha256 = "/hwABnFuxOROIY6YBkmFlR0htZJxuwPIiU6CBKz/PmU=";
})
];
});
avrgcc-mod = pkgs.wrapCCWith {
inherit cc;
bintools = pkgs.wrapBintoolsWith {
bintools = base.bintools;
inherit libc;
};
};
in
pkgs.stdenv.mkDerivation {
name = "env";
buildInputs = [
pkgs.bashInteractive
avrgcc-mod
];
CFLAGS = [
"-isystem ${avrgcc-mod.libc}/avr/include"
"-L${avrgcc-mod.libc}/avr/lib/avr5"
];
}
Thanks!