nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 103 lines 2.6 kB view raw
1{ 2 deployAndroidPackage, 3 lib, 4 stdenv, 5 package, 6 os, 7 arch, 8 autoPatchelfHook, 9 makeWrapper, 10 pkgs, 11 pkgsi686Linux, 12 postInstall, 13 meta, 14}: 15 16deployAndroidPackage { 17 inherit package os arch; 18 nativeBuildInputs = [ makeWrapper ] ++ lib.optionals (os == "linux") [ autoPatchelfHook ]; 19 buildInputs = 20 lib.optionals (os == "linux") ( 21 with pkgs; 22 [ 23 glibc 24 libcxx 25 libGL 26 libpulseaudio 27 libtiff 28 libuuid 29 zlib 30 libbsd 31 ncurses5 32 libdrm 33 stdenv.cc.cc 34 expat 35 freetype 36 nss 37 nspr 38 alsa-lib 39 llvmPackages_15.libllvm.lib 40 waylandpp.lib 41 ] 42 ) 43 ++ (with pkgs.xorg; [ 44 libX11 45 libXext 46 libXdamage 47 libXfixes 48 libxcb 49 libXcomposite 50 libXcursor 51 libXi 52 libXrender 53 libXtst 54 libICE 55 libSM 56 libxkbfile 57 libxshmfence 58 ]) 59 ++ lib.optional (os == "linux" && stdenv.isx86_64) pkgsi686Linux.glibc; 60 patchInstructions = 61 (lib.optionalString (os == "linux") '' 62 addAutoPatchelfSearchPath $packageBaseDir/lib 63 addAutoPatchelfSearchPath $packageBaseDir/lib64 64 addAutoPatchelfSearchPath $packageBaseDir/lib64/qt/lib 65 # autoPatchelf is not detecting libuuid :( 66 addAutoPatchelfSearchPath ${pkgs.libuuid.out}/lib 67 68 # This library is linked against a version of libtiff that nixpkgs doesn't have 69 for file in $out/libexec/android-sdk/emulator/*/qt/plugins/imageformats/libqtiffAndroidEmu.so; do 70 patchelf --replace-needed libtiff.so.5 libtiff.so "$file" || true 71 done 72 73 for file in $out/libexec/android-sdk/emulator/lib64/vulkan/libvulkan_lvp.so; do 74 patchelf --replace-needed libLLVM-15.so.1 libLLVM-15.so "$file" || true 75 done 76 77 autoPatchelf $out 78 79 # Wrap emulator so that it can load required libraries at runtime 80 wrapProgram $out/libexec/android-sdk/emulator/emulator \ 81 --prefix LD_LIBRARY_PATH : ${ 82 lib.makeLibraryPath [ 83 pkgs.dbus 84 pkgs.systemd 85 ] 86 } \ 87 --set QT_XKB_CONFIG_ROOT ${pkgs.xkeyboard_config}/share/X11/xkb \ 88 --set QTCOMPOSE ${pkgs.xorg.libX11.out}/share/X11/locale 89 '') 90 + '' 91 mkdir -p $out/bin 92 cd $out/bin 93 find $out/libexec/android-sdk/emulator -type f -executable -mindepth 1 -maxdepth 1 | while read i; do 94 ln -s $i 95 done 96 97 cd $out/libexec/android-sdk 98 ${postInstall} 99 ''; 100 dontMoveLib64 = true; 101 102 inherit meta; 103}