at master 1.7 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 name = "androidsdk-tools"; 18 inherit package os arch; 19 nativeBuildInputs = [ makeWrapper ] ++ lib.optionals (os == "linux") [ autoPatchelfHook ]; 20 buildInputs = lib.optional (os == "linux") ( 21 (with pkgs; [ 22 glibc 23 freetype 24 fontconfig 25 fontconfig.lib 26 stdenv.cc.cc.libgcc or null # fix for https://github.com/NixOS/nixpkgs/issues/226357 27 ]) 28 ++ (with pkgs.xorg; [ 29 libX11 30 libXrender 31 libXext 32 ]) 33 ++ lib.optionals (os == "linux" && stdenv.isx86_64) ( 34 with pkgsi686Linux; 35 [ 36 glibc 37 xorg.libX11 38 xorg.libXrender 39 xorg.libXext 40 fontconfig.lib 41 freetype 42 zlib 43 ] 44 ) 45 ); 46 47 patchInstructions = '' 48 ${lib.optionalString (os == "linux") '' 49 # Auto patch all binaries 50 autoPatchelf . 51 ''} 52 53 # Wrap all scripts that require JAVA_HOME 54 for i in bin; do 55 find $i -maxdepth 1 -type f -executable | while read program; do 56 if grep -q "JAVA_HOME" $program; then 57 wrapProgram $PWD/$program --prefix PATH : ${pkgs.jdk8}/bin 58 fi 59 done 60 done 61 62 # Wrap monitor script 63 wrapProgram $PWD/monitor \ 64 --prefix PATH : ${pkgs.jdk8}/bin \ 65 --prefix LD_LIBRARY_PATH : ${ 66 lib.makeLibraryPath ( 67 with pkgs; 68 [ 69 xorg.libX11 70 xorg.libXtst 71 ] 72 ) 73 } 74 75 # Patch all script shebangs 76 patchShebangs . 77 78 cd $out/libexec/android-sdk 79 ${postInstall} 80 ''; 81 82 inherit meta; 83}