2016-06-19 02:26:34 +00:00
|
|
|
{stdenv, zlib, fetchurl, unzip}:
|
2012-11-07 20:10:39 +00:00
|
|
|
|
2015-10-06 12:27:49 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2016-12-10 10:51:55 +00:00
|
|
|
version = "25.0.1";
|
2014-12-16 07:22:55 +00:00
|
|
|
name = "android-platform-tools-r${version}";
|
2012-11-07 20:10:39 +00:00
|
|
|
src = if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux")
|
|
|
|
then fetchurl {
|
2015-10-06 12:27:49 +00:00
|
|
|
url = "https://dl.google.com/android/repository/platform-tools_r${version}-linux.zip";
|
2016-12-10 10:51:55 +00:00
|
|
|
sha256 = "0r8ix3jjqpk6wyxm8f6az9r4z5a1lnb3b9hzh8ay4ayidwhn8isx";
|
2012-11-07 20:10:39 +00:00
|
|
|
}
|
|
|
|
else if stdenv.system == "x86_64-darwin" then fetchurl {
|
2015-10-06 12:27:49 +00:00
|
|
|
url = "https://dl.google.com/android/repository/platform-tools_r${version}-macosx.zip";
|
2016-12-10 10:51:55 +00:00
|
|
|
sha256 = "18pzwpr6fbxlw782j65clwz9kvdgvb04jpr2z12bbwyd8wqc4yln";
|
2012-11-07 20:10:39 +00:00
|
|
|
}
|
|
|
|
else throw "System ${stdenv.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
|
|
|
|
|
|
|
|
${stdenv.lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux")
|
|
|
|
''
|
2015-10-15 14:42:24 +00:00
|
|
|
for i in adb dmtracedump fastboot hprof-conv sqlite3
|
2012-11-07 20:10:39 +00:00
|
|
|
do
|
2016-06-19 02:26:34 +00: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 14:42:24 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
for i in etc1tool
|
|
|
|
do
|
2016-06-19 02:26:34 +00: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 14:29:18 +00: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
|
|
|
'';
|
|
|
|
|
2012-11-08 15:49:36 +00:00
|
|
|
buildInputs = [ unzip ];
|
2012-11-07 20:10:39 +00:00
|
|
|
}
|