1{ deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, pkgsi686Linux, postInstall }:
2
3deployAndroidPackage {
4 inherit package os;
5 nativeBuildInputs = [ makeWrapper ]
6 ++ lib.optionals (os == "linux") [ autoPatchelfHook ];
7 buildInputs = lib.optionals (os == "linux") (with pkgs; [
8 glibc
9 libcxx
10 libGL
11 libpulseaudio
12 libuuid
13 zlib
14 ncurses5
15 stdenv.cc.cc
16 pkgsi686Linux.glibc
17 expat
18 freetype
19 nss
20 nspr
21 alsa-lib
22 ]) ++ (with pkgs.xorg; [
23 libX11
24 libXext
25 libXdamage
26 libXfixes
27 libxcb
28 libXcomposite
29 libXcursor
30 libXi
31 libXrender
32 libXtst
33 ]);
34 patchInstructions = lib.optionalString (os == "linux") ''
35 addAutoPatchelfSearchPath $packageBaseDir/lib
36 addAutoPatchelfSearchPath $packageBaseDir/lib64
37 addAutoPatchelfSearchPath $packageBaseDir/lib64/qt/lib
38 # autoPatchelf is not detecting libuuid :(
39 addAutoPatchelfSearchPath ${pkgs.libuuid.out}/lib
40 autoPatchelf $out
41
42 # Wrap emulator so that it can load required libraries at runtime
43 wrapProgram $out/libexec/android-sdk/emulator/emulator \
44 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
45 pkgs.dbus
46 pkgs.systemd
47 ]} \
48 --set QT_XKB_CONFIG_ROOT ${pkgs.xkeyboard_config}/share/X11/xkb \
49 --set QTCOMPOSE ${pkgs.xorg.libX11.out}/share/X11/locale
50
51 mkdir -p $out/bin
52 cd $out/bin
53 find $out/libexec/android-sdk/emulator -type f -executable -mindepth 1 -maxdepth 1 | while read i; do
54 ln -s $i
55 done
56
57 cd $out/libexec/android-sdk
58 ${postInstall}
59 '';
60 dontMoveLib64 = true;
61}