Merge pull request #136174 from musfay/android-tools-avb

android-tools: install missing tools
This commit is contained in:
Michael Weiss 2021-09-01 00:28:02 +02:00 committed by GitHub
commit dc47a7bef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,8 +1,12 @@
{ lib, stdenv, fetchurl, fetchpatch
, cmake, perl, go
, cmake, perl, go, python3
, protobuf, zlib, gtest, brotli, lz4, zstd, libusb1, pcre2, fmt_7
}:
let
pythonEnv = python3.withPackages(ps: [ ps.protobuf ]);
in
stdenv.mkDerivation rec {
pname = "android-tools";
version = "31.0.2";
@ -23,8 +27,13 @@ stdenv.mkDerivation rec {
})
];
postPatch = ''
sed -i -E "0,/import api_pb2/ s//from google.protobuf import api_pb2/" vendor/avb/aftltool.py
'';
nativeBuildInputs = [ cmake perl go ];
buildInputs = [ protobuf zlib gtest brotli lz4 zstd libusb1 pcre2 fmt_7 ];
propagatedBuildInputs = [ pythonEnv ];
# Don't try to fetch any Go modules via the network:
GOFLAGS = [ "-mod=vendor" ];
@ -33,6 +42,12 @@ stdenv.mkDerivation rec {
export GOCACHE=$TMPDIR/go-cache
'';
postInstall = ''
install -Dm755 ../vendor/avb/aftltool.py -t $out/bin
install -Dm755 ../vendor/avb/avbtool.py -t $out/bin
install -Dm755 ../vendor/mkbootimg/mkbootimg.py $out/bin/mkbootimg
'';
meta = with lib; {
description = "Android SDK platform tools";
longDescription = ''