Merge pull request #291897 from funkeleinhorn/add-flashprog

Refactor flashprog
This commit is contained in:
Martin Weinelt 2024-03-27 14:58:39 +01:00 committed by GitHub
commit 7c636c48b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 9 deletions

View File

@ -6801,6 +6801,15 @@
githubId = 21362942;
name = "Fugi";
};
funkeleinhorn = {
email = "git@funkeleinhorn.com";
github = "funkeleinhorn";
githubId = 103313934;
name = "Funkeleinhorn";
keys = [{
fingerprint = "689D 1C81 DA0D 1EB2 F029 D24E C7BE A25A 0A33 5A72";
}];
};
fusion809 = {
email = "brentonhorne77@gmail.com";
github = "fusion809";

View File

@ -2,15 +2,17 @@
, installShellFiles
, lib
, libftdi1
, libgpiod_1
, libgpiod
, libjaylink
, libusb1
, pciutils
, pkg-config
, stdenv
, withJlink ? true
, withGpio ? stdenv.isLinux
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation {
pname = "flashprog";
version = "1.0.1";
@ -24,24 +26,36 @@ stdenv.mkDerivation rec {
installShellFiles
pkg-config
];
buildInputs = [
libftdi1
libjaylink
libusb1
] ++ lib.optionals (!stdenv.isDarwin) [
libgpiod_1
pciutils
] ++ lib.optionals (withJlink) [
libjaylink
] ++ lib.optionals (withGpio) [
libgpiod
];
makeFlags = [ "PREFIX=$(out)" "libinstall" ]
++ lib.optionals stdenv.isDarwin [ "CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no" ]
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ "CONFIG_INTERNAL_X86=no" "CONFIG_INTERNAL_DMI=no" "CONFIG_RAYER_SPI=0" ];
makeFlags =
let
yesNo = flag: if flag then "yes" else "no";
in
[
"libinstall"
"PREFIX=$(out)"
"CONFIG_JLINK_SPI=${yesNo withJlink}"
"CONFIG_LINUX_GPIO_SPI=${yesNo withGpio}"
"CONFIG_ENABLE_LIBPCI_PROGRAMMERS=${yesNo (!stdenv.isDarwin)}"
"CONFIG_INTERNAL_X86=${yesNo (!(stdenv.isDarwin) && stdenv.isx86_64)}"
"CONFIG_INTERNAL_DMI=${yesNo (!(stdenv.isDarwin) && stdenv.isx86_64)}"
"CONFIG_RAYER_SPI=${yesNo (!(stdenv.isDarwin) && stdenv.isx86_64)}"
];
meta = with lib; {
homepage = "https://flashprog.org";
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
license = with licenses; [ gpl2 gpl2Plus ];
license = with licenses; [ gpl2Plus ];
maintainers = with maintainers; [ felixsinger ];
platforms = platforms.all;
mainProgram = "flashprog";