2025-09-01 18:37:12 +02:00
|
|
|
{ pkgs }:
|
|
|
|
|
let
|
|
|
|
|
stdenv = pkgs.stdenv;
|
|
|
|
|
|
2025-09-01 19:57:53 +02:00
|
|
|
name = "binutils";
|
|
|
|
|
version = "2.45";
|
|
|
|
|
|
2025-09-01 18:37:12 +02:00
|
|
|
nativePackages = with pkgs; [
|
|
|
|
|
cmake
|
|
|
|
|
zlib
|
|
|
|
|
gnum4
|
|
|
|
|
bison
|
|
|
|
|
];
|
|
|
|
|
|
2025-09-01 19:57:53 +02:00
|
|
|
src = pkgs.fetchurl {
|
|
|
|
|
url = "https://ftp.fau.de/gnu/${name}/${name}-${version}.tar.xz";
|
|
|
|
|
hash = "sha256-xQwOf5yxiJgOLMl+RTdiaxZyRBgVWH8eq2nSob++9dI=";
|
|
|
|
|
};
|
|
|
|
|
|
2025-09-01 18:37:12 +02:00
|
|
|
binutilsPkg = stdenv.mkDerivation {
|
2025-09-01 19:57:53 +02:00
|
|
|
inherit name version src;
|
|
|
|
|
|
2025-09-01 18:37:12 +02:00
|
|
|
|
2025-09-01 19:57:53 +02:00
|
|
|
/*
|
|
|
|
|
Nixpkgs derivations automatically enable a few hardening flags, including some that cause non-literal format strings to become errors. https://nixos.org/manual/nixpkgs/stable/#sec-hardening-in-nixpkgs
|
|
|
|
|
|
|
|
|
|
You can disable this particular one with
|
|
|
|
|
*/
|
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
But really the package author should be notified of the issue, and a patch should be applied. Even if it's clear that it's safe (it's probably not), NixOS is far from the only organization that enables hardening flags like this by default.
|
|
|
|
|
*/
|
2025-09-01 18:37:12 +02:00
|
|
|
|
|
|
|
|
nativeBuildInputs = [ nativePackages ];
|
|
|
|
|
buildInputs = [ ];
|
|
|
|
|
|
|
|
|
|
prePhases = "prepEnvironmentPhase";
|
|
|
|
|
prepEnvironmentPhase = ''
|
|
|
|
|
export LFS=$(pwd)
|
|
|
|
|
export LFSTOOLS=$(pwd)/tools
|
|
|
|
|
export LFS_TGT=$(uname -m)-lfs-linux-gnu
|
|
|
|
|
mkdir -v $LFSTOOLS
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
|
echo "Configuring... "
|
|
|
|
|
echo "Starting config"
|
|
|
|
|
time ( ./configure --prefix=$LFSTOOLS \
|
|
|
|
|
--with-sysroot=$LFS \
|
|
|
|
|
--target=$LFS_TGT \
|
|
|
|
|
--disable-nls \
|
|
|
|
|
--enable-gprofng=no \
|
|
|
|
|
--disable-werror \
|
|
|
|
|
--enable-new-dtags \
|
|
|
|
|
--enable-default-hash-style=gnu
|
|
|
|
|
)
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
|
rm -r $LFS/$sourceRoot
|
|
|
|
|
cp -rvp $LFS/* $out/
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
|
echo -e "\033[31mNix Develop -> $name: Loading...\033[0m"
|
|
|
|
|
|
|
|
|
|
if [[ "$(basename $(pwd))" != "$name" ]]; then
|
|
|
|
|
mkdir -p "$name"
|
|
|
|
|
cd "$name"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
eval "$prepEnvironmentPhase"
|
|
|
|
|
echo -e "\033[36mNix Develop -> $name: Loaded.\033[0m"
|
|
|
|
|
echo -e "\033[36mNix Develop -> Current directory: $(pwd)\033[0m"
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
binutilsPkg
|
2025-09-01 19:57:53 +02:00
|
|
|
|