2018-02-20 23:31:16 +00:00
|
|
|
{ buildPackages, pkgs }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (buildPackages) fetchurl unzip;
|
|
|
|
inherit (pkgs) stdenv zlib;
|
|
|
|
in
|
2012-11-07 20:10:39 +00:00
|
|
|
|
2015-10-06 13:27:49 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2018-09-15 22:28:41 +01:00
|
|
|
version = "28.0.1";
|
2014-12-16 07:22:55 +00:00
|
|
|
name = "android-platform-tools-r${version}";
|
2018-08-20 20:11:29 +01:00
|
|
|
src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
|
2012-11-07 20:10:39 +00:00
|
|
|
then fetchurl {
|
2015-10-06 13:27:49 +01:00
|
|
|
url = "https://dl.google.com/android/repository/platform-tools_r${version}-linux.zip";
|
2018-09-15 22:28:41 +01:00
|
|
|
sha256 = "14kkr9xib5drjjd0bclm0jn3f5xlmlg652mbv4xd83cv7a53a49y";
|
2012-11-07 20:10:39 +00:00
|
|
|
}
|
2018-08-20 20:11:29 +01:00
|
|
|
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
|
2017-08-05 14:22:18 +01:00
|
|
|
url = "https://dl.google.com/android/repository/platform-tools_r${version}-darwin.zip";
|
2018-09-15 22:28:41 +01:00
|
|
|
sha256 = "117syrddq1haicwyjzd1p4pfphj0wldjs7w10fpk3n2b7yp37j1v";
|
2012-11-07 20:10:39 +00:00
|
|
|
}
|
2018-08-20 20:11:29 +01:00
|
|
|
else throw "System ${stdenv.hostPlatform.system} not supported!";
|
2014-12-16 07:22:55 +00:00
|
|
|
|
2012-11-07 20:10:39 +00:00
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cd $out
|
|
|
|
unzip $src
|
|
|
|
cd platform-tools
|
2017-12-03 21:56:11 +00:00
|
|
|
|
2018-08-20 20:11:29 +01:00
|
|
|
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
|
2012-11-07 20:10:39 +00:00
|
|
|
''
|
2018-09-15 23:12:36 +01:00
|
|
|
for i in adb dmtracedump e2fsdroid fastboot hprof-conv make_f2fs mke2fs sload_f2fs sqlite3
|
2012-11-07 20:10:39 +00:00
|
|
|
do
|
2016-06-19 03:26:34 +01:00
|
|
|
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
|
|
|
|
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib:`pwd`/lib64 $i
|
2015-10-15 15:42:24 +01:00
|
|
|
done
|
2017-12-03 21:56:11 +00:00
|
|
|
|
2015-10-15 15:42:24 +01:00
|
|
|
for i in etc1tool
|
|
|
|
do
|
2016-06-19 03:26:34 +01:00
|
|
|
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
|
|
|
|
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib:${zlib.out}/lib:`pwd`/lib64 $i
|
2012-11-07 20:10:39 +00:00
|
|
|
done
|
|
|
|
''}
|
2015-04-22 15:29:18 +01:00
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
for i in adb fastboot
|
|
|
|
do
|
|
|
|
ln -sf $out/platform-tools/$i $out/bin/$i
|
|
|
|
done
|
2012-11-07 20:10:39 +00:00
|
|
|
'';
|
2017-12-03 21:56:11 +00:00
|
|
|
|
2018-02-20 23:31:16 +00:00
|
|
|
nativeBuildInputs = [ unzip ];
|
2012-11-07 20:10:39 +00:00
|
|
|
}
|