2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, meson
|
|
|
|
, ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, libftdi1
|
|
|
|
, libusb1
|
|
|
|
, pciutils
|
2021-06-28 23:13:55 +00:00
|
|
|
, installShellFiles
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "flashrom";
|
|
|
|
version = "1.2";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://download.flashrom.org/releases/flashrom-v${version}.tar.bz2";
|
|
|
|
sha256 = "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71";
|
|
|
|
};
|
|
|
|
|
2021-07-03 03:11:41 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace util/z60_flashrom.rules \
|
|
|
|
--replace "plugdev" "flashrom"
|
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
# Meson build doesn't build and install manpage. Only Makefile can.
|
|
|
|
# Build manpage from source directory. Here we're inside the ./build subdirectory
|
|
|
|
postInstall = ''
|
|
|
|
make flashrom.8 -C ..
|
|
|
|
installManPage ../flashrom.8
|
2021-07-03 03:11:41 +00:00
|
|
|
install -Dm644 ../util/z60_flashrom.rules $out/etc/udev/rules.d/flashrom.rules
|
2021-06-28 23:13:55 +00:00
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
mesonFlags = lib.optionals stdenv.isAarch64 [ "-Dpciutils=false" ];
|
2021-06-28 23:13:55 +00:00
|
|
|
nativeBuildInputs = [ meson pkg-config ninja installShellFiles ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ libftdi1 libusb1 pciutils ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "http://www.flashrom.org";
|
|
|
|
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
|
|
|
|
license = licenses.gpl2;
|
2021-07-03 03:11:41 +00:00
|
|
|
maintainers = with maintainers; [ funfunctor fpletz felixsinger ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
2020-11-30 08:33:03 +00:00
|
|
|
broken = stdenv.isDarwin; # requires DirectHW
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|