androidsdk: Re-add emulator that was broken out of the sdk-tools package.

This commit is contained in:
Clemens Fruhwirth 2018-10-31 13:16:05 +01:00 committed by David McFarland
parent c43abffb9c
commit b4d9f6ddca

@ -41,10 +41,16 @@ stdenv.mkDerivation rec {
} }
else throw "platform not ${stdenv.hostPlatform.system} supported!"; else throw "platform not ${stdenv.hostPlatform.system} supported!";
emulator = fetchurl {
url = "https://dl.google.com/android/repository/emulator-linux-4969155.zip";
sha256 = "0iw0j6j3w9zpfalsa7xq2czz4vzgq96zk2zddjhanwwx4p8fhrfd";
};
buildCommand = '' buildCommand = ''
mkdir -p $out/libexec mkdir -p $out/libexec
cd $out/libexec cd $out/libexec
unpackFile $src unpackFile $src
unpackFile $emulator
cd tools cd tools
for f in monitor bin/monkeyrunner bin/uiautomatorviewer for f in monitor bin/monkeyrunner bin/uiautomatorviewer
@ -76,13 +82,16 @@ stdenv.mkDerivation rec {
# 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 emulator-check cd ..
for i in emulator/emulator* emulator/qemu/linux-x86_64/qemu-system-*
do do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
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`/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
cd tools
''} ''}
''} ''}
@ -263,6 +272,14 @@ stdenv.mkDerivation rec {
fi fi
done done
for i in $out/libexec/emulator/*
do
if [ ! -d $i ] && [ -x $i ]
then
ln -sf $i $out/bin/$(basename $i)
fi
done
wrapProgram $out/bin/sdkmanager \ wrapProgram $out/bin/sdkmanager \
--set JAVA_HOME ${jdk} --set JAVA_HOME ${jdk}