2013-07-31 16:00:57 +02:00
|
|
|
{stdenv, stdenv_32bit, fetchurl, unzip}:
|
2012-11-07 21:10:39 +01:00
|
|
|
|
2015-10-06 14:27:49 +02:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = "23.0.1";
|
2014-12-16 08:22:55 +01:00
|
|
|
name = "android-platform-tools-r${version}";
|
2012-11-07 21:10:39 +01:00
|
|
|
src = if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux")
|
|
|
|
then fetchurl {
|
2015-10-06 14:27:49 +02:00
|
|
|
url = "https://dl.google.com/android/repository/platform-tools_r${version}-linux.zip";
|
|
|
|
sha1 = "94dcc5072b3d0d74cc69e4101958b6c2e227e738";
|
2012-11-07 21:10:39 +01:00
|
|
|
}
|
|
|
|
else if stdenv.system == "x86_64-darwin" then fetchurl {
|
2015-10-06 14:27:49 +02:00
|
|
|
url = "https://dl.google.com/android/repository/platform-tools_r${version}-macosx.zip";
|
|
|
|
sha1 = "c461d66f3ca9fbae8ea0fa1a49c203b3b6fd653f";
|
2012-11-07 21:10:39 +01:00
|
|
|
}
|
|
|
|
else throw "System ${stdenv.system} not supported!";
|
2014-12-16 08:22:55 +01:00
|
|
|
|
2012-11-07 21:10:39 +01:00
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cd $out
|
|
|
|
unzip $src
|
|
|
|
cd platform-tools
|
|
|
|
|
|
|
|
${stdenv.lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux")
|
|
|
|
''
|
2013-07-31 16:00:57 +02:00
|
|
|
for i in adb fastboot
|
2012-11-07 21:10:39 +01:00
|
|
|
do
|
2014-12-26 18:33:16 +01:00
|
|
|
patchelf --set-interpreter ${stdenv_32bit.cc.libc}/lib/ld-linux.so.2 $i
|
2015-01-15 05:51:58 +01:00
|
|
|
patchelf --set-rpath ${stdenv_32bit.cc.cc}/lib $i
|
2012-11-07 21:10:39 +01:00
|
|
|
done
|
|
|
|
''}
|
2015-04-22 16:29:18 +02:00
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
for i in adb fastboot
|
|
|
|
do
|
|
|
|
ln -sf $out/platform-tools/$i $out/bin/$i
|
|
|
|
done
|
2012-11-07 21:10:39 +01:00
|
|
|
'';
|
|
|
|
|
2012-11-08 16:49:36 +01:00
|
|
|
buildInputs = [ unzip ];
|
2012-11-07 21:10:39 +01:00
|
|
|
}
|