androidndk: Fixes missing libraries for prebuilt clang

This commit is contained in:
Bastian Köcher 2018-05-24 14:38:27 +02:00
parent 7796075209
commit 495c5a2291
2 changed files with 13 additions and 14 deletions

@ -1,6 +1,6 @@
{ stdenv, fetchurl, zlib, ncurses, p7zip, lib, makeWrapper { stdenv, fetchurl, zlib, ncurses5, p7zip, lib, makeWrapper
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
, platformTools, python3, version, sha256 , platformTools, python3, libcxx, version, sha256
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
phases = "buildPhase"; phases = "buildPhase";
nativeBuildInputs = [ p7zip makeWrapper ]; nativeBuildInputs = [ p7zip makeWrapper file ];
buildCommand = let buildCommand = let
bin_path = "$out/bin"; bin_path = "$out/bin";
@ -33,9 +33,14 @@ stdenv.mkDerivation rec {
in '' in ''
set -x set -x
mkdir -pv $out/libexec mkdir -pv $out/libexec
mkdir -pv $out/lib64
ln -s ${ncurses5.out}/lib/libncursesw.so.5 $out/lib64/libtinfo.so.5
ln -s ${ncurses5.out}/lib/libncurses.so.5 $out/lib64/libncurses.so.5
cd $out/libexec cd $out/libexec
7z x $src 7z x $src
patchShebangs ${pkg_path}
# so that it doesn't fail because of read-only permissions set # so that it doesn't fail because of read-only permissions set
cd - cd -
${if (version == "10e") then ${if (version == "10e") then
@ -46,8 +51,6 @@ stdenv.mkDerivation rec {
'' ''
else else
'' ''
patchShebangs ${pkg_path}/build/tools/make-standalone-toolchain.sh
patch -p1 \ patch -p1 \
--no-backup-if-mismatch \ --no-backup-if-mismatch \
-d $out/libexec/${name} < ${ ./. + builtins.toPath ("/make_standalone_toolchain.py_" + "${version}" + ".patch") } -d $out/libexec/${name} < ${ ./. + builtins.toPath ("/make_standalone_toolchain.py_" + "${version}" + ".patch") }
@ -60,17 +63,13 @@ stdenv.mkDerivation rec {
\( -type f -a -name "*.so*" \) -o \ \( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm -0100 \) \ \( -type f -a -perm -0100 \) \
\) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \ \) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \
--set-rpath ${stdenv.lib.makeLibraryPath [ zlib.out ncurses ]} {} \; --set-rpath $out/lib64:${stdenv.lib.makeLibraryPath [ libcxx.out zlib.out ncurses5 ]} {} \;
# fix ineffective PROGDIR / MYNDKDIR determination # fix ineffective PROGDIR / MYNDKDIR determination
for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py"} for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py"}
do do
sed -i -e ${sed_script_1} $i sed -i -e ${sed_script_1} $i
done done
${lib.optionalString (version == "10e") ''
sed -i -e ${sed_script_2} ndk-which
# a bash script
patchShebangs ndk-which
''}
# wrap # wrap
for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py ndk-which"} for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py ndk-which"}
do do

@ -219,7 +219,7 @@ rec {
inherit (buildPackages) inherit (buildPackages)
p7zip makeWrapper; p7zip makeWrapper;
inherit (pkgs) inherit (pkgs)
stdenv fetchurl zlib ncurses lib python3 stdenv fetchurl zlib ncurses5 lib python3 libcxx
coreutils file findutils gawk gnugrep gnused jdk which; coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools; inherit platformTools;
version = "10e"; version = "10e";
@ -230,7 +230,7 @@ rec {
inherit (buildPackages) inherit (buildPackages)
p7zip makeWrapper; p7zip makeWrapper;
inherit (pkgs) inherit (pkgs)
stdenv fetchurl zlib ncurses lib python3 stdenv fetchurl zlib ncurses5 lib python3 libcxx
coreutils file findutils gawk gnugrep gnused jdk which; coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools; inherit platformTools;
version = "16b"; version = "16b";
@ -241,7 +241,7 @@ rec {
inherit (buildPackages) inherit (buildPackages)
p7zip makeWrapper; p7zip makeWrapper;
inherit (pkgs) inherit (pkgs)
stdenv fetchurl zlib ncurses lib python3 stdenv fetchurl zlib ncurses5 lib python3 libcxx
coreutils file findutils gawk gnugrep gnused jdk which; coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools; inherit platformTools;
version = "17"; version = "17";