git.iko.soy/typeable/nixpkgs
on master help sign in
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

commit6872a4a79793ef0c4e2569a3e1ce1cdc99cce9fd authorCray Elliott <MP2E@archlinux.us> dateMon 24 Nov 2014, 00:16 (12 years ago) parent3f7b2bc
3 files changed+54−11
pkgs/development/mobile/androidenv/androidndk.nix+50−9 pkgs/development/mobile/androidenv/build-app.nix+1−1 pkgs/development/mobile/androidenv/default.nix+3−1
pkgs/development/mobile/androidenv/androidndk.nix+50−9
@@ -1,4 +1,6 @@
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
24}:
35
46assert stdenv.isLinux;
@@ -17,23 +19,62 @@ stdenv.mkDerivation rec {
1719 }
1820 else throw "platform ${stdenv.system} not supported!";
1921
20− phases = "installPhase";
22+ phases = "buildPhase";
2123
22− buildInputs = [ p7zip ];
24+ buildInputs = [ p7zip makeWrapper ];
2325
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 ''
2542 set -x
26− mkdir -pv $out
43+ mkdir -pv $out/libexec
44+ cd $out/libexec
2745 7z x $src
28− mv */* $out
2946
3047 # 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}
3253
3354 find $out \( \
3455 \( -type f -a -name "*.so*" \) -o \
35− \( -type f -a -perm +0100 \) \
56+ \( -type f -a -perm /0100 \) \
3657 \) -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
3879 '';
3980}
pkgs/development/mobile/androidenv/build-app.nix+1−1
@@ -39,7 +39,7 @@ stdenv.mkDerivation ({
3939 ${if useNDK then ''
4040 export GNUMAKE=${gnumake}/bin/make
4141 export NDK_HOST_AWK=${gawk}/bin/gawk
42− ${androidndk}/ndk-build
42+ ${androidndk}/bin/ndk-build
4343 '' else ""}
4444 ant ${antFlags} ${if release then "release" else "debug"}
4545 '';
pkgs/development/mobile/androidenv/default.nix+3−1
@@ -129,7 +129,9 @@ rec {
129129 };
130130
131131 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;
133135 };
134136
135137 buildApp = import ./build-app.nix {