androidsdk: 25.2.5 -> 26.1.1, license agreement

This commit is contained in:
Nick Novitski 2018-10-22 16:00:14 -07:00
parent a50d574986
commit 950608bae0
3 changed files with 33 additions and 33 deletions

View File

@ -4,10 +4,18 @@
, freetype, fontconfig, glib, gtk2, atk, file, jdk, coreutils, libpulseaudio, dbus
, zlib, glxinfo, xkeyboardconfig
, includeSources
, licenseAccepted
}:
{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false
, useGooglePlayServices ? false, useInstantApps ? false }:
if !licenseAccepted then throw ''
You must accept the Android Software Development Kit License Agreement at
https://developer.android.com/studio/terms
by setting nixpkgs config option 'android_sdk.accept_license = true;'
''
else assert licenseAccepted;
let inherit (stdenv.lib) makeLibraryPath;
googleRepository = let version = "gms_v9_rc41_wear_2_0_rc6";
@ -20,16 +28,16 @@ in
stdenv.mkDerivation rec {
name = "android-sdk-${version}";
version = "25.2.5";
version = "26.1.1";
src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
then fetchurl {
url = "https://dl.google.com/android/repository/tools_r${version}-linux.zip";
sha256 = "0gnk49pkwy4m0nqwm1xnf3w4mfpi9w0kk7841xlawpwbkj0icxap";
url = "https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip";
sha256 = "1yfy0qqxz1ixpsci1pizls1nrncmi8p16wcb9rimdn4q3mdfxzwj";
}
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
url = "http://dl.google.com/android/repository/tools_r${version}-macosx.zip";
sha256 = "0yg7wjmyw70xsh8k4hgbqb5rilam2a94yc8dwbh7fjwqcmpxgwqb";
url = "https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip";
sha256 = "0gl5c30m40kx0vvrpbaa8cw8wq2vb89r14hgzb1df4qgpic97cpc";
}
else throw "platform not ${stdenv.hostPlatform.system} supported!";
@ -39,7 +47,7 @@ stdenv.mkDerivation rec {
unpackFile $src
cd tools
for f in android traceview draw9patch hierarchyviewer monitor ddms screenshot2 uiautomatorviewer monkeyrunner jobb lint
for f in monitor bin/monkeyrunner bin/uiautomatorviewer
do
sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" "$f"
done
@ -54,24 +62,6 @@ stdenv.mkDerivation rec {
patchelf --set-rpath ${stdenv_32bit.cc.cc.lib}/lib $i
done
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
for i in bin64/{mkfs.ext4,fsck.ext4,e2fsck,tune2fs,resize2fs}
do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64 $i
done
''}
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
# We must also patch the 64-bit emulator instances, if needed
for i in emulator emulator64-arm emulator64-mips emulator64-x86 emulator64-crash-service emulator-check qemu/linux-x86_64/qemu-system-*
do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64 $i
done
''}
# The following scripts used SWT and wants to dynamically load some GTK+ stuff.
# Creating these wrappers ensure that they can be found:
@ -79,22 +69,18 @@ stdenv.mkDerivation rec {
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ glib gtk2 libXtst ]}
wrapProgram `pwd`/uiautomatorviewer \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
wrapProgram `pwd`/hierarchyviewer \
wrapProgram `pwd`/bin/uiautomatorviewer \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
# The emulators need additional libraries, which are dynamically loaded => let's wrap them
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
for i in emulator emulator64-arm emulator64-mips emulator64-x86 emulator64-crash-service
for i in emulator emulator-check
do
wrapProgram `pwd`/$i \
--prefix PATH : ${stdenv.lib.makeBinPath [ file glxinfo ]} \
--suffix LD_LIBRARY_PATH : `pwd`/lib64:`pwd`/lib64/qt/lib:${makeLibraryPath [ stdenv.cc.cc libX11 libxcb libXau libXdmcp libXext libGLU_combined alsaLib zlib libpulseaudio dbus.lib ]} \
--suffix LD_LIBRARY_PATH : `pwd`/lib:${makeLibraryPath [ stdenv.cc.cc libX11 libxcb libXau libXdmcp libXext libGLU_combined alsaLib zlib libpulseaudio dbus.lib ]} \
--suffix QT_XKB_CONFIG_ROOT : ${xkeyboardconfig}/share/X11/xkb
done
''}
@ -245,6 +231,14 @@ stdenv.mkDerivation rec {
fi
done
for i in $out/libexec/tools/bin/*
do
if [ ! -d $i ] && [ -x $i ]
then
ln -sf $i $out/bin/$(basename $i)
fi
done
for i in $out/libexec/platform-tools/*
do
if [ ! -d $i ] && [ -x $i ]
@ -260,6 +254,11 @@ stdenv.mkDerivation rec {
ln -sf $i $out/bin/$(basename $i)
fi
done
wrapProgram $out/bin/sdkmanager \
--set JAVA_HOME ${jdk}
yes | ANDROID_SDK_HOME=$(mktemp -d) $out/bin/sdkmanager --licenses || true
'';
buildInputs = [ unzip makeWrapper ];

View File

@ -1,5 +1,5 @@
{ buildPackages, pkgs, pkgs_i686, targetPackages
, includeSources ? true
, includeSources ? true, licenseAccepted ? false
}:
# TODO: use callPackage instead of import to avoid so many inherits
@ -57,7 +57,7 @@ rec {
inherit platformTools buildTools support
supportRepository platforms sysimages
addons sources includeSources;
addons sources includeSources licenseAccepted;
stdenv_32bit = pkgs_i686.stdenv;
};

View File

@ -766,6 +766,7 @@ with pkgs;
androidenv = callPackage ../development/mobile/androidenv {
pkgs_i686 = pkgsi686Linux;
licenseAccepted = (config.android_sdk.accept_license or false);
};
inherit (androidenv) androidndk;