1 { lib, stdenv, fetchFromGitiles, pkg-config, libuuid, openssl, libyaml, xz }:
3 stdenv.mkDerivation rec {
6 pname = "vboot_reference";
8 src = fetchFromGitiles {
9 url = "https://chromium.googlesource.com/chromiumos/platform/vboot_reference";
10 rev = "1a1cb5c9a38030a5868e2aaad295c68432c680fd"; # refs/heads/release-R111-15329.B
11 sha256 = "sha256-56/hqqFiKHw0/ah0D20U1ueIU2iq8I4Wn5DiEWxB9qA=";
14 nativeBuildInputs = [ pkg-config ];
15 buildInputs = [ libuuid libyaml openssl xz ];
17 enableParallelBuilding = true;
19 env.NIX_CFLAGS_COMPILE = toString [
20 # This apparently doesn't work as expected:
21 # - https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/refs/heads/release-R111-15329.B/Makefile#439
22 # Let's apply the same flag manually.
23 "-Wno-error=deprecated-declarations"
27 substituteInPlace Makefile \
28 --replace "ar qc" '${stdenv.cc.bintools.targetPrefix}ar qc'
29 # Drop flag unrecognized by GCC 9 (for e.g. aarch64-linux)
30 substituteInPlace Makefile \
31 --replace "-Wno-unknown-warning" ""
40 "HOST_ARCH=${stdenv.hostPlatform.parsed.cpu.name}"
42 # Upstream has weird opinions about DESTDIR
43 # https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/refs/heads/release-R111-15329.B/Makefile#51
44 "UB_DIR=${placeholder "out"}/bin"
45 "UL_DIR=${placeholder "out"}/lib"
46 "UI_DIR=${placeholder "out"}/include/vboot"
47 "US_DIR=${placeholder "out"}/share/vboot"
51 mkdir -p $out/share/vboot
52 cp -r tests/devkeys* $out/share/vboot/
56 description = "Chrome OS partitioning and kernel signing tools";
57 license = licenses.bsd3;
58 platforms = platforms.linux;