1{ lib, stdenv, fetchFromGitiles, pkg-config, libuuid, openssl, libyaml, xz }:
2
3stdenv.mkDerivation rec {
4 version = "20180311";
5 checkout = "4c84e077858c809ee80a9a6f9b38185cf7dcded7";
6
7 pname = "vboot_reference";
8
9 src = fetchFromGitiles {
10 url = "https://chromium.googlesource.com/chromiumos/platform/vboot_reference";
11 rev = checkout;
12 sha256 = "1zja4ma6flch08h5j2l1hqnxmw2xwylidnddxxd5y2x05dai9ddj";
13 };
14
15 nativeBuildInputs = [ pkg-config ];
16 buildInputs = [ openssl libuuid libyaml xz ];
17
18 enableParallelBuilding = true;
19
20 patches = [ ./dont_static_link.patch ];
21
22 # fix build with gcc9
23 NIX_CFLAGS_COMPILE = [ "-Wno-error" ];
24
25 postPatch = ''
26 substituteInPlace Makefile \
27 --replace "ar qc" '${stdenv.cc.bintools.targetPrefix}ar qc'
28 '';
29
30 preBuild = ''
31 patchShebangs scripts
32 '';
33
34 makeFlags = [
35 "DESTDIR=$(out)"
36 "HOST_ARCH=${stdenv.hostPlatform.parsed.cpu.name}"
37 ];
38
39 postInstall = ''
40 mkdir -p $out/share/vboot
41 cp -r tests/devkeys* $out/share/vboot/
42 '';
43
44 meta = with lib; {
45 description = "Chrome OS partitioning and kernel signing tools";
46 license = licenses.bsd3;
47 platforms = platforms.linux;
48 maintainers = with maintainers; [ lheckemann ];
49 };
50}