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 1 + { stdenv, fetchurl, zlib, ncurses, p7zip, lib, makeWrapper 2 + , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which 3 + , platformTools 2 4 }: 3 5 4 6 assert stdenv.isLinux; ··· 17 19 } 18 20 else throw "platform ${stdenv.system} not supported!"; 19 21 20 - phases = "installPhase"; 22 + phases = "buildPhase"; 21 23 22 - buildInputs = [ p7zip ]; 24 + buildInputs = [ p7zip makeWrapper ]; 23 25 24 - installPhase = '' 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 '' 25 42 set -x 26 - mkdir -pv $out 43 + mkdir -pv $out/libexec 44 + cd $out/libexec 27 45 7z x $src 28 - mv */* $out 29 46 30 47 # so that it doesn't fail because of read-only permissions set 31 - patch -p1 -d $out < ${ ./make-standalone-toolchain.patch } 48 + cd - 49 + patch -p1 \ 50 + --no-backup-if-mismatch \ 51 + -d $out/libexec/${name} < ${ ./make-standalone-toolchain.patch } 52 + cd ${pkg_path} 32 53 33 54 find $out \( \ 34 55 \( -type f -a -name "*.so*" \) -o \ 35 - \( -type f -a -perm +0100 \) \ 56 + \( -type f -a -perm /0100 \) \ 36 57 \) -exec patchelf --set-interpreter ${stdenv.gcc.libc}/lib/ld-*so.? \ 37 - --set-rpath ${zlib}/lib:${ncurses}/lib {} \; 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 38 79 ''; 39 80 }
+1 -1
pkgs/development/mobile/androidenv/build-app.nix
··· 39 39 ${if useNDK then '' 40 40 export GNUMAKE=${gnumake}/bin/make 41 41 export NDK_HOST_AWK=${gawk}/bin/gawk 42 - ${androidndk}/ndk-build 42 + ${androidndk}/bin/ndk-build 43 43 '' else ""} 44 44 ant ${antFlags} ${if release then "release" else "debug"} 45 45 '';
+3 -1
pkgs/development/mobile/androidenv/default.nix
··· 129 129 }; 130 130 131 131 androidndk = import ./androidndk.nix { 132 - inherit (pkgs) stdenv fetchurl zlib ncurses p7zip; 132 + inherit (pkgs) stdenv fetchurl zlib ncurses p7zip lib makeWrapper; 133 + inherit (pkgs) coreutils file findutils gawk gnugrep gnused jdk which; 134 + inherit platformTools; 133 135 }; 134 136 135 137 buildApp = import ./build-app.nix {