mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 13:57:10 +03:00
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
This commit is contained in:
parent
3f7b2bc70d
commit
6872a4a797
@ -1,4 +1,6 @@
|
||||
{ stdenv, fetchurl, zlib, ncurses, p7zip
|
||||
{ stdenv, fetchurl, zlib, ncurses, p7zip, lib, makeWrapper
|
||||
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
|
||||
, platformTools
|
||||
}:
|
||||
|
||||
assert stdenv.isLinux;
|
||||
@ -17,23 +19,62 @@ stdenv.mkDerivation rec {
|
||||
}
|
||||
else throw "platform ${stdenv.system} not supported!";
|
||||
|
||||
phases = "installPhase";
|
||||
phases = "buildPhase";
|
||||
|
||||
buildInputs = [ p7zip ];
|
||||
buildInputs = [ p7zip makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
buildCommand = let
|
||||
bin_path = "$out/bin";
|
||||
pkg_path = "$out/libexec/${name}";
|
||||
sed_script_1 =
|
||||
"'s|^PROGDIR=`dirname $0`" +
|
||||
"|PROGDIR=`dirname $(readlink -f $(which $0))`|'";
|
||||
sed_script_2 =
|
||||
"'s|^MYNDKDIR=`dirname $0`" +
|
||||
"|MYNDKDIR=`dirname $(readlink -f $(which $0))`|'";
|
||||
runtime_paths = (lib.makeSearchPath "bin" [
|
||||
coreutils file findutils
|
||||
gawk gnugrep gnused
|
||||
jdk
|
||||
which
|
||||
]) + ":${platformTools}/platform-tools";
|
||||
in ''
|
||||
set -x
|
||||
mkdir -pv $out
|
||||
mkdir -pv $out/libexec
|
||||
cd $out/libexec
|
||||
7z x $src
|
||||
mv */* $out
|
||||
|
||||
# so that it doesn't fail because of read-only permissions set
|
||||
patch -p1 -d $out < ${ ./make-standalone-toolchain.patch }
|
||||
cd -
|
||||
patch -p1 \
|
||||
--no-backup-if-mismatch \
|
||||
-d $out/libexec/${name} < ${ ./make-standalone-toolchain.patch }
|
||||
cd ${pkg_path}
|
||||
|
||||
find $out \( \
|
||||
\( -type f -a -name "*.so*" \) -o \
|
||||
\( -type f -a -perm +0100 \) \
|
||||
\( -type f -a -perm /0100 \) \
|
||||
\) -exec patchelf --set-interpreter ${stdenv.gcc.libc}/lib/ld-*so.? \
|
||||
--set-rpath ${zlib}/lib:${ncurses}/lib {} \;
|
||||
--set-rpath ${zlib}/lib:${ncurses}/lib {} \;
|
||||
# fix ineffective PROGDIR / MYNDKDIR determination
|
||||
for i in ndk-build ndk-gdb ndk-gdb-py
|
||||
do
|
||||
sed -i -e ${sed_script_1} $i
|
||||
done
|
||||
sed -i -e ${sed_script_2} ndk-which
|
||||
# a bash script
|
||||
patchShebangs ndk-which
|
||||
# make some executables available in PATH
|
||||
mkdir -pv ${bin_path}
|
||||
for i in \
|
||||
ndk-build ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which
|
||||
do
|
||||
ln -sf ${pkg_path}/$i ${bin_path}/$i
|
||||
done
|
||||
# wrap
|
||||
for i in ndk-build ndk-gdb ndk-gdb-py ndk-which
|
||||
do
|
||||
wrapProgram "${bin_path}/$i" --prefix PATH : "${runtime_paths}"
|
||||
done
|
||||
'';
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ stdenv.mkDerivation ({
|
||||
${if useNDK then ''
|
||||
export GNUMAKE=${gnumake}/bin/make
|
||||
export NDK_HOST_AWK=${gawk}/bin/gawk
|
||||
${androidndk}/ndk-build
|
||||
${androidndk}/bin/ndk-build
|
||||
'' else ""}
|
||||
ant ${antFlags} ${if release then "release" else "debug"}
|
||||
'';
|
||||
|
@ -129,7 +129,9 @@ rec {
|
||||
};
|
||||
|
||||
androidndk = import ./androidndk.nix {
|
||||
inherit (pkgs) stdenv fetchurl zlib ncurses p7zip;
|
||||
inherit (pkgs) stdenv fetchurl zlib ncurses p7zip lib makeWrapper;
|
||||
inherit (pkgs) coreutils file findutils gawk gnugrep gnused jdk which;
|
||||
inherit platformTools;
|
||||
};
|
||||
|
||||
buildApp = import ./build-app.nix {
|
||||
|
Loading…
Reference in New Issue
Block a user