avrdude: use either vendored libelf or elfutils instead of abandoned upstream
This commit is contained in:
parent
98e8fbee79
commit
55ddcaf70d
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, fetchFromGitHub, cmake, bison, flex, libusb1, libelf
|
||||
{ lib, callPackage, stdenv, fetchFromGitHub, cmake, bison, flex, libusb1, elfutils
|
||||
, libftdi1, readline, hidapi, libserialport
|
||||
# Documentation building doesn't work on Darwin. It fails with:
|
||||
# Undefined subroutine &Locale::Messages::dgettext called in ... texi2html
|
||||
|
@ -6,6 +6,10 @@
|
|||
# https://github.com/NixOS/nixpkgs/issues/224761
|
||||
, docSupport ? (!stdenv.hostPlatform.isDarwin), texliveMedium, texinfo, texi2html, unixtools }:
|
||||
|
||||
let
|
||||
useElfutils = lib.meta.availableOn stdenv.hostPlatform elfutils;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "avrdude";
|
||||
version = "7.3";
|
||||
|
@ -24,7 +28,19 @@ stdenv.mkDerivation rec {
|
|||
texi2html
|
||||
];
|
||||
|
||||
buildInputs = [ hidapi libusb1 libelf libftdi1 libserialport readline ];
|
||||
buildInputs = [
|
||||
(if useElfutils then elfutils else finalAttrs.finalPackage.passthru.libelf)
|
||||
hidapi
|
||||
libusb1
|
||||
libftdi1
|
||||
libserialport
|
||||
readline
|
||||
];
|
||||
|
||||
postPatch = lib.optionalString (!useElfutils) ''
|
||||
# vendored libelf is a static library
|
||||
sed -i "s/PREFERRED_LIBELF elf/PREFERRED_LIBELF libelf.a elf/" CMakeLists.txt
|
||||
'';
|
||||
|
||||
# Not used:
|
||||
#
|
||||
|
@ -39,6 +55,12 @@ stdenv.mkDerivation rec {
|
|||
rm $out/share/doc/${pname}/*.ps
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
# Vendored and mutated copy of libelf for avrdudes use.
|
||||
# Produces a static library only.
|
||||
libelf = callPackage ./libelf.nix { };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Command-line tool for programming Atmel AVR microcontrollers";
|
||||
mainProgram = "avrdude";
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
cmake,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "libelf";
|
||||
version = "0.8.13-unstable-2023-01-14";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "avrdudes";
|
||||
repo = "libelf";
|
||||
rev = "0c55bfe1d3020a20bddf6ce57c0d9d98ccb12586";
|
||||
hash = "sha256-jz7Ef0Eg673IJVZvVNklY40s13LCuMVAc7FGrRI7scQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/lib
|
||||
cp liblibelf.a $out/lib/libelf.a
|
||||
cp -r $src/include $out/include
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "ELF object file access library (vendored by avrdudes)";
|
||||
homepage = "https://github.com/avrdudes/libelf";
|
||||
license = lib.licenses.lgpl2Plus;
|
||||
platforms = lib.platforms.all;
|
||||
maintainers = [ lib.maintainers.bjornfor ];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue