Skip to content

Commit

Permalink
avrdude: use elfutils or vendored libelf instead of abandoned ups…
Browse files Browse the repository at this point in the history
…tream
  • Loading branch information
philiptaron committed Apr 11, 2024
1 parent ddcd5f2 commit 0277ef0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkgs/development/embedded/avrdude/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{ lib, stdenv, fetchFromGitHub, cmake, bison, flex, libusb-compat-0_1, libelf
{ lib, callPackage, stdenv, fetchFromGitHub, cmake, bison, flex, libusb-compat-0_1, elfutils
, libftdi1, readline
# documentation building is broken on darwin
, docSupport ? (!stdenv.isDarwin), texliveMedium, texinfo, texi2html, unixtools }:

let
libelf = callPackage ./libelf.nix { };
in

stdenv.mkDerivation rec {
pname = "avrdude";
version = "7.3";
Expand All @@ -19,9 +23,10 @@ stdenv.mkDerivation rec {
texliveMedium
texinfo
texi2html
];
] ++ lib.optionals (!lib.meta.availableOn stdenv.hostPlatform elfutils) [ libelf ];

buildInputs = [ libusb-compat-0_1 libelf libftdi1 readline ];
buildInputs = [ libusb-compat-0_1 libftdi1 readline ]
++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [ elfutils ];

cmakeFlags = lib.optionals docSupport [
"-DBUILD_DOC=ON"
Expand Down
37 changes: 37 additions & 0 deletions pkgs/development/embedded/avrdude/libelf.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
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 ];

cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ];

installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp liblibelf.a $out/lib
cp -r $src/include $out/include
runHook postInstall
'';

meta = {
description = "ELF object file access library";
homepage = "https://github.com/avrdudes/libelf";
license = lib.licenses.lgpl2Plus;
platforms = lib.platforms.all;
};
}

0 comments on commit 0277ef0

Please sign in to comment.