Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Fix Android NDK package, previously ndk-build was not being properly put in $PATH

This commit also brings in the dependencies ndk-build needs and fixes a bug with
permissions

This was commited on behalf of ewemoa

+54 -11
+50 -9
pkgs/development/mobile/androidenv/androidndk.nix
··· 1 - { stdenv, fetchurl, zlib, ncurses, p7zip 2 }: 3 4 assert stdenv.isLinux; ··· 17 } 18 else throw "platform ${stdenv.system} not supported!"; 19 20 - phases = "installPhase"; 21 22 - buildInputs = [ p7zip ]; 23 24 - installPhase = '' 25 set -x 26 - mkdir -pv $out 27 7z x $src 28 - mv */* $out 29 30 # so that it doesn't fail because of read-only permissions set 31 - patch -p1 -d $out < ${ ./make-standalone-toolchain.patch } 32 33 find $out \( \ 34 \( -type f -a -name "*.so*" \) -o \ 35 - \( -type f -a -perm +0100 \) \ 36 \) -exec patchelf --set-interpreter ${stdenv.gcc.libc}/lib/ld-*so.? \ 37 - --set-rpath ${zlib}/lib:${ncurses}/lib {} \; 38 ''; 39 }
··· 1 + { stdenv, fetchurl, zlib, ncurses, p7zip, lib, makeWrapper 2 + , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which 3 + , platformTools 4 }: 5 6 assert stdenv.isLinux; ··· 19 } 20 else throw "platform ${stdenv.system} not supported!"; 21 22 + phases = "buildPhase"; 23 24 + buildInputs = [ p7zip makeWrapper ]; 25 26 + buildCommand = let 27 + bin_path = "$out/bin"; 28 + pkg_path = "$out/libexec/${name}"; 29 + sed_script_1 = 30 + "'s|^PROGDIR=`dirname $0`" + 31 + "|PROGDIR=`dirname $(readlink -f $(which $0))`|'"; 32 + sed_script_2 = 33 + "'s|^MYNDKDIR=`dirname $0`" + 34 + "|MYNDKDIR=`dirname $(readlink -f $(which $0))`|'"; 35 + runtime_paths = (lib.makeSearchPath "bin" [ 36 + coreutils file findutils 37 + gawk gnugrep gnused 38 + jdk 39 + which 40 + ]) + ":${platformTools}/platform-tools"; 41 + in '' 42 set -x 43 + mkdir -pv $out/libexec 44 + cd $out/libexec 45 7z x $src 46 47 # so that it doesn't fail because of read-only permissions set 48 + cd - 49 + patch -p1 \ 50 + --no-backup-if-mismatch \ 51 + -d $out/libexec/${name} < ${ ./make-standalone-toolchain.patch } 52 + cd ${pkg_path} 53 54 find $out \( \ 55 \( -type f -a -name "*.so*" \) -o \ 56 + \( -type f -a -perm /0100 \) \ 57 \) -exec patchelf --set-interpreter ${stdenv.gcc.libc}/lib/ld-*so.? \ 58 + --set-rpath ${zlib}/lib:${ncurses}/lib {} \; 59 + # fix ineffective PROGDIR / MYNDKDIR determination 60 + for i in ndk-build ndk-gdb ndk-gdb-py 61 + do 62 + sed -i -e ${sed_script_1} $i 63 + done 64 + sed -i -e ${sed_script_2} ndk-which 65 + # a bash script 66 + patchShebangs ndk-which 67 + # make some executables available in PATH 68 + mkdir -pv ${bin_path} 69 + for i in \ 70 + ndk-build ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which 71 + do 72 + ln -sf ${pkg_path}/$i ${bin_path}/$i 73 + done 74 + # wrap 75 + for i in ndk-build ndk-gdb ndk-gdb-py ndk-which 76 + do 77 + wrapProgram "${bin_path}/$i" --prefix PATH : "${runtime_paths}" 78 + done 79 ''; 80 }
+1 -1
pkgs/development/mobile/androidenv/build-app.nix
··· 39 ${if useNDK then '' 40 export GNUMAKE=${gnumake}/bin/make 41 export NDK_HOST_AWK=${gawk}/bin/gawk 42 - ${androidndk}/ndk-build 43 '' else ""} 44 ant ${antFlags} ${if release then "release" else "debug"} 45 '';
··· 39 ${if useNDK then '' 40 export GNUMAKE=${gnumake}/bin/make 41 export NDK_HOST_AWK=${gawk}/bin/gawk 42 + ${androidndk}/bin/ndk-build 43 '' else ""} 44 ant ${antFlags} ${if release then "release" else "debug"} 45 '';
+3 -1
pkgs/development/mobile/androidenv/default.nix
··· 129 }; 130 131 androidndk = import ./androidndk.nix { 132 - inherit (pkgs) stdenv fetchurl zlib ncurses p7zip; 133 }; 134 135 buildApp = import ./build-app.nix {
··· 129 }; 130 131 androidndk = import ./androidndk.nix { 132 + inherit (pkgs) stdenv fetchurl zlib ncurses p7zip lib makeWrapper; 133 + inherit (pkgs) coreutils file findutils gawk gnugrep gnused jdk which; 134 + inherit platformTools; 135 }; 136 137 buildApp = import ./build-app.nix {