nixpkgs-suyu/pkgs/development/mobile/androidenv/build-tools.nix
Cray Elliott 80838029ac Bump Android packages to newest versions, add androidsdk_5_0_1 to env
Detailed changes:
- android-sdk: update 23.0.2 -> 24.0.1
- android-platforms: add 5.0.1
- android-platform-tools: update 19 -> 21
- android-build-tools: update 20 -> 21.1.2
- android-support: update 18 -> 21
- android-support-repository: update 5 -> 9

This commit was authored by ewemoa, reviewed by me
2014-12-15 23:29:02 -08:00

61 lines
2 KiB
Nix

{stdenv, stdenv_32bit, fetchurl, unzip, zlib_32bit}:
stdenv.mkDerivation {
name = "android-build-tools-r21.1.2";
src = if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux")
then fetchurl {
url = https://dl-ssl.google.com/android/repository/build-tools_r21.1.2-linux.zip;
sha1 = "5e35259843bf2926113a38368b08458735479658";
}
else if stdenv.system == "x86_64-darwin" then fetchurl {
url = https://dl-ssl.google.com/android/repository/build-tools_r21.1.2-macosx.zip;
sha1 = "e7c906b4ba0eea93b32ba36c610dbd6b204bff48";
}
else throw "System ${stdenv.system} not supported!";
buildCommand = ''
mkdir -p $out/build-tools
cd $out/build-tools
unzip $src
${stdenv.lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux")
''
cd android-*
# Patch the interpreter
for i in aapt aidl dexdump llvm-rs-cc
do
patchelf --set-interpreter ${stdenv_32bit.gcc.libc}/lib/ld-linux.so.2 $i
done
# These binaries need to find libstdc++ and libgcc_s
for i in aidl libLLVM.so
do
patchelf --set-rpath ${stdenv_32bit.gcc.gcc}/lib $i
done
# These binaries need to find libstdc++, libgcc_s and libraries in the current folder
for i in libbcc.so libbcinfo.so libclang.so llvm-rs-cc
do
patchelf --set-rpath ${stdenv_32bit.gcc.gcc}/lib:`pwd` $i
done
# These binaries also need zlib in addition to libstdc++
for i in zipalign
do
patchelf --set-interpreter ${stdenv_32bit.gcc.libc}/lib/ld-linux.so.2 $i
patchelf --set-rpath ${stdenv_32bit.gcc.gcc}/lib:${zlib_32bit}/lib $i
done
# These binaries need to find libstdc++, libgcc_s, and zlib
for i in aapt dexdump
do
patchelf --set-rpath ${stdenv_32bit.gcc.gcc}/lib:${zlib_32bit}/lib $i
done
''}
patchShebangs .
'';
buildInputs = [ unzip ];
}