From 9f79ac6f3bbbdee1ea006c292a867184f3985c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 15 May 2018 16:58:37 +0200 Subject: [PATCH 1/3] androidndk: Drop 32bit support --- pkgs/development/mobile/androidenv/androidndk.nix | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkgs/development/mobile/androidenv/androidndk.nix b/pkgs/development/mobile/androidenv/androidndk.nix index 2fe4005532d4..a9908d67f1d2 100644 --- a/pkgs/development/mobile/androidenv/androidndk.nix +++ b/pkgs/development/mobile/androidenv/androidndk.nix @@ -6,16 +6,10 @@ stdenv.mkDerivation rec { name = "android-ndk-r10e"; - src = if stdenv.system == "i686-linux" - then fetchurl { - url = "http://dl.google.com/android/ndk/${name}-linux-x86.bin"; - sha256 = "1xbxra5v3bm6cmxyx8yyya5r93jh5m064aibgwd396xdm8jpvc4j"; - } - else if stdenv.system == "x86_64-linux" then fetchurl { + src = if stdenv.system == "x86_64-linux" then fetchurl { url = "http://dl.google.com/android/ndk/${name}-linux-x86_64.bin"; sha256 = "0nhxixd0mq4ib176ya0hclnlbmhm8f2lab6i611kiwbzyqinfb8h"; - } - else throw "platform ${stdenv.system} not supported!"; + } else throw "platform ${stdenv.system} not supported!"; phases = "buildPhase"; From c056694d74fe99c6a0657528fac73645680e0df8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 15 May 2018 17:45:48 +0200 Subject: [PATCH 2/3] androidndk: Adds versions 17 and 16b --- .../mobile/androidenv/androidndk.nix | 52 +++++--- .../development/mobile/androidenv/default.nix | 26 +++- ...h => make-standalone-toolchain_r10e.patch} | 0 .../make_standalone_toolchain.py_16b.patch | 119 ++++++++++++++++++ .../make_standalone_toolchain.py_17.patch | 119 ++++++++++++++++++ 5 files changed, 296 insertions(+), 20 deletions(-) rename pkgs/development/mobile/androidenv/{make-standalone-toolchain.patch => make-standalone-toolchain_r10e.patch} (100%) create mode 100644 pkgs/development/mobile/androidenv/make_standalone_toolchain.py_16b.patch create mode 100644 pkgs/development/mobile/androidenv/make_standalone_toolchain.py_17.patch diff --git a/pkgs/development/mobile/androidenv/androidndk.nix b/pkgs/development/mobile/androidenv/androidndk.nix index a9908d67f1d2..d0bfe6c8100c 100644 --- a/pkgs/development/mobile/androidenv/androidndk.nix +++ b/pkgs/development/mobile/androidenv/androidndk.nix @@ -1,14 +1,14 @@ { stdenv, fetchurl, zlib, ncurses, p7zip, lib, makeWrapper , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which -, platformTools +, platformTools, python3, version, sha256 }: stdenv.mkDerivation rec { - name = "android-ndk-r10e"; + name = "android-ndk-r${version}"; src = if stdenv.system == "x86_64-linux" then fetchurl { - url = "http://dl.google.com/android/ndk/${name}-linux-x86_64.bin"; - sha256 = "0nhxixd0mq4ib176ya0hclnlbmhm8f2lab6i611kiwbzyqinfb8h"; + url = "https://dl.google.com/android/repository/${name}-linux-x86_64.zip"; + inherit sha256; } else throw "platform ${stdenv.system} not supported!"; phases = "buildPhase"; @@ -27,8 +27,7 @@ stdenv.mkDerivation rec { runtime_paths = (lib.makeBinPath [ coreutils file findutils gawk gnugrep gnused - jdk - which + jdk python3 which ]) + ":${platformTools}/platform-tools"; in '' set -x @@ -38,9 +37,22 @@ stdenv.mkDerivation rec { # so that it doesn't fail because of read-only permissions set cd - - patch -p1 \ - --no-backup-if-mismatch \ - -d $out/libexec/${name} < ${ ./make-standalone-toolchain.patch } + ${if (version == "10e") then + '' + patch -p1 \ + --no-backup-if-mismatch \ + -d $out/libexec/${name} < ${ ./make-standalone-toolchain_r10e.patch } + '' + else + '' + patchShebangs ${pkg_path}/build/tools/make-standalone-toolchain.sh + + patch -p1 \ + --no-backup-if-mismatch \ + -d $out/libexec/${name} < ${ ./. + builtins.toPath ("/make_standalone_toolchain.py_" + "${version}" + ".patch") } + wrapProgram ${pkg_path}/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}" + '' + } cd ${pkg_path} find $out \( \ @@ -49,29 +61,31 @@ stdenv.mkDerivation rec { \) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \ --set-rpath ${stdenv.lib.makeLibraryPath [ zlib.out ncurses ]} {} \; # fix ineffective PROGDIR / MYNDKDIR determination - for i in ndk-build ndk-gdb ndk-gdb-py + for i in ndk-build ${lib.optionalString (version == "10e") "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 + ${lib.optionalString (version == "10e") '' + sed -i -e ${sed_script_2} ndk-which + # a bash script + patchShebangs ndk-which + ''} # wrap - for i in ndk-build ndk-gdb ndk-gdb-py ndk-which + for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py ndk-which"} do wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}" done # 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 + ndk-build ${lib.optionalString (version == "10e") "ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which"} do ln -sf ${pkg_path}/$i ${bin_path}/$i done ''; - meta = { - platforms = stdenv.lib.platforms.linux; - hydraPlatforms = []; - }; + meta = { + platforms = stdenv.lib.platforms.linux; + hydraPlatforms = []; + }; } diff --git a/pkgs/development/mobile/androidenv/default.nix b/pkgs/development/mobile/androidenv/default.nix index b77cc68fa0e8..d122ffe241ea 100644 --- a/pkgs/development/mobile/androidenv/default.nix +++ b/pkgs/development/mobile/androidenv/default.nix @@ -215,13 +215,37 @@ rec { useInstantApps = true; }; + androidndk_10e = import ./androidndk.nix { + inherit (buildPackages) + p7zip makeWrapper; + inherit (pkgs) + stdenv fetchurl zlib ncurses lib python3 + coreutils file findutils gawk gnugrep gnused jdk which; + inherit platformTools; + version = "10e"; + sha256 = "032j3sgk93bjbkny84i17ph61dhjmsax9ddqng1zbi2p7dgl0pzf"; + }; + + androidndk_16b = import ./androidndk.nix { + inherit (buildPackages) + p7zip makeWrapper; + inherit (pkgs) + stdenv fetchurl zlib ncurses lib python3 + coreutils file findutils gawk gnugrep gnused jdk which; + inherit platformTools; + version = "16b"; + sha256 = "00frcnvpcsngv00p6l2vxj4cwi2mwcm9lnjvm3zv4wrp6pss9pmw"; + }; + androidndk = import ./androidndk.nix { inherit (buildPackages) p7zip makeWrapper; inherit (pkgs) - stdenv fetchurl zlib ncurses lib + stdenv fetchurl zlib ncurses lib python3 coreutils file findutils gawk gnugrep gnused jdk which; inherit platformTools; + version = "17"; + sha256 = "1jj3zy958zsidywqd5nwdyrnr72rf9zhippkl8rbqxfy8wxq2gds"; }; androidndk_r8e = import ./androidndk_r8e.nix { diff --git a/pkgs/development/mobile/androidenv/make-standalone-toolchain.patch b/pkgs/development/mobile/androidenv/make-standalone-toolchain_r10e.patch similarity index 100% rename from pkgs/development/mobile/androidenv/make-standalone-toolchain.patch rename to pkgs/development/mobile/androidenv/make-standalone-toolchain_r10e.patch diff --git a/pkgs/development/mobile/androidenv/make_standalone_toolchain.py_16b.patch b/pkgs/development/mobile/androidenv/make_standalone_toolchain.py_16b.patch new file mode 100644 index 000000000000..70b1f7e7f4a5 --- /dev/null +++ b/pkgs/development/mobile/androidenv/make_standalone_toolchain.py_16b.patch @@ -0,0 +1,119 @@ +diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py +index a6ae8448..2739912e 100755 +--- a/build/tools/make_standalone_toolchain.py ++++ b/build/tools/make_standalone_toolchain.py +@@ -398,7 +398,9 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + sysroot_path, stl, host_tag): + """Create a standalone toolchain.""" + copy_directory_contents(gcc_path, install_path) ++ os.system('chmod -R +w "{}"'.format(install_path)) + copy_directory_contents(clang_path, install_path) ++ os.system('chmod -R +w "{}"'.format(install_path)) + triple = get_triple(arch) + make_clang_scripts( + install_path, triple, api, host_tag.startswith('windows')) +@@ -406,23 +408,28 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + sysroot = os.path.join(NDK_DIR, 'sysroot') + install_sysroot = os.path.join(install_path, 'sysroot') + shutil.copytree(sysroot, install_sysroot) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + arch_headers = os.path.join(sysroot, 'usr/include', triple) + copy_directory_contents( + arch_headers, os.path.join(install_sysroot, 'usr/include')) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + lib_path = os.path.join(sysroot_path, 'usr/lib') + lib_install = os.path.join(install_sysroot, 'usr/lib') + if os.path.exists(lib_path): + shutil.copytree(lib_path, lib_install) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + lib64_path = os.path.join(sysroot_path, 'usr/lib64') + lib64_install = os.path.join(install_sysroot, 'usr/lib64') + if os.path.exists(lib64_path): + shutil.copytree(lib64_path, lib64_install) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + prebuilt_path = os.path.join(NDK_DIR, 'prebuilt', host_tag) + copy_directory_contents(prebuilt_path, install_path) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + toolchain_lib_dir = os.path.join(gcc_path, 'lib/gcc', triple) + dirs = os.listdir(toolchain_lib_dir) +@@ -444,29 +451,37 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + if stl == 'gnustl': + gnustl_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/gnu-libstdc++/4.9') + shutil.copytree(os.path.join(gnustl_dir, 'include'), cxx_headers) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + for abi in get_abis(arch): + copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver, triple, + abi) ++ os.system('chmod -R +w "{}"'.format(install_path)) + copy_gnustl_libs(gnustl_dir, install_path, triple, abi) ++ os.system('chmod -R +w "{}"'.format(install_path)) + if arch == 'arm': + copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver, + triple, abi, thumb=True) ++ os.system('chmod -R +w "{}"'.format(install_path)) + copy_gnustl_libs(gnustl_dir, install_path, triple, abi, + thumb=True) ++ os.system('chmod -R +w "{}"'.format(install_path)) + elif stl == 'libc++': + libcxx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++') + libcxxabi_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++abi') + support_dir = os.path.join(NDK_DIR, 'sources/android/support') + copy_directory_contents(os.path.join(libcxx_dir, 'include'), + cxx_headers) ++ os.system('chmod -R +w "{}"'.format(install_path)) + copy_directory_contents(os.path.join(support_dir, 'include'), + support_headers) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + # I have no idea why we need this, but the old one does it too. + copy_directory_contents( + os.path.join(libcxxabi_dir, 'include'), + os.path.join(install_path, 'include/llvm-libc++abi/include')) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + headers = [ + 'cxxabi.h', +@@ -482,21 +497,25 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + dest_libdir = get_dest_libdir(install_path, triple, abi) + include_libunwind = arch == 'arm' + copy_libcxx_libs(src_libdir, dest_libdir, include_libunwind) ++ os.system('chmod -R +w "{}"'.format(install_path)) + if arch == 'arm': + thumb_libdir = os.path.join(dest_libdir, 'thumb') + copy_libcxx_libs(src_libdir, thumb_libdir, include_libunwind) ++ os.system('chmod -R +w "{}"'.format(install_path)) + elif stl == 'stlport': + stlport_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/stlport') + gabixx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/gabi++') + + copy_directory_contents( + os.path.join(stlport_dir, 'stlport'), cxx_headers) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + # Same as for libc++. Not sure why we have this extra directory, but + # keep the cruft for diff. + copy_directory_contents( + os.path.join(gabixx_dir, 'include'), + os.path.join(install_path, 'include/gabi++/include')) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + headers = [ + 'cxxabi.h', +@@ -512,9 +531,11 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + + for abi in get_abis(arch): + copy_stlport_libs(stlport_dir, install_path, triple, abi) ++ os.system('chmod -R +w "{}"'.format(install_path)) + if arch == 'arm': + copy_stlport_libs(stlport_dir, install_path, triple, abi, + thumb=True) ++ os.system('chmod -R +w "{}"'.format(install_path)) + else: + raise ValueError(stl) + diff --git a/pkgs/development/mobile/androidenv/make_standalone_toolchain.py_17.patch b/pkgs/development/mobile/androidenv/make_standalone_toolchain.py_17.patch new file mode 100644 index 000000000000..88ce69be3e8c --- /dev/null +++ b/pkgs/development/mobile/androidenv/make_standalone_toolchain.py_17.patch @@ -0,0 +1,119 @@ +diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py +index daba3351..424b7fef 100755 +--- a/build/tools/make_standalone_toolchain.py ++++ b/build/tools/make_standalone_toolchain.py +@@ -421,7 +421,9 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + platforms_path, stl, host_tag): + """Create a standalone toolchain.""" + copy_directory_contents(gcc_path, install_path) ++ os.system('chmod -R +w "{}"'.format(install_path)) + copy_directory_contents(clang_path, install_path) ++ os.system('chmod -R +w "{}"'.format(install_path)) + triple = get_triple(arch) + make_clang_scripts( + install_path, triple, api, host_tag.startswith('windows')) +@@ -432,9 +434,11 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + install_headers = os.path.join(install_sysroot, 'usr/include') + os.makedirs(os.path.dirname(install_headers)) + shutil.copytree(headers, install_headers) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + arch_headers = os.path.join(sysroot, 'usr/include', triple) + copy_directory_contents(arch_headers, os.path.join(install_headers)) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + for lib_suffix in ('', '64'): + lib_path = os.path.join(platforms_path, 'usr/lib{}'.format(lib_suffix)) +@@ -442,20 +446,24 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + install_sysroot, 'usr/lib{}'.format(lib_suffix)) + if os.path.exists(lib_path): + shutil.copytree(lib_path, lib_install) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + static_lib_path = os.path.join(sysroot, 'usr/lib', triple) + static_lib_install = os.path.join(install_sysroot, 'usr/lib') + if arch == 'x86_64': + static_lib_install += '64' + copy_directory_contents(static_lib_path, static_lib_install) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + prebuilt_path = os.path.join(NDK_DIR, 'prebuilt', host_tag) + copy_directory_contents(prebuilt_path, install_path) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + gdbserver_path = os.path.join( + NDK_DIR, 'prebuilt', 'android-' + arch, 'gdbserver') + gdbserver_install = os.path.join(install_path, 'share', 'gdbserver') + shutil.copytree(gdbserver_path, gdbserver_install) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + toolchain_lib_dir = os.path.join(gcc_path, 'lib/gcc', triple) + dirs = os.listdir(toolchain_lib_dir) +@@ -481,26 +489,33 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + for abi in get_abis(arch): + copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver, triple, + abi) ++ os.system('chmod -R +w "{}"'.format(install_path)) + copy_gnustl_libs(gnustl_dir, install_path, triple, abi) ++ os.system('chmod -R +w "{}"'.format(install_path)) + if arch == 'arm': + copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver, + triple, abi, thumb=True) ++ os.system('chmod -R +w "{}"'.format(install_path)) + copy_gnustl_libs(gnustl_dir, install_path, triple, abi, + thumb=True) ++ os.system('chmod -R +w "{}"'.format(install_path)) + elif stl == 'libc++': + libcxx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++') + libcxxabi_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++abi') + copy_directory_contents(os.path.join(libcxx_dir, 'include'), + cxx_headers) ++ os.system('chmod -R +w "{}"'.format(install_path)) + if api < 21: + support_dir = os.path.join(NDK_DIR, 'sources/android/support') + copy_directory_contents(os.path.join(support_dir, 'include'), + support_headers) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + # I have no idea why we need this, but the old one does it too. + copy_directory_contents( + os.path.join(libcxxabi_dir, 'include'), + os.path.join(install_path, 'include/llvm-libc++abi/include')) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + headers = [ + 'cxxabi.h', +@@ -515,21 +530,25 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + src_libdir = get_src_libdir(libcxx_dir, abi) + dest_libdir = get_dest_libdir(install_path, triple, abi) + copy_libcxx_libs(src_libdir, dest_libdir, abi, api) ++ os.system('chmod -R +w "{}"'.format(install_path)) + if arch == 'arm': + thumb_libdir = os.path.join(dest_libdir, 'thumb') + copy_libcxx_libs(src_libdir, thumb_libdir, abi, api) ++ os.system('chmod -R +w "{}"'.format(install_path)) + elif stl == 'stlport': + stlport_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/stlport') + gabixx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/gabi++') + + copy_directory_contents( + os.path.join(stlport_dir, 'stlport'), cxx_headers) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + # Same as for libc++. Not sure why we have this extra directory, but + # keep the cruft for diff. + copy_directory_contents( + os.path.join(gabixx_dir, 'include'), + os.path.join(install_path, 'include/gabi++/include')) ++ os.system('chmod -R +w "{}"'.format(install_path)) + + headers = [ + 'cxxabi.h', +@@ -548,6 +567,7 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, + if arch == 'arm': + copy_stlport_libs(stlport_dir, install_path, triple, abi, + thumb=True) ++ os.system('chmod -R +w "{}"'.format(install_path)) + else: + raise ValueError(stl) + From 832a8ca087b748db7be7969581e0e10ae1eb486c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 17 May 2018 17:22:27 +0200 Subject: [PATCH 3/3] androidndk: Fix usage as crossSystem --- lib/systems/examples.nix | 2 +- .../mobile/androidenv/androidndk-pkgs.nix | 21 +++++++++++++------ .../mobile/androidenv/androidndk.nix | 1 + .../development/mobile/androidenv/default.nix | 15 +++++++++++++ pkgs/stdenv/cross/default.nix | 4 +++- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 9c43d9b1bbc7..4c7dd9917919 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -45,7 +45,7 @@ rec { aarch64-android-prebuilt = rec { config = "aarch64-unknown-linux-android"; - sdkVer = "21"; + sdkVer = "24"; platform = platforms.aarch64-multiplatform; useAndroidPrebuilt = true; }; diff --git a/pkgs/development/mobile/androidenv/androidndk-pkgs.nix b/pkgs/development/mobile/androidenv/androidndk-pkgs.nix index 663a1f1ee8f4..1323466ea865 100644 --- a/pkgs/development/mobile/androidenv/androidndk-pkgs.nix +++ b/pkgs/development/mobile/androidenv/androidndk-pkgs.nix @@ -98,10 +98,19 @@ rec { # We use androidndk from the previous stage, else we waste time or get cycles # cross-compiling packages to wrap incorrectly wrap binaries we don't include # anyways. - libraries = { - name = "bionic-prebuilt"; - type = "derivation"; - outPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/"; - drvPath = throw "fake derivation, build ${buildAndroidndk} to use"; - }; + libraries = + let + includePath = if buildAndroidndk.version == "10e" then + "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/include/" + else + "${buildAndroidndk}/libexec/${buildAndroidndk.name}/sysroot/usr/include"; + libPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/lib/"; + in + runCommand "bionic-prebuilt" {} '' + mkdir -p $out + cp -r ${includePath} $out/include + chmod +w $out/include + ${lib.optionalString (lib.versionOlder buildAndroidndk.version "10e") "ln -s $out/include/${targetInfo.triple}/asm $out/include/asm"} + ln -s ${libPath} $out/lib + ''; } diff --git a/pkgs/development/mobile/androidenv/androidndk.nix b/pkgs/development/mobile/androidenv/androidndk.nix index d0bfe6c8100c..78e278be2376 100644 --- a/pkgs/development/mobile/androidenv/androidndk.nix +++ b/pkgs/development/mobile/androidenv/androidndk.nix @@ -5,6 +5,7 @@ stdenv.mkDerivation rec { name = "android-ndk-r${version}"; + inherit version; src = if stdenv.system == "x86_64-linux" then fetchurl { url = "https://dl.google.com/android/repository/${name}-linux-x86_64.zip"; diff --git a/pkgs/development/mobile/androidenv/default.nix b/pkgs/development/mobile/androidenv/default.nix index d122ffe241ea..3978ae1aeb7b 100644 --- a/pkgs/development/mobile/androidenv/default.nix +++ b/pkgs/development/mobile/androidenv/default.nix @@ -281,4 +281,19 @@ rec { inherit androidndk; targetAndroidndkPkgs = targetPackages.androidenv.androidndkPkgs; }; + + androidndkPkgs_10e = import ./androidndk-pkgs.nix { + inherit (buildPackages) + makeWrapper; + inherit (pkgs) + lib hostPlatform targetPlatform + runCommand wrapBintoolsWith wrapCCWith; + # buildPackages.foo rather than buildPackages.buildPackages.foo would work, + # but for splicing messing up on infinite recursion for the variants we + # *dont't* use. Using this workaround, but also making a test to ensure + # these two really are the same. + buildAndroidndk = buildPackages.buildPackages.androidenv.androidndk_10e; + androidndk = androidndk_10e; + targetAndroidndkPkgs = targetPackages.androidenv.androidndkPkgs_10e; + }; } diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index 973be9831861..41b5fd99504d 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -41,7 +41,9 @@ in lib.init bootStages ++ [ targetPlatform = crossSystem; cc = if crossSystem.useiOSPrebuilt or false then buildPackages.darwin.iosSdkPkgs.clang - else if crossSystem.useAndroidPrebuilt + else if (crossSystem.useAndroidPrebuilt && crossSystem.is32bit) + then buildPackages.androidenv.androidndkPkgs_10e.gcc + else if (crossSystem.useAndroidPrebuilt && crossSystem.is64bit) then buildPackages.androidenv.androidndkPkgs.gcc else buildPackages.gcc; };