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 , freetype, fontconfig, glib, gtk2, atk, file, jdk, coreutils, libpulseaudio, dbus
, zlib, glxinfo, xkeyboardconfig , zlib, glxinfo, xkeyboardconfig
, includeSources , includeSources
, licenseAccepted
}: }:
{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false { platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false
, useGooglePlayServices ? false, useInstantApps ? 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; let inherit (stdenv.lib) makeLibraryPath;
googleRepository = let version = "gms_v9_rc41_wear_2_0_rc6"; googleRepository = let version = "gms_v9_rc41_wear_2_0_rc6";
@ -20,16 +28,16 @@ in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "android-sdk-${version}"; 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") src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
then fetchurl { then fetchurl {
url = "https://dl.google.com/android/repository/tools_r${version}-linux.zip"; url = "https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip";
sha256 = "0gnk49pkwy4m0nqwm1xnf3w4mfpi9w0kk7841xlawpwbkj0icxap"; sha256 = "1yfy0qqxz1ixpsci1pizls1nrncmi8p16wcb9rimdn4q3mdfxzwj";
} }
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl { else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
url = "http://dl.google.com/android/repository/tools_r${version}-macosx.zip"; url = "https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip";
sha256 = "0yg7wjmyw70xsh8k4hgbqb5rilam2a94yc8dwbh7fjwqcmpxgwqb"; sha256 = "0gl5c30m40kx0vvrpbaa8cw8wq2vb89r14hgzb1df4qgpic97cpc";
} }
else throw "platform not ${stdenv.hostPlatform.system} supported!"; else throw "platform not ${stdenv.hostPlatform.system} supported!";
@ -39,7 +47,7 @@ stdenv.mkDerivation rec {
unpackFile $src unpackFile $src
cd tools 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 do
sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" "$f" sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" "$f"
done done
@ -54,24 +62,6 @@ stdenv.mkDerivation rec {
patchelf --set-rpath ${stdenv_32bit.cc.cc.lib}/lib $i patchelf --set-rpath ${stdenv_32bit.cc.cc.lib}/lib $i
done 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. # The following scripts used SWT and wants to dynamically load some GTK+ stuff.
# Creating these wrappers ensure that they can be found: # Creating these wrappers ensure that they can be found:
@ -79,22 +69,18 @@ stdenv.mkDerivation rec {
--prefix PATH : ${jdk}/bin \ --prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ glib gtk2 libXtst ]} --prefix LD_LIBRARY_PATH : ${makeLibraryPath [ glib gtk2 libXtst ]}
wrapProgram `pwd`/uiautomatorviewer \ wrapProgram `pwd`/bin/uiautomatorviewer \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
wrapProgram `pwd`/hierarchyviewer \
--prefix PATH : ${jdk}/bin \ --prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]} --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
# The emulators need additional libraries, which are dynamically loaded => let's wrap them # The emulators need additional libraries, which are dynamically loaded => let's wrap them
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") '' ${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 do
wrapProgram `pwd`/$i \ wrapProgram `pwd`/$i \
--prefix PATH : ${stdenv.lib.makeBinPath [ file glxinfo ]} \ --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 --suffix QT_XKB_CONFIG_ROOT : ${xkeyboardconfig}/share/X11/xkb
done done
''} ''}
@ -245,6 +231,14 @@ stdenv.mkDerivation rec {
fi fi
done 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/* for i in $out/libexec/platform-tools/*
do do
if [ ! -d $i ] && [ -x $i ] if [ ! -d $i ] && [ -x $i ]
@ -260,6 +254,11 @@ stdenv.mkDerivation rec {
ln -sf $i $out/bin/$(basename $i) ln -sf $i $out/bin/$(basename $i)
fi fi
done done
wrapProgram $out/bin/sdkmanager \
--set JAVA_HOME ${jdk}
yes | ANDROID_SDK_HOME=$(mktemp -d) $out/bin/sdkmanager --licenses || true
''; '';
buildInputs = [ unzip makeWrapper ]; buildInputs = [ unzip makeWrapper ];

View File

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

View File

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