android-tools: install missing tools

This commit is contained in:
Mustafa Çalışkan 2021-08-30 14:53:07 +03:00
parent 39067594f5
commit ea4b2dbcbc
No known key found for this signature in database
GPG Key ID: 6DB53FDC8060E238

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 = ''