flashprog: refactor make jlink and gpio support configurable
This commit is contained in:
parent
5ba311a026
commit
306fe56f63
|
@ -2,15 +2,17 @@
|
||||||
, installShellFiles
|
, installShellFiles
|
||||||
, lib
|
, lib
|
||||||
, libftdi1
|
, libftdi1
|
||||||
, libgpiod_1
|
, libgpiod
|
||||||
, libjaylink
|
, libjaylink
|
||||||
, libusb1
|
, libusb1
|
||||||
, pciutils
|
, pciutils
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, stdenv
|
, stdenv
|
||||||
|
, withJlink ? true
|
||||||
|
, withGpio ? stdenv.isLinux
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation {
|
||||||
pname = "flashprog";
|
pname = "flashprog";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
|
|
||||||
|
@ -24,24 +26,36 @@ stdenv.mkDerivation rec {
|
||||||
installShellFiles
|
installShellFiles
|
||||||
pkg-config
|
pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
libftdi1
|
libftdi1
|
||||||
libjaylink
|
|
||||||
libusb1
|
libusb1
|
||||||
] ++ lib.optionals (!stdenv.isDarwin) [
|
] ++ lib.optionals (!stdenv.isDarwin) [
|
||||||
libgpiod_1
|
|
||||||
pciutils
|
pciutils
|
||||||
|
] ++ lib.optionals (withJlink) [
|
||||||
|
libjaylink
|
||||||
|
] ++ lib.optionals (withGpio) [
|
||||||
|
libgpiod
|
||||||
];
|
];
|
||||||
|
|
||||||
makeFlags = [ "PREFIX=$(out)" "libinstall" ]
|
makeFlags =
|
||||||
++ lib.optionals stdenv.isDarwin [ "CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no" ]
|
let
|
||||||
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ "CONFIG_INTERNAL_X86=no" "CONFIG_INTERNAL_DMI=no" "CONFIG_RAYER_SPI=0" ];
|
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; {
|
meta = with lib; {
|
||||||
homepage = "https://flashprog.org";
|
homepage = "https://flashprog.org";
|
||||||
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
|
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
|
||||||
license = with licenses; [ gpl2 gpl2Plus ];
|
license = with licenses; [ gpl2Plus ];
|
||||||
maintainers = with maintainers; [ felixsinger ];
|
maintainers = with maintainers; [ felixsinger ];
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
mainProgram = "flashprog";
|
mainProgram = "flashprog";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user